pub struct Rotation3<S>(/* private fields */)
where
S: Ring + MaybeSerDes;
Expand description
Orthogonal 3x3 matrix with determinant +1, i.e. a member of the 3D rotation group $SO(3)$ of special orthogonal matrices
Implementations§
Source§impl<S> Rotation3<S>where
S: Ring + MaybeSerDes,
impl<S> Rotation3<S>where
S: Ring + MaybeSerDes,
Sourcepub fn from_angle_x(angle: Rad<S>) -> Selfwhere
S: Real,
pub fn from_angle_x(angle: Rad<S>) -> Selfwhere
S: Real,
Construct a rotation around the X axis.
Positive angles are counter-clockwise.
Sourcepub fn from_angle_y(angle: Rad<S>) -> Selfwhere
S: Real,
pub fn from_angle_y(angle: Rad<S>) -> Selfwhere
S: Real,
Construct a rotation around the Y axis
Positive angles are counter-clockwise.
Sourcepub fn from_angle_z(angle: Rad<S>) -> Selfwhere
S: Real,
pub fn from_angle_z(angle: Rad<S>) -> Selfwhere
S: Real,
Construct a rotation around the Z axis
Positive angles are counter-clockwise.
Sourcepub fn from_angles_intrinsic(yaw: Rad<S>, pitch: Rad<S>, roll: Rad<S>) -> Selfwhere
S: Real,
pub fn from_angles_intrinsic(yaw: Rad<S>, pitch: Rad<S>, roll: Rad<S>) -> Selfwhere
S: Real,
Construct a rotation from intrinsic ZX’Y’’ Euler angles:
- yaw: rotation around Z axis
- pitch: rotation around X’ axis
- roll: rotation around Y’’ axis
Sourcepub fn from_axis_angle(axis: Vector3<S>, angle: Rad<S>) -> Selfwhere
S: Real,
pub fn from_axis_angle(axis: Vector3<S>, angle: Rad<S>) -> Selfwhere
S: Real,
Construct a rotation around the given axis vector with the given angle
Sourcepub fn orthonormalize(
v1: Vector3<S>,
v2: Vector3<S>,
v3: Vector3<S>,
) -> Option<Self>
pub fn orthonormalize( v1: Vector3<S>, v2: Vector3<S>, v3: Vector3<S>, ) -> Option<Self>
Construct an orthonormal matrix from a set of linearly-independent vectors using the Gram-Schmidt process
Sourcepub fn look_at(point: Point3<S>) -> Self
pub fn look_at(point: Point3<S>) -> Self
Returns a rotation with zero roll and oriented towards the target point.
Returns the identity rotation if point
is the origin.
Sourcepub fn new(mat: Matrix3<S>) -> Option<Self>
pub fn new(mat: Matrix3<S>) -> Option<Self>
Returns None
if called with a matrix that is not orthonormal with
determinant +1.
This method checks whether mat * mat^T == I
and
mat.determinant() == 1
.
Sourcepub fn new_approx(mat: Matrix3<S>) -> Option<Self>where
S: RelativeEq<Epsilon = S>,
pub fn new_approx(mat: Matrix3<S>) -> Option<Self>where
S: RelativeEq<Epsilon = S>,
Returns None
if called with a matrix that is not orthonormal with
determinant +1.
This method checks whether mat * mat^T == I
and
mat.determinant() == 1
(approximately using relative equality).
Sourcepub fn noisy(mat: Matrix3<S>) -> Self
pub fn noisy(mat: Matrix3<S>) -> Self
Panic if the given matrix is not orthogonal with determinant +1.
This method checks whether mat * mat^T == I
and
mat.determinant() == 1
.
Sourcepub fn noisy_approx(mat: Matrix3<S>) -> Selfwhere
S: RelativeEq<Epsilon = S> + Debug,
pub fn noisy_approx(mat: Matrix3<S>) -> Selfwhere
S: RelativeEq<Epsilon = S> + Debug,
Panic if the given matrix is not orthogonal with determinant +1.
This method checks whether mat * mat^T == I
and
mat.determinant() == 1
(approximately using relative equality).
Sourcepub fn unchecked(mat: Matrix3<S>) -> Selfwhere
S: Debug,
pub fn unchecked(mat: Matrix3<S>) -> Selfwhere
S: Debug,
It is a debug panic if the given matrix is not orthogonal with determinant +1.
This method checks whether mat * mat^T == I
and
mat.determinant() == 1
.
Sourcepub fn unchecked_approx(mat: Matrix3<S>) -> Selfwhere
S: RelativeEq<Epsilon = S> + Debug,
pub fn unchecked_approx(mat: Matrix3<S>) -> Selfwhere
S: RelativeEq<Epsilon = S> + Debug,
It is a debug panic if the given matrix is not orthogonal with determinant +1.
This method checks whether mat * mat^T == I
and
mat.determinant() == 1
(approximately using relative equality).
Sourcepub fn intrinsic_angles(&self) -> (Rad<S>, Rad<S>, Rad<S>)where
S: Real,
pub fn intrinsic_angles(&self) -> (Rad<S>, Rad<S>, Rad<S>)where
S: Real,
Return intrinsic yaw (Z), pitch (X’), roll (Y’’) angles.
NOTE: this function returns the raw output of the atan2
operations used
to compute the angles. This function returns values in the range
[-\pi, \pi]
.
Methods from Deref<Target = Matrix3<S>>§
pub const ROW_COUNT: usize = 3usize
pub const COL_COUNT: usize = 3usize
Sourcepub fn is_packed(&self) -> bool
pub fn is_packed(&self) -> bool
Are all elements of this matrix tightly packed together in memory ?
This might not be the case for matrices in the repr_simd
module
(it depends on the target architecture).
Sourcepub fn as_col_ptr(&self) -> *const T
pub fn as_col_ptr(&self) -> *const T
Gets a const pointer to this matrix’s elements.
§Panics
Panics if the matrix’s elements are not tightly packed in memory,
which may be the case for matrices in the repr_simd
module.
You may check this with the is_packed()
method.
Sourcepub fn as_col_slice(&self) -> &[T]
pub fn as_col_slice(&self) -> &[T]
View this matrix as an immutable slice.
§Panics
Panics if the matrix’s elements are not tightly packed in memory,
which may be the case for matrices in the repr_simd
module.
You may check this with the is_packed()
method.
pub const GL_SHOULD_TRANSPOSE: bool = false
Sourcepub fn gl_should_transpose(&self) -> bool
pub fn gl_should_transpose(&self) -> bool
Gets the transpose
parameter to pass to OpenGL glUniformMatrix*()
functions.
The return value is a plain bool
which you may directly cast
to a GLboolean
.
This takes &self
to prevent surprises when changing the type
of matrix you plan to send.
Trait Implementations§
Source§impl<S> DivAssign for Rotation3<S>where
S: Ring + MaybeSerDes,
impl<S> DivAssign for Rotation3<S>where
S: Ring + MaybeSerDes,
Source§fn div_assign(&mut self, rhs: Self)
fn div_assign(&mut self, rhs: Self)
/=
operation. Read moreSource§impl<S> MulAssign for Rotation3<S>where
S: Ring + MaybeSerDes,
impl<S> MulAssign for Rotation3<S>where
S: Ring + MaybeSerDes,
Source§fn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
*=
operation. Read moreimpl<S> Copy for Rotation3<S>
impl<S> MultiplicativeGroup for Rotation3<S>where
S: Ring + MaybeSerDes,
impl<S> MultiplicativeMonoid for Rotation3<S>where
S: Ring + MaybeSerDes,
impl<S> StructuralPartialEq for Rotation3<S>where
S: Ring + MaybeSerDes,
Auto Trait Implementations§
impl<S> Freeze for Rotation3<S>where
S: Freeze,
impl<S> RefUnwindSafe for Rotation3<S>where
S: RefUnwindSafe,
impl<S> Send for Rotation3<S>where
S: Send,
impl<S> Sync for Rotation3<S>where
S: Sync,
impl<S> Unpin for Rotation3<S>where
S: Unpin,
impl<S> UnwindSafe for Rotation3<S>where
S: 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
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more