pub struct Rot4(pub Quat, pub Quat);Expand description
A 4D rotation.
Tuple Fields§
§0: Quat§1: QuatImplementations§
Source§impl Rot4
impl Rot4
Sourcepub const fn from_pq(p: Quat, q: Quat) -> Self
pub const fn from_pq(p: Quat, q: Quat) -> Self
Constructs a new rotation from left and right isoclinic rotations represented by quaternions.
Sourcepub fn from_slice(slice: &[f32]) -> Self
pub fn from_slice(slice: &[f32]) -> Self
Mirrors Quat::from_slice.
Sourcepub fn write_to_slice(self, slice: &mut [f32])
pub fn write_to_slice(self, slice: &mut [f32])
Mirrors Quat::write_to_slice
Sourcepub fn from_double_planar_rotation(
a: Vec4,
b: Vec4,
c: Vec4,
d: Vec4,
angle_ab: f32,
angle_cd: f32,
) -> Self
pub fn from_double_planar_rotation( a: Vec4, b: Vec4, c: Vec4, d: Vec4, angle_ab: f32, angle_cd: f32, ) -> Self
Constructs a rotation about two independent planes.
a bforms a plane and will be rotated by an angleangle_ab.c dforms a plane and will be rotated by an angleangle_cd.{a b c d}must be an orthonormal basis for R4.
Sourcepub fn from_axes_angle(axis_1: Vec4, axis_2: Vec4, angle: f32) -> Option<Self>
pub fn from_axes_angle(axis_1: Vec4, axis_2: Vec4, angle: f32) -> Option<Self>
Constructs a rotation about the plane specified by the two axes.
Returns None if the two axes don’t specify a plane (at least one axis is zero, or one is a multiple of the other).
Sourcepub fn from_rotation_arc(from: Vec4, to: Vec4) -> Self
pub fn from_rotation_arc(from: Vec4, to: Vec4) -> Self
Constructs a minimal rotation which rotates from to to.
from and to need not be normalized,
Sourcepub fn from_rotation_matrix(mat: Mat4) -> Self
pub fn from_rotation_matrix(mat: Mat4) -> Self
Factors a rotation matrix into a Rot4.
If mat is not a rotation matrix, the output of this function
is nonsense.
Sourcepub fn is_finite(self) -> bool
pub fn is_finite(self) -> bool
See Quat::is_finite.
Sourcepub fn is_nan(self) -> bool
pub fn is_nan(self) -> bool
See Quat::is_nan.
Sourcepub fn is_normalized(self) -> bool
pub fn is_normalized(self) -> bool
See Quat::is_normalized.
Sourcepub fn is_near_identity(self) -> bool
pub fn is_near_identity(self) -> bool
Sourcepub fn slerp(self, end: Self, s: f32) -> Self
pub fn slerp(self, end: Self, s: f32) -> Self
Performs a smooth interpolation between two Rot4s.
Internally uses Quat::slerp.
Sourcepub fn mul_rot4(self, rhs: Self) -> Self
pub fn mul_rot4(self, rhs: Self) -> Self
Composes this rotation with another.
let a: Rot4;
let b: Rot4;
let composition = a.mul_rot4(b);
let vector: Vec4;
let diff = composition.mul_vec4(vector) - b.mul_vec4(a.mul_vec4(vector));
assert!(diff.length_squared() < f32::EPSILON);Sourcepub fn mul_proj(self, rhs: Projection) -> Projection
pub fn mul_proj(self, rhs: Projection) -> Projection
Rotates a projection.
This internally just rotates all the axes.
It is preferred to rotate this way instead of just rotating the center of projection
and then reconstructing the Projection because that may lead to jumps.
Sourcepub fn from_rotation_xy(angle: f32) -> Self
pub fn from_rotation_xy(angle: f32) -> Self
Creates a rotation in the X-Y plane.
Sourcepub fn from_rotation_xz(angle: f32) -> Self
pub fn from_rotation_xz(angle: f32) -> Self
Creates a rotation in the X-Z plane.
Sourcepub fn from_rotation_xw(angle: f32) -> Self
pub fn from_rotation_xw(angle: f32) -> Self
Creates a rotation in the X-W plane.
Sourcepub fn from_rotation_yz(angle: f32) -> Self
pub fn from_rotation_yz(angle: f32) -> Self
Creates a rotation in the Y-Z plane.
Sourcepub fn from_rotation_yw(angle: f32) -> Self
pub fn from_rotation_yw(angle: f32) -> Self
Creates a rotation in the Y-W plane.
Sourcepub fn from_rotation_zw(angle: f32) -> Self
pub fn from_rotation_zw(angle: f32) -> Self
Creates a rotation in the Z-W plane.