affine#

GeosArray.affine(matrix)#

Performs a 2D or 3D affine transformation on all the coordinates.

2D
\[\begin{split}\begin{bmatrix} x' \\ y' \\ 1 \end{bmatrix} = \begin{bmatrix} a & b & x_{off} \\ d & e & y_{off} \\ 0 & 0 & 1 \\ \end{bmatrix} \begin{bmatrix} x \\ y \\ 1 \end{bmatrix}\end{split}\]
3D
\[\begin{split}\begin{bmatrix} x' \\ y' \\ z' \\ 1 \end{bmatrix} = \begin{bmatrix} a & b & c & x_{off} \\ d & e & f & y_{off} \\ g & h & i & z_{off} \\ 0 & 0 & 0 & 1 \\ \end{bmatrix} \begin{bmatrix} x \\ y \\ z \\ 1 \end{bmatrix}\end{split}\]
Parameters:

matrix (numpy.ndarray or list-like) – Affine transformation matrix.

Returns:

Transformed geometries

Return type:

pgpd.GeosArray

Note

The transformation matrix can be one of the following types:

  • numpy.ndarray <3x3 or 2x3>
    Performs a 2D affine transformation, where the last row of homogeneous coordinates can optionally be discarded.

  • list-like <6>
    Performs a 2D affine transformation, where the matrix represents (a, b, d, e, xoff, yoff).

  • numpy.ndarray <4x4 or 3x4>
    Performs a 3D affine transformation, where the last row of homogeneous coordinates can optionally be discarded.

  • list-like <12>
    Performs a 3D affine transformation, where the matrix represents (a, b, c, d, e, f, g, h, i, xoff, yoff, zoff).