pub struct Rotation3 { /* private fields */ }Expand description
A rotation in three dimensions, stored as a unit quaternion.
Implementations§
Source§impl Rotation3
impl Rotation3
pub fn identity() -> Self
Sourcepub fn from_quaternion(q: Quaternion) -> Self
pub fn from_quaternion(q: Quaternion) -> Self
Wraps a quaternion, normalising it.
pub fn from_axis_angle(axis: [f64; 3], angle: f64) -> Self
Sourcepub fn from_matrix(m: &Matrix3) -> Self
pub fn from_matrix(m: &Matrix3) -> Self
From a rotation matrix; use nearest_rotation_matrix first if it may be noisy.
pub fn from_euler(sequence: EulerSequence, angles: [f64; 3]) -> Self
Sourcepub fn from_two_vectors(from: [f64; 3], to: [f64; 3]) -> Self
pub fn from_two_vectors(from: [f64; 3], to: [f64; 3]) -> Self
The shortest rotation taking direction from to direction to.
pub fn quaternion(&self) -> Quaternion
pub fn matrix(&self) -> Matrix3
Sourcepub fn axis_angle(&self) -> ([f64; 3], f64)
pub fn axis_angle(&self) -> ([f64; 3], f64)
Unit axis and angle in [0, π].
pub fn to_euler(&self, sequence: EulerSequence) -> Option<[f64; 3]>
pub fn inverse(&self) -> Self
Sourcepub fn rotate_about(&self, p: [f64; 3], pivot: [f64; 3]) -> [f64; 3]
pub fn rotate_about(&self, p: [f64; 3], pivot: [f64; 3]) -> [f64; 3]
Rotates a point about pivot instead of the origin.
Sourcepub fn angle_to(&self, other: &Rotation3) -> f64
pub fn angle_to(&self, other: &Rotation3) -> f64
The angle of the rotation that takes self to other.
pub fn slerp(&self, other: &Rotation3, t: f64) -> Self
Sourcepub fn from_rotvec(v: [f64; 3]) -> Self
pub fn from_rotvec(v: [f64; 3]) -> Self
From a rotation vector (SciPy’s from_rotvec): the axis scaled by the angle in radians.
Sourcepub fn as_rotvec(&self) -> [f64; 3]
pub fn as_rotvec(&self) -> [f64; 3]
The rotation vector (SciPy’s as_rotvec): axis times angle, the angle in [0, π].
Sourcepub fn from_mrp(p: [f64; 3]) -> Self
pub fn from_mrp(p: [f64; 3]) -> Self
From modified Rodrigues parameters p = n tan(θ/4) (SciPy’s from_mrp).
Sourcepub fn as_mrp(&self) -> [f64; 3]
pub fn as_mrp(&self) -> [f64; 3]
The modified Rodrigues parameters n tan(θ/4), θ ∈ [0, π] (SciPy’s as_mrp).
Sourcepub fn from_uniform(u1: f64, u2: f64, u3: f64) -> Self
pub fn from_uniform(u1: f64, u2: f64, u3: f64) -> Self
A rotation from three numbers uniform on [0, 1) (Shoemake’s method): with uniform inputs
the rotations are uniformly distributed (Haar measure), as SciPy’s Rotation.random.