Matrix2d, Matrix3d represent the transformation matrices of transformation objects.
The general transformation objects plot::Transform2d and plot::Transform3d allow to apply the affine-linear transformation to 2D and 3D objects, respectively. Depending on the dimension, the transformation matrix A can be accessed and changed via the attributes Matrix2d, Matrix3d, of the transformation object. The shift vector b can be accessed and changed via the attribute Shift.
When setting the matrix attribute, matrices, arrays, lists of lists, and plain lists are accepted. Internally, however, the matrix data are always stored as a plain list
[A1, 1, A1, 2, A2, 1, A2, 2]
in 2D or
[A1, 1, A1, 2, …, A3, 2, A3, 3]
in 3D, respectively, representing the matrix row by row. When reading the matrix by a slot access, this plain list is returned.
The entries of Matrix2d, Matrix3d can be animated.
We apply a linear transformation to an arrow:
A := matrix([[1, -1], [1, 1]]): g := plot::Transform2d(A, plot::Arrow2d([0, 0], [0, 1])): plot(g)
The Matrix2d corresponding to the transformation is stored as a plain list in the corresponding slot of g:
delete f, g: