mt.geo3d.affine

Affine transformation in 3D.

Functions

mt.geo3d.affine.transform_Aff3d_on_Moments3d(aff_tfm, moments)

Transform a Moments3d using a 3D affine transformation.

Parameters:
  • aff_tfm (Aff3d) – 3D affine transformation

  • moments (Moments3d) – 3D moments

Returns:

affined-transformed 3D moments

Return type:

Moments3d

mt.geo3d.affine.transform_Aff3d_on_PointList3d(aff_tfm, point_list)

Transform a 3D point list using a 3D affine transformation.

Parameters:
  • aff_tfm (Aff3d) – a 3D affine transformation

  • point_list (PointList3d) – a 3D point list

Returns:

affine-transformed point list

Return type:

PointList3d

mt.geo3d.affine.rot3d_x(angle: float)

Gets 3D rotation about the x-axis (roll rotation).

Parameters:

angle (float) – the angle to rotate

Returns:

tfm – The output rotation

Return type:

Aff3d

mt.geo3d.affine.rot3d_y(angle: float)

Gets 3D rotation about the y-axis (pitch rotation).

Parameters:

angle (float) – the angle to rotate

Returns:

tfm – The output rotation

Return type:

Aff3d

mt.geo3d.affine.rot3d_z(angle: float)

Gets 3D rotation about the z-axis (yaw rotation).

Parameters:

angle (float) – the angle to rotate

Returns:

tfm – The output rotation

Return type:

Aff3d

Classes

  • Aff3d: Affine transformation in 3D.

class mt.geo3d.affine.Aff3d(offset=array([0., 0., 0.]), linear: ndarray | mat3x3 = mat3x3((1, 0, 0), (0, 1, 0), (0, 0, 1)))

Affine transformation in 3D.

The 3D affine transformation defined here consists of a linear/weight part and an offset/bias part.

offset

the bias vector

Type:

glm.vec3

bias

the numpy view of offset

Type:

numpy.ndarray

linear

the weight matrix

Type:

glm.mat3

weight

the numpy view of linear

Type:

numpy.ndarray

References

Inheritance

digraph inheritance4b6901da6f { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "Aff" [URL="../mt.geond/mt.geond.affine.html#mt.geond.affine.Aff",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A transformer to perform affine transformations using the same transformation matrix in n-dim space."]; "LieTransformer" -> "Aff" [arrowsize=0.5,style="setlinewidth(0.5)"]; "GeometricObject" -> "Aff" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Aff3d" [URL="#mt.geo3d.affine.Aff3d",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Affine transformation in 3D."]; "ThreeD" -> "Aff3d" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Aff" -> "Aff3d" [arrowsize=0.5,style="setlinewidth(0.5)"]; "GeometricObject" [URL="../mt.geo/mt.geo.object.html#mt.geo.object.GeometricObject",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A geometric object which lives in a d-dimensional Euclidean space."]; "InvertibleTransformer" [URL="../mt.geo/mt.geo.transformation.html#mt.geo.transformation.InvertibleTransformer",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A mixin asserting that this is a class of invertible transformers. "]; "Transformer" -> "InvertibleTransformer" [arrowsize=0.5,style="setlinewidth(0.5)"]; "LieTransformer" [URL="../mt.geo/mt.geo.transformation.html#mt.geo.transformation.LieTransformer",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A mixin asserting that this is a class of transformers living in a Lie group, supporting the associative multiplication operator and the inversion operator. "]; "InvertibleTransformer" -> "LieTransformer" [arrowsize=0.5,style="setlinewidth(0.5)"]; "ThreeD" [URL="../mt.geo/mt.geo.object.html#mt.geo.object.ThreeD",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Mixin to assert that the geometric object lives in 3D Euclidean space."]; "Transformer" [URL="../mt.geo/mt.geo.transformation.html#mt.geo.transformation.Transformer",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A mixin asserting that this is a class of transformers."]; }
__init__(offset=array([0., 0., 0.]), linear: ndarray | mat3x3 = mat3x3((1, 0, 0), (0, 1, 0), (0, 0, 1)))
__repr__()

Return repr(self).

property bias

The bias component of the affine transformation matrix.

property bias_dim

Returns the dimension of the bias vector.

property det

Returns the determinant of the transformation matrix.

static from_matrix(mat: ndarray)

Obtains an Aff3d instance from a non-singular affine transformation matrix.

Parameters:

mat (a 3x3 array) – a non-singular affine transformation matrix

Returns:

An instance representing the transformation

Return type:

Aff3d

Notes

For speed reasons, no checking is involved.

invert()

Lie inverse

property matrix

Returns the transformation matrix.

multiply(other)

a*b = Lie operator

property ndim

the dimensionality, which is 3

property weight

The weight/linear component of the affine transformation matrix.

property weight_shape

Returns the shape of the weight matrix.