mt.geo.transformation
Base tools to represent a geometric transformer and the act of transforming geometric objects (transformation).
Functions
transform()
: Transforms an object using a given transformer.transformable()
: Checks if an object can be transformed using a transformer.register_transform()
: Registers a function to transform an object of a given type using a transformer of a given type.register_transformable()
: Registers a function to check if we can transform an object of a given type using a transformer of another given type.
- mt.geo.transformation.transform(tfm, obj)
Transforms an object using a given transformer.
- Parameters:
tfm (GeometricObject) – the transformer. It must contain the Transformer mixin.
obj (GeometricObject) – object to transform from
- Returns:
the transformed version of obj
- Return type:
object
- Raises:
NotImplementedError – if the approx function has not been registered using function register_transform
- mt.geo.transformation.transformable(tfm, obj)
Checks if an object can be transformed using a transformer.
- Parameters:
tfm (Transformer) – a transformer
obj (object) – object to transform from
- Returns:
whether or not the object is transformable using the transformer
- Return type:
bool
- Raises:
NotImplementedError – if the transformable function has not been registered using functions register_transformable or register_transform
- mt.geo.transformation.register_transform(tfm_type, obj_type, func)
Registers a function to transform an object of a given type using a transformer of a given type.
- Parameters:
tfm_type (type) – type or class of the transformer
obj_type (type) – type or class of the object to transform from
func (function) – transform function f(tfm, obj) -> obj to register
- mt.geo.transformation.register_transformable(tfm_type, obj_type, func)
Registers a function to check if we can transform an object of a given type using a transformer of another given type.
- Parameters:
tfm_type (type) – type or class of the transformer
obj_type (type) – type or class of the object to transform from
func (function) – transformable function f(tfm_type, obj) -> bool to register
Classes
Transformer
: A mixin asserting that this is a class of transformers.InvertibleTransformer
: A mixin asserting that this is a class of invertible transformers.LieTransformer
: A mixin asserting that this is a class of transformers living in a Lie group, supporting the associative multiplication operator and the inversion operator.
- class mt.geo.transformation.Transformer
A mixin asserting that this is a class of transformers.
A transformer is an object capable of transforming geometric objects of certain types into other geometric objects. It is usually parametrised by a transformation matrix. The mixin assumes that the act of transforming an object using the inheriting class is conducted via calling the global transform function. The mixin overloads the left shift operator.
Inheritance
digraph inheritance3a512c4748 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "Transformer" [URL="#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."]; }- __lshift__(obj)
Transforms an object or raise a ValueError if the object is not transformable by the transformer.
- __weakref__
list of weak references to the object (if defined)
- class mt.geo.transformation.InvertibleTransformer
A mixin asserting that this is a class of invertible transformers.
The mixin assumes that a function self.invert() to return the inverted transformer has been implemented. It further overloads the right shift operator and the inverse operator.
Inheritance
digraph inheritance057ea9c2aa { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "InvertibleTransformer" [URL="#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)"]; "Transformer" [URL="#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."]; }- __invert__()
Returns the inverted transformer, invoking a given function self.invert().
- __rshift__(obj)
Inversely transforms an object or raises a ValueError if the object is not transformable by the transformer.
- invert()
Inverses the transformer
- class mt.geo.transformation.LieTransformer
A mixin asserting that this is a class of transformers living in a Lie group, supporting the associative multiplication operator and the inversion operator.
Beside being an invertible transformer, the mixin additionally assumes that a function self.multiply(other) implementing the multiplication operator is available. It further overloads the multiplication, true division and modular operators, and provides a conjugate function.
Inheritance
digraph inheritance5df1a239b7 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "InvertibleTransformer" [URL="#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.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.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."]; }- __mod__(other)
a%b = (~a)*b
- __mul__(other)
a*b = Lie operator
- __truediv__(other)
a/b = a*(~b)
- conjugate(other)
Conjugate: self.conjugate(other) = self*other*self^{-1}
- multiply(other)
Multiplies the transformer with another transformer.