pub struct Rotor<const D: usize> { /* private fields */ }Expand description
A rotor — performs rotations in D dimensions.
Internally stores the rotation matrix. This is optimal for the hot path (applying rotations to many points) and avoids lossy rotor↔matrix round-trips. Construction uses geometric algebra (bivectors, plane-angle), but once built the matrix is the canonical representation.
Stack-allocated via SMatrix<f64, D, D>.
Implementations§
Source§impl<const D: usize> Rotor<D>
impl<const D: usize> Rotor<D>
Sourcepub fn from_plane_angle(plane: &Bivector<D>, angle: f64) -> Self
pub fn from_plane_angle(plane: &Bivector<D>, angle: f64) -> Self
Rotation by angle radians in the plane defined by plane bivector.
Positive angle rotates from the first axis toward the second axis
of the plane (e.g., unit_plane(0,1) with positive angle rotates x→y).
Uses Rodrigues formula: M = I - sin(θ)*B̂ + (1-cos(θ))*B̂² (The sign on sin is negative because our bivector convention has B̂[i,j]=+1, B̂[j,i]=-1, producing clockwise rotation. The negation makes positive angles go counterclockwise: axis_i → axis_j.)
Sourcepub fn from_vectors(from: &SVector<f64, D>, to: &SVector<f64, D>) -> Self
pub fn from_vectors(from: &SVector<f64, D>, to: &SVector<f64, D>) -> Self
Rotation from unit vector from to unit vector to.
Sourcepub fn from_matrix(mat: SMatrix<f64, D, D>) -> Self
pub fn from_matrix(mat: SMatrix<f64, D, D>) -> Self
Direct construction from a rotation matrix (must be orthogonal, det=+1).
Sourcepub fn rotate_point(&self, point: &Point<D>) -> Point<D>
pub fn rotate_point(&self, point: &Point<D>) -> Point<D>
Rotate a point.
Trait Implementations§
Auto Trait Implementations§
impl<const D: usize> Freeze for Rotor<D>
impl<const D: usize> RefUnwindSafe for Rotor<D>
impl<const D: usize> Send for Rotor<D>
impl<const D: usize> Sync for Rotor<D>
impl<const D: usize> Unpin for Rotor<D>
impl<const D: usize> UnsafeUnpin for Rotor<D>
impl<const D: usize> UnwindSafe for Rotor<D>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.