package OCADml
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=fc0b0a0ff598ff06550dfe0a93b279dc2df018914cc7883872d676d7da4dc14c
sha512=e02d943fbed9334730223ea12447b2495812db0bab20302516891d24c088fa8c4a60c366d0e083f4e675a25b394d101d115d3595e05284298d5803acc92351cf
doc/OCADml/OCADml/Affine2/index.html
Module OCADml.Affine2
Source
A 2d affine transformation matrix.
Basic Matrix Operations
trace t
Sum the elements on the main diagonal (upper left to lower right) of t
.
get t r c
Get the element at r
ow and c
olumn 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
.
a % b
Mathematical composition of affine transformations a
and b
, equivalent to mul a b
.
Construction
v e00 e01 e02 e10 e11 e12 e20 e21 e22
Create a 2d affine matrix from elements in row major order.
Construction by Rows
of_rows rows
Create an 2d affine transformation matrix from two rows. The last row is set to 0., 0., 1.
.
of_row_matrix_exn m
Convert the float matrix m
into a t
if it is the correct shape (3 x 3), otherwise raise Invalid_argument
.
of_row_matrix m
Convert the float matrix m
into a t
if it is the correct shape (3 x 3).
Element Accessors
Transforms
translation v
Create a 2d affine transformation matrix from the xy translation vector v
.
xtrans x
Create a 2d affine transformation matrix that applies a translation of x
distance along the x-axis.
ytrans y
Create a 2d affine transformation matrix that applies a translation of y
distance along the y-axis.
rotate ?about r
Create an affine transformation matrix that applies a rotation of r
radians around the origin (or the point about
if provided).
zrot ?about r
Create an affine transformation matrix that applies a rotation of r
radians around the origin (or the point about
if provided). Alias of rotate
.
align a b
Compute an affine transformation matrix that would bring the vector a
into alignment with b
.
scale v
Create a 2d affine transformation matrix from the xyz scaling vector v
.
xscale x
Create a 2d affine transformation matrix that applies x-axis scaling.
yscale y
Create a 2d affine transformation matrix that applies y-axis scaling.
mirror ax
Create an affine transformation matrix that applies a reflection across the axis ax
.
skew 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-axis
transform t v
Apply the 2d affine transformation matrix t
to the vector v
.