UnitaryTransformation
A metatype for representing a unitary transformation of 3D coordinates.
Attributes
A UnitaryTransformation object represents an affine transformation of space coordinates composed of a translation, \vec{t}, and of a unitary linear transformation, U, e.g. a rotation. It changes the space coordinates \vec{r} to \vec{r}' as:
The UnitaryTransformation preserves angles and distances. It has the following attributes:
Name | Type | Description |
---|---|---|
translation | double [3] |
Translation vector, \vec{t}, in m. |
matrix | double [3][3] |
Unitary matrix, U, representing the linear transformation, e.g. a rotation. |
Constructor
The UnitaryTransformation constructor has 3 forms as detailed in the synopsis below.
Synopsis
pumas.UnitaryTransformation(translation, matrix)
pumas.UnitaryTransformation{translation=, matrix=}
pumas.UnitaryTransformation(transformation)
Note
In the second form arguments are optional, but for the sake of simplicity only the full form is reported. If not specified the translation attribute is set to the null translation and the matrix attribute is set to the identity.
Arguments
Name | Type | Description |
---|---|---|
translation | double [3] or table |
Translation vector, \vec{t}, in m. |
matrix | double [3][3] or table |
Unitary matrix, U, representing the linear transform, e.g. a rotation. |
transformation | UnitaryTransformation | Another UnitaryTransformation instance. |
Note
When providing a Lua table as argument its length must be consistent with the corresponding C type.
Warning
The provided matrix must be unitary, e.g. representing a rotation or a reflection.
See also
UnitaryTransformation.clone
Get a copy (clone) of the transformation instance.
Synopsis
UnitaryTransformation:clone()
Arguments
None, except self.
Returns
Type | Description |
---|---|
UnitaryTransformation | Copy of the transformation. |
See also
UnitaryTransformation.from_euler
Set the matrix of the unitary transformation to a rotation defined by Euler angles.
Synopsis
UnitaryTransformation:from_euler(axis, alpha, (beta), (gamma))
Arguments
Name | Type | Description |
---|---|---|
axis | string |
Sequence of rotation axis (see below). |
alpha | number |
Rotation angle around the 1st axis, in radians. |
(beta) | number |
Rotation angle around the 2nd axis, in radians. |
(gamma) | number |
Rotation angle around the 3rd axis, in radians. |
The sequence of rotations is encoded in the axis argument by specifying the
'x'
, 'y'
or 'z'
rotation axis according to their order of occurence.
Lower case letters indicate a sequence of extrinsic rotations while upper case
letters are for intrinsic ones. For example, XZX
indicates proper Euler angles
rotations around the intrinsic x', z' and x'-axis.
Returns
Type | Description |
---|---|
UnitaryTransformation | Reference to the updated transformation. |