Hi there,
currrently there appears to be no function to create a Matrix4 from 16 fields. I currently need this in order to interact with the pixel matrix of a Mapbox GL js map. In an older version of this package the following was possible:
case matrixAsArray of
[ m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44 ] ->
mat4 m11 m12 m13 m14 m21 m22 m23 m24 m31 m32 m33 m34 m41 m42 m43 m44
_ ->
Matrix4.identity
Have a missed this function in the current release?
I would appreciate your feedback. I would imagine that it would work well to create a function with the following signature:
{-| Creates a Matrix4 from four Vec4
-}
makeFrom4Vec4 : Vec4 -> Vec4 -> Vec4 -> Vec4 -> Mat4
makeFrom4Vec4 = Native.MJS.m4x4makeBasis
or:
{-| Creates a Matrix4 from a list of elements. If the number of elements
is not exactly 16, this returns Nothing.
-}
makeFromList : List Float ->Maybe Mat4
makeFromList list =
case list of
[ m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44 ] ->
Just M4x4.$ pixelMatrix
_ ->
Nothing