pub struct Transform3D { /* private fields */ }Expand description
Gimbal-lock-free 3D world-space transform backed by a unit Hamilton quaternion (position, rotation, scale).
Implementations§
Source§impl Transform3D
Quaternion-backed matrix, Euler compatibility, SLERP interpolation, and point transformation helpers for Transform3D.
impl Transform3D
Quaternion-backed matrix, Euler compatibility, SLERP interpolation, and point transformation helpers for Transform3D.
Sourcepub fn from_matrix(matrix: Mat4) -> Self
pub fn from_matrix(matrix: Mat4) -> Self
Sourcepub fn with_rotation(self, rotation: Quat) -> Self
pub fn with_rotation(self, rotation: Quat) -> Self
Sourcepub fn with_euler(self, yaw_rad: f32, pitch_rad: f32, roll_rad: f32) -> Self
pub fn with_euler(self, yaw_rad: f32, pitch_rad: f32, roll_rad: f32) -> Self
Sourcepub fn euler_yxz(&self) -> (f32, f32, f32)
pub fn euler_yxz(&self) -> (f32, f32, f32)
Extracts (yaw_rad, pitch_rad, roll_rad) Euler angles matching Ry(yaw) * Rx(pitch) * Rz(roll) from this transform’s quaternion.
§Returns
(f32, f32, f32)- Extracted(yaw_rad, pitch_rad, roll_rad)in radians.
Sourcepub fn get_yaw_rad(&self) -> f32
pub fn get_yaw_rad(&self) -> f32
Returns the horizontal Y-axis yaw angle extracted from this transform’s quaternion.
§Returns
f32- Yaw angle in radians.
Sourcepub fn get_pitch_rad(&self) -> f32
pub fn get_pitch_rad(&self) -> f32
Returns the vertical X-axis pitch angle extracted from this transform’s quaternion.
§Returns
f32- Pitch angle in radians.
Sourcepub fn get_roll_rad(&self) -> f32
pub fn get_roll_rad(&self) -> f32
Returns the longitudinal Z-axis roll angle extracted from this transform’s quaternion.
§Returns
f32- Roll angle in radians.
Sourcepub fn set_yaw_rad(&mut self, yaw_rad: f32)
pub fn set_yaw_rad(&mut self, yaw_rad: f32)
Updates horizontal Y-axis yaw while preserving current pitch and roll angles.
§Arguments
&Self- Mutable transform.f32- New Y-axis yaw angle in radians.
Sourcepub fn set_pitch_rad(&mut self, pitch_rad: f32)
pub fn set_pitch_rad(&mut self, pitch_rad: f32)
Updates vertical X-axis pitch while preserving current yaw and roll angles.
§Arguments
&Self- Mutable transform.f32- New X-axis pitch angle in radians.
Sourcepub fn set_roll_rad(&mut self, roll_rad: f32)
pub fn set_roll_rad(&mut self, roll_rad: f32)
Updates longitudinal Z-axis roll while preserving current yaw and pitch angles.
§Arguments
&Self- Mutable transform.f32- New Z-axis roll angle in radians.
Sourcepub fn lerp_shortest_angle(self, other: Self, blend_factor: f32) -> Self
pub fn lerp_shortest_angle(self, other: Self, blend_factor: f32) -> Self
Interpolates position, scale, and shortest-arc quaternion rotation (SLERP) between self and other for render-time snapshot blending.
§Arguments
Self- Previous fixed-step transform.Self- Current fixed-step transform.f32- Normalized interpolation factor in[0.0, 1.0].
§Returns
Self- Shortest-arc SLERP interpolated transform.
Sourcepub fn to_inv_mat4(&self) -> Mat4
pub fn to_inv_mat4(&self) -> Mat4
Sourcepub fn normal_mat3(&self) -> [Vec3; 3]
pub fn normal_mat3(&self) -> [Vec3; 3]
Sourcepub fn transform_point(&self, vec_value: Vec3) -> Vec3
pub fn transform_point(&self, vec_value: Vec3) -> Vec3
Sourcepub fn transform_normal(&self, vec_value: Vec3) -> Vec3
pub fn transform_normal(&self, vec_value: Vec3) -> Vec3
Sourcepub fn transform_bounds(&self, local: AxisAlignedBox3D) -> AxisAlignedBox3D
pub fn transform_bounds(&self, local: AxisAlignedBox3D) -> AxisAlignedBox3D
Transforms a local AxisAlignedBox3D into an enclosing world-space AxisAlignedBox3D using Arvo’s 18-multiply method (zero 8-corner loop, zero per-corner trigonometry).
§Arguments
&Self- Transform reference.AxisAlignedBox3D- Local bounding box.
§Returns
AxisAlignedBox3D- Enclosing world-space bounding box.
Sourcepub fn to_oriented_box(&self, local: AxisAlignedBox3D) -> OrientedBox3D
pub fn to_oriented_box(&self, local: AxisAlignedBox3D) -> OrientedBox3D
Converts a local-space AxisAlignedBox3D into a tight world-space oriented bounding box (OrientedBox3D) preserving rotation and non-uniform scale without axis-aligned bounding box corner inflation.
§Arguments
&Self- Transform reference.AxisAlignedBox3D- Local-space bounding box.
§Returns
OrientedBox3D- Oriented bounding box in world space.
Source§impl Transform3D
Implements impl #impl_generics #name #ty_generics #where_clause.
impl Transform3D
Implements impl #impl_generics #name #ty_generics #where_clause.
pub fn get_position(&self) -> Vec3
pub fn get_mut_position(&mut self) -> &mut Vec3
pub fn set_position(&mut self, val: Vec3) -> &mut Self
pub fn get_rotation(&self) -> Quat
pub fn get_mut_rotation(&mut self) -> &mut Quat
pub fn set_rotation(&mut self, val: Quat) -> &mut Self
pub fn get_scale(&self) -> Vec3
pub fn get_mut_scale(&mut self) -> &mut Vec3
pub fn set_scale(&mut self, val: Vec3) -> &mut Self
Trait Implementations§
Source§impl Clone for Transform3D
impl Clone for Transform3D
impl Copy for Transform3D
Source§impl Debug for Transform3D
impl Debug for Transform3D
Source§impl Default for Transform3D
Default identity Transform3D.
impl Default for Transform3D
Default identity Transform3D.