pub struct LocalTransform {
pub translation: [f64; 3],
pub rot: [[f64; 3]; 3],
}Expand description
A 3-D rigid transform: translation + 3×3 rotation matrix (row-major).
The rotation rot[i] is the i-th row of the rotation matrix.
The matrix must be orthonormal; no validation is performed.
Fields§
§translation: [f64; 3]Translation vector.
rot: [[f64; 3]; 3]Rotation matrix stored row-major: rot[row][col].
Implementations§
Source§impl LocalTransform
impl LocalTransform
Sourcepub fn from_translation(t: [f64; 3]) -> Self
pub fn from_translation(t: [f64; 3]) -> Self
Pure translation (no rotation).
Sourcepub fn local_to_world(&self, p: [f64; 3]) -> [f64; 3]
pub fn local_to_world(&self, p: [f64; 3]) -> [f64; 3]
Transform a point from local space to world space.
world_p = rot * local_p + translation
Sourcepub fn world_to_local(&self, p: [f64; 3]) -> [f64; 3]
pub fn world_to_local(&self, p: [f64; 3]) -> [f64; 3]
Transform a point from world space to local space.
local_p = rot^T * (world_p - translation)
Trait Implementations§
Source§impl Clone for LocalTransform
impl Clone for LocalTransform
Source§fn clone(&self) -> LocalTransform
fn clone(&self) -> LocalTransform
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for LocalTransform
impl RefUnwindSafe for LocalTransform
impl Send for LocalTransform
impl Sync for LocalTransform
impl Unpin for LocalTransform
impl UnsafeUnpin for LocalTransform
impl UnwindSafe for LocalTransform
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
Mutably borrows from an owned value. Read more
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>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
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
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.