ianmackenzie / elm-geometry-linear-algebra-interop / Geometry.Interop.LinearAlgebra.Frame3d

Conversion functions for Frame3d.

toMat4 : Frame3d units coordinates defines -> Math.Matrix4.Mat4

Convert a Frame3d to a Mat4. The resulting matrix can be thought of in a couple of ways:

The first bullet implies that something like

Frame3d.atOrigin
    |> Frame3d.translateBy displacement
    |> Frame3d.rotateAround axis angle
    |> Frame3d.mirrorAcross plane
    |> Frame3d.toMat4

gives you a transformation matrix that is equivalent to applying the given displacement, then the given rotation, then the given mirror. The second bullet means that, for example,

Point3d.placeIn frame

is equivalent to

Point3d.transformBy (Frame3d.toMat4 frame)

and

Point3d.relativeTo frame

is equivalent to

Point3d.transformBy <|
    Matrix4.inverseOrthonormal
        (Frame3d.toMat4 frame)