mt.geond.affine
Affine transformation in ND.
Functions
transform_Aff_on_Moments()
: Transform the Moments using an affine transformation.transform_Aff_on_PointList()
: Transform a point list using an affine transformation.
- mt.geond.affine.transform_Aff_on_Moments(aff_tfm, moments)
Transform the Moments using an affine transformation.
Classes
Aff
: A transformer to perform affine transformations using the same transformation matrix in n-dim space.
- class mt.geond.affine.Aff(weight=array([[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]]), bias=array([0., 0., 0.]), check_shapes=True)
A transformer to perform affine transformations using the same transformation matrix in n-dim space.
Examples
>>> from mt import np, geond as gn >>> a = gn.Aff(weight=np.array([[1,-1],[-2,3]]), bias=np.array([3,4])) >>> a.bias array([3, 4]) >>> a.weight array([[ 1, -1], [-2, 3]]) >>> a.matrix array([[ 1., -1., 3.], [-2., 3., 4.], [ 0., 0., 1.]]) >>> ~a Aff(weight_diagonal=[3. 1.], bias=[-13. -10.]) >>> a*~a Aff(weight_diagonal=[1. 1.], bias=[0. 0.]) >>> ~a*a Aff(weight_diagonal=[1. 1.], bias=[0. 0.]) >>> a/a Aff(weight_diagonal=[1. 1.], bias=[0. 0.]) >>> a%a Aff(weight_diagonal=[1. 1.], bias=[0. 0.]) >>> a*a Aff(weight_diagonal=[ 3 11], bias=[ 2 10]) >>> a*a*a Aff(weight_diagonal=[11 41], bias=[-5 30]) >>> (a*a)*a Aff(weight_diagonal=[11 41], bias=[-5 30]) >>> a*(a*a) Aff(weight_diagonal=[11 41], bias=[-5 30]) >>> b = gn.Aff(weight=np.array([[1,-1],[-3,2]]), bias=np.array([2,1])) >>> a*b Aff(weight_diagonal=[4 8], bias=[4 3]) >>> b*a Aff(weight_diagonal=[3 9], bias=[1 0]) >>> a.conjugate(b) Aff(weight_diagonal=[ 6. -3.], bias=[-18. 66.])
Inheritance
digraph inheritance255988c9b4 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "Aff" [URL="#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)"]; "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)"]; "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__(weight=array([[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]]), bias=array([0., 0., 0.]), check_shapes=True)
- __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.
- property dim
Returns the dimension of the transformation.
- invert()
Lie inverse
- property matrix
Returns the transformation matrix.
- multiply(other)
a*b = Lie operator
- property ndim
Returns the number of dimensions in which the geometric object lives.
- property weight
The weight/linear component of the affine transformation matrix.
- property weight_shape
Returns the shape of the weight matrix.