pub struct Transform3D {
pub position: [f64; 3],
pub rotation: [f64; 4],
pub scale: f64,
}Expand description
A 3-D transform stored as position + quaternion (xyzw) + uniform scale,
using plain arrays to avoid nalgebra dependencies outside oxiphysics-core.
Fields§
§position: [f64; 3]Translation (world-space position).
rotation: [f64; 4]Rotation quaternion stored as [x, y, z, w] (unit quaternion).
scale: f64Uniform scale factor.
Implementations§
Source§impl Transform3D
impl Transform3D
Sourcepub fn identity() -> Self
pub fn identity() -> Self
Create an identity transform (no translation, no rotation, scale = 1).
Sourcepub fn from_position(position: [f64; 3]) -> Self
pub fn from_position(position: [f64; 3]) -> Self
Create a transform with position only (identity rotation, scale = 1).
Sourcepub fn apply(&self, point: [f64; 3]) -> [f64; 3]
pub fn apply(&self, point: [f64; 3]) -> [f64; 3]
Apply the transform to a point: scale * rotate(point) + position.
Sourcepub fn inverse(&self) -> Self
pub fn inverse(&self) -> Self
Compute the inverse transform.
For a transform T = (p, q, s), the inverse is (-q^-1(p)/s, q^-1, 1/s).
Sourcepub fn compose(&self, other: &Transform3D) -> Self
pub fn compose(&self, other: &Transform3D) -> Self
Compose this transform with other (self applied after other):
result = self ∘ other.
Trait Implementations§
Source§impl Clone for Transform3D
impl Clone for Transform3D
Source§fn clone(&self) -> Transform3D
fn clone(&self) -> Transform3D
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Transform3D
impl Debug for Transform3D
Auto Trait Implementations§
impl Freeze for Transform3D
impl RefUnwindSafe for Transform3D
impl Send for Transform3D
impl Sync for Transform3D
impl Unpin for Transform3D
impl UnsafeUnpin for Transform3D
impl UnwindSafe for Transform3D
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.