#[repr(C)]pub struct Basis<T>where
T: Scalar,{
pub x_axis: Vector3<T>,
pub y_axis: Vector3<T>,
pub z_axis: Vector3<T>,
pub center: Vector3<T>,
}
Expand description
A 3D coordinate basis (reference frame).
Represents a local coordinate system with three orthogonal axes and an origin point. This is useful for transformations between different coordinate spaces.
Fields§
§x_axis: Vector3<T>
§y_axis: Vector3<T>
§z_axis: Vector3<T>
§center: Vector3<T>
Implementations§
Source§impl<T> Basis<T>where
T: Scalar,
impl<T> Basis<T>where
T: Scalar,
Sourcepub fn center_mut(&mut self) -> &mut Vector3<T>
pub fn center_mut(&mut self) -> &mut Vector3<T>
Returns a mutable reference to the center.
Sourcepub fn to_mat4(&self) -> Matrix4<T>
pub fn to_mat4(&self) -> Matrix4<T>
Converts the basis to a 4x4 transformation matrix.
The resulting matrix transforms from local basis space to world space:
- Columns 0-2: The basis axes (rotation/scale)
- Column 3: The center point (translation)
Sourcepub fn of_mat4(mat: &Matrix4<T>) -> Basis<T>
pub fn of_mat4(mat: &Matrix4<T>) -> Basis<T>
Creates a basis from a 4x4 transformation matrix.
Extracts the axes from columns 0-2 and center from column 3.
pub fn default() -> Basis<T>
pub fn default_with_center(center: &Vector3<T>) -> Basis<T>
pub fn plane_axis(&self, plane: BasisPlane) -> (&Vector3<T>, &Vector3<T>)
pub fn plane_axis_mut( &mut self, plane: BasisPlane, ) -> (&mut Vector3<T>, &mut Vector3<T>)
Sourcepub fn to_mat3(&self) -> Matrix3<T>
pub fn to_mat3(&self) -> Matrix3<T>
Converts the basis axes to a 3x3 rotation matrix.
The matrix contains only the rotation part, without translation.
Sourcepub fn of_center_mat3(center: &Vector3<T>, m: Matrix3<T>) -> Basis<T>
pub fn of_center_mat3(center: &Vector3<T>, m: Matrix3<T>) -> Basis<T>
Creates a basis from a center point and a 3x3 rotation matrix.
The matrix columns become the basis axes.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Basis<T>where
T: Freeze,
impl<T> RefUnwindSafe for Basis<T>where
T: RefUnwindSafe,
impl<T> Send for Basis<T>where
T: Send,
impl<T> Sync for Basis<T>where
T: Sync,
impl<T> Unpin for Basis<T>where
T: Unpin,
impl<T> UnwindSafe for Basis<T>where
T: UnwindSafe,
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