ddg.abc module

class ddg.abc.LinearTransformable[source]

Bases: ABC

Interface for linearly transformable objects.

The transformations are projective transformations in homogeneous coordinates.

ambient_dimension: int
abstract transform(F)[source]

Return a linearly transformed copy.

The transformation is assumed to be a projective transformation in homogeneous coordinates.

Parameters:
Fnumpy.ndarray of shape (ambient_dimension + 1, ambient_dimension + 1)
Returns:
type(self)
change_affine_picture(before, after=-1)[source]

Transform the object to a different affine view.

Dehomogenizing the object post-transform with affine component after will produce the same affine picture as dehomogenizing the object pre-transform with affine component before.

The actual transformation that achieves this just permutes the homogeneous coordinates as follows: It deletes the entry at before and inserts it again at position after.

Here are two examples of how you might use this function:

  1. You defined a projective object X with a certain affine picture in mind and you followed our convention of using affine component -1. You now want to see what it would look like when dehomogenized using a different affine component i. To do this, you would just do X_ = X.change_affine_picture(i) and then visualize the object normally.

  2. You don’t like our convention of dehomogenizing by the last component and want to define your object X with the affine picture with respect to affine component i in mind. To visualize your object as you imagine it, you would also do X_ = X.change_affine_picture(i).

Parameters:
beforeint
afterint (default=-1)
Returns:
type(self)