SpinToolkit python documentation

Class

class spintoolkit_py.Mat3_rotation

Bases: spintoolkit_py.Mat3

3x3 real rotation matrix stored in column major order.

__init__(self)

Default constructor.

__init__(self, *, omega: spintoolkit_py.Vec3, theta: float)

Construct from axis and angle, \(R(\theta \hat{\omega})\).

Parameters:
  • omega – Rotation axis.

  • theta – Rotation angle.

__init__(self, *, alpha: float, beta: float, gamma: float)

Construct from Euler angles (ZYZ convention), \(R(\alpha,\beta,\gamma)=R(\alpha \hat{e}_z) R(\beta \hat{e}_y) R(\gamma \hat{e}_z)\).

Parameters:
  • alpha – The first rotation angle \(\alpha\) around the Z-axis, \(0\le \alpha \lt 2\pi\).

  • beta – The second rotation angle \(\beta\) around the Y-axis. \(0\le \beta \le \pi\).

  • gamma – The third rotation angle \(\gamma\) around the Z-axis. \(0 \le \gamma \lt 2\pi\).

__init__(self, *, vi: spintoolkit_py.Vec3, vf: spintoolkit_py.Vec3)

Construct from two vectors, \(R \, \vec{v}_i = \vec{v}_f\).

Parameters:
  • vi – The starting vector.

  • vf – The target vector.

toAxisAngle(self: spintoolkit_py.Mat3_rotation) tuple[spintoolkit_py.Vec3, float]

Convert the rotation matrix to axis and angle, \(R(\theta \hat{\omega})\).

Returns:

  • omega (~spintoolkit_py.Vec3) – Rotation axis.

  • theta (float) – Rotation angle.

toEulerZYZ(self: spintoolkit_py.Mat3_rotation) tuple[float, float, float]

Convert the rotation matrix to Euler angles (ZYZ convention), \(R(\alpha,\beta,\gamma)=R(\alpha \hat{e}_z) R(\beta \hat{e}_y) R(\gamma \hat{e}_z)\).

Returns:

  • alpha (float) – The first rotation angle \(\alpha\) around the Z-axis, \(0\le \alpha \lt 2\pi\).

  • beta (float) – The second rotation angle \(\beta\) around the Y-axis. \(0\le \beta \le \pi\).

  • gamma (float) – The third rotation angle \(\gamma\) around the Z-axis. \(0 \le \gamma \lt 2\pi\).