autopew.transform.affine

Submodule for calculating affine transforms between planar coordinate systems.

autopew.transform.affine.affine_from_AB(X, Y)[source]

Create an affine transforamtion matrix based on two sets of coordinates.

Note

  • This is an augmented matrix, and includes the translation component
autopew.transform.affine.affine_transform(A)[source]

Create an affine transform function based on affine matrix A.

autopew.transform.affine.compose_affine2d(T=array([[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]]), Z=array([[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]]), R=array([[ 1., 0., 0.], [-0., 1., 0.], [ 0., 0., 1.]]))[source]

Compose an affine transformation matrix based on translation, zoom and rotation components.

Parameters:T, Z, R (numpy.ndarray) – Component affine transfrom matricies for translation, zoom/scaling and rotation.
Returns:A
Return type:numpy.ndarray
autopew.transform.affine.corners(size)[source]
autopew.transform.affine.decompose_affine2d(A)[source]

Decompose an affine transform into components using a polar transform.

Returns:T, Z, R
Return type:numpy.ndarray

Note

This decomposes the transform into the sequence rotation - zoom - translation.

To recompose this transform,

autopew.transform.affine.rotate(theta=0, degrees=True)[source]

Generate a 2D affine rotation matrix.

Uses clockwise rotations.

autopew.transform.affine.shear(x=0, y=0)[source]

Generate a 2D affine shear matrix.

autopew.transform.affine.translate(x=0, y=0)[source]

Generate a 2D affine translation matrix.

autopew.transform.affine.zoom(x=1, y=1)[source]

Generate a 2D affine zoom matrix.