rotations¶
This module provides a mechanism for simple coordinate transformations. “Simple” here means coordinate tranformations which can be described as any number of serial rotations of a different coordinate frame about the x,y, or z axes.
There are many subtleties involved in describing coordinate rotation mathematically (https://en.wikipedia.org/wiki/Rotation_matrix#Ambiguities)
This module aims to emulate the convention used in the Vallado textbook:
- Rotations are of the coordinate system “underneath” the vector (vector stays fixed, axes move)
- Rotation matrices ( M ) are of the “pre-multiplication” type ( Mv, with v a column vector )
API¶
-
geospacepy.rotations.rot(angles, axis, vecs)[source]¶ Return representation of 3-component vectors vecs in a coordinate systems which has been rotated an angle (angle), about axis (axis)
Parameters: - angles (float or np.ndarray) – The angle(s) (in radians) which the coordinate system will be rotated by. For single float values, all vecs will be rotated by the same angle
- axis (int) – The axis (0,1,2) about which to rotate the coordinate system
- vecs (np.ndarray) – Array of n 3-component vectors for which the components in the rotated coordinate frame will be returned (shape=(n,3))
Returns: rotated_vecs – The components of vecs in the rotated frame (shape=(n,3))
Return type: np.ndarray
-
geospacepy.rotations.rotmat(angle, axis)[source]¶ Return 3x3 elementary rotation matrix (M), which when pre-multiplied (M * v) by a 3x1 column vector (v) returns the new components of v in a coordinate system which has been rotated through an angle (angle) in radians about axis (axis), relative to the vector’s native coordinate system
Parameters: - angle (float) – The angle (in radians) to rotate the coordinate axes by
- axis (int) – The axis (0,1,2) about which the rotation should be performed
Returns: M – The rotation matrix
Return type: np.ndarray, shape=(3,3)
Notes
Positive angles represent rotations according the the right hand rule (the directions of the fingers if the thumb is the axis)