Scad_ml.Affine3Affine transformation matrices for transforming 3d vectors (V3.t), and 3d shapes (Scad.t) via OpenSCAD's own multmatrix, (see Scad.affine).
A 3d affine transformation matrix.
To be used with OpenSCADs multmatrix, which is applied in this library with Scad.affine.
val id : tThe identity matrix.
val trace : t -> floattrace t
Sum the elements on the main diagonal (upper left to lower right) of t.
val get : t -> int -> int -> floatget t r c
Get the element at row and column of t. Equivalent to t.(r).(c). Raises Invalid_argument if access is out of bounds.
compose a b
Compose the affine transformations a and b. Equivalent to mul b a, which when applied, will perform the transformation a, then the transformation b.
of_rows rows
Create an affine transformation matrix from three rows. The last row is set to 0., 0., 0., 1..
val of_row_matrix_exn : float array array -> tof_row_matrix_exn m
Convert the float matrix m into a t if it is the correct shape (4 x 4), otherwise raise Invalid_argument.
val of_row_matrix : float array array -> ( t, string ) Stdlib.resultof_row_matrix m
Convert the float matrix m into a t if it is the correct shape (4 x 4).
translate v
Create an affine transformation matrix from the xyz translation vector v.
val xtrans : float -> txtrans x
Create an affine transformation matrix that applies a translation of x distance along the x-axis.
val ytrans : float -> tytrans y
Create an affine transformation matrix that applies a translation of y distance along the y-axis.
val ztrans : float -> tztrans z
Create an affine transformation matrix that applies a translation of z distance along the z-axis.
mirror ax
Create an affine transformation matrix that applies a reflection across the axis ax.
xrot ?about r
Create an affine transformation matrix that applies a x-axis rotation of r radians around the origin (or the point about if provided).
yrot ?about r
Create an affine transformation matrix that applies a y-axis rotation of r radians around the origin (or the point about if provided).
zrot ?about r
Create an affine transformation matrix that applies a z-axis rotation of r radians around the origin (or the point about if provided).
rotate ?about r
Create an affine transformation matrix that applies the euler (zyx) rotation represented by r radians around the origin (or the point about if provided).
axis_rotate ?about ax r
Create an affine transfomation matrix that applies a rotation of r radians around the axis ax through the origin (or the point about if provided).
align a b
Compute an affine transformation matrix that would bring the vector a into alignment with b.
val skew :
?xy:float ->
?xz:float ->
?yx:float ->
?yz:float ->
?zx:float ->
?zy:float ->
unit ->
tskew ?xy ?xz ?yx ?yz ?zx ?zy ()
Create an affine transformation matrix that applies a skew transformation with the given skew factor multipliers. Factors default to 0. if not provided.
xy: skew along the x-axis as you get farther from the y-axisxz: skew along the x-axis as you get farther from the z-axisyx: skew along the y-axis as you get farther from the x-axisyz: skew along the y-axis as you get farther from the z-axiszx: skew along the z-axis as you get farther from the x-axiszy: skew along the z-axis as you get farther from the y-axisval skew_xy : float -> float -> tskew_xy xa ya
Create an affine transformation matrix that applies a skew transformation along the xy plane.
xa: skew angle (in radians) in the direction of the x-axisya: skew angle (in radians) in the direction of the y-axisval skew_xz : float -> float -> tskew_xz xa za
Create and affine transformation matrix that applies a skew transformation along the xz plane.
xa: skew angle (in radians) in the direction of the x-axisza: skew angle (in radians) in the direction of the z-axisval skew_yz : float -> float -> tskew_yz ya za
Create and affine transformation matrix that applies a skew transformation along the yz plane.
ya: skew angle (in radians) in the direction of the y-axisza: skew angle (in radians) in the direction of the z-axistransform t v
Apply the affine transformation matrix t to the vector v.
val to_string : t -> stringto_string t
Convert the matrix t to a simple string representation compatible with OpenSCAD multmatrix.
project t
Project t down into a 2d affine transformation matrix (z axis components dropped).
val of_quaternion : ?trans:V3.t -> Quaternion.t -> Affine3.tof_quaternion q
Create an affine transformation matrix equivalent to the quaternion q.