polynomials_on_simplices.linalg.rotation module¶
Basic functionality for rotations.
-
axis_angle_to_rotation_matrix
(axis, angle)[source]¶ Convert an axis-angle representation of a rotation (exponential coordinates) to the corresponding rotation matrix.
Parameters: - axis – Rotation axis (unit vector).
- angle – Rotation angle.
Returns: Rotation matrix (orthogonal matrix).
-
compute_rotation
(v0, v1)[source]¶ Compute the rotation in axis-angle representation which would transform one vector into another, while keeping orthogonal vectors fixed.
Parameters: - v0 – Initial vector (unit vector).
- v1 – Final vector (unit vector).
Returns: Tuple of an axis (3d vector) and an angle (scalar).
-
hat
(w)[source]¶ Get the skew-symmetric matrix \(\hat{\omega}\) corresponding to a rotation vector \(\omega\), i.e., the matrix \(\hat{\omega}\) such that
\[\hat{\omega} v = \omega \times v, \, \forall v \in \mathbb{R}^3.\]Commonly referred to as the “hat” map.
Parameters: w – Euler vector (rotation vector). Returns: Equivalent skew-symmetric matrix (\(\hat{\omega}\)).
-
random_rotation_matrix_2
()[source]¶ Generate a random 2d rotation matrix.
Returns: Rotation matrix (orthogonal matrix).
-
random_rotation_matrix_3
()[source]¶ Generate a random 3d rotation matrix.
Returns: Rotation matrix (orthogonal matrix).
-
rodrigues_formula
(v, k, cost, sint)[source]¶ Rotate a vector in \(\mathbb{R}^3\) using Rodrigues’ formula.
Parameters: - v – Vector to be rotated.
- k – Unit vector describing the axis of rotation.
- cost – Cosine of the rotation angle.
- sint – Sine of the rotation angle.
Returns: Rotated vector.
-
rodrigues_formula_matrix
(k, cost, sint)[source]¶ Compute a rotation matrix from a rotation axis and cosine and sine values of the rotation angle using the matrix form of Rodrigues’ formula.
Parameters: - k – Unit vector describing the axis of rotation.
- cost – Cosine of the rotation angle.
- sint – Sine of the rotation angle.
Returns: Rotation matrix (3 by 3 Numpy array).