rotate#
- GeosSeriesAccessor.rotate(*angles, origin)#
Performs a 2D or 3D rotation on all the coordinates.
- 2D
- \[\begin{split}\begin{bmatrix} x' \\ y' \\ 1 \end{bmatrix} &= \begin{bmatrix} cos(a) & -sin(a) & x_{off} \\ sin(a) & cos(a) & y_{off} \\ 0 & 0 & 1 \\ \end{bmatrix} \begin{bmatrix} x \\ y \\ 1 \end{bmatrix} \\ x_{off} &= x_{origin} - x_{origin}*cos(a) + y_{origin}*sin(a) \\ y_{off} &= y_{origin} - x_{origin}*sin(a) - y_{origin}*cos(a)\end{split}\]
- 3D
- \[\begin{split}\begin{bmatrix} x' \\ y' \\ z' \\ 1 \end{bmatrix} &= \begin{bmatrix} cos(a_z)*cos(a_y) & cos(a_z)*sin(a_y)*sin(a_x) - sin(a_z)*cos(a_x) & cos(a_z)*sin(a_y)*cos(a_x) + sin(a_z)*sin(a_x) & x_{off} \\ sin(a_z)*cos(a_y) & sin(a_z)*sin(a_y)*sin(a_x) + cos(a_z)*cos(a_x) & sin(a_z)*sin(a_y)*cos(a_x) - cos(a_z)*sin(a_x) & y_{off} \\ -sin(a_y) & cos(a_y)*sin(a_x) & cos(a_y)*cos(a_x) & z_{off} \\ 0 & 0 & 0 & 1 \\ \end{bmatrix} \begin{bmatrix} x \\ y \\ z \\ 1 \end{bmatrix} \\ x_{off} &= x_{origin} - (a)*x_{origin} - (b)*y_{origin} - (c)*z_{origin} \\ y_{off} &= y_{origin} - (d)*x_{origin} - (e)*y_{origin} - (f)*z_{origin} \\ z_{off} &= z_{origin} - (g)*x_{origin} - (h)*y_{origin} - (i)*z_{origin}\end{split}\]
- Parameters:
angles (float) – 2D rotation angle or X,Y,Z 3D rotation angles in radians.
origin (shapely.lib.Geometry or list-like) – Origin point for the transformation.
- Returns:
Transformed geometries.
- Return type: