pub struct Transform(pub Matrix4<f64>);Expand description
A 4x4 homogeneous transform (row-major semantics: p' = M p).
The usual 4x4: the top-left 3x3 rotates (and, for an affine one, scales or
shears), the last column translates, and the fourth row is 0 0 0 1. A
point is carried by multiplying on the left, so a * b applies b first
and then a - the order to keep in mind when composing a chain of
registrations.
Transform(pub Matrix4<f64>) is a named wrapper around one matrix: a
distinct type, so a transform cannot be mistaken for any other 4x4, with
the matrix itself reachable as .0 when nalgebra’s own operations are
wanted. Being Copy means it is duplicated on assignment like a number
rather than moved, which is why transforms are passed around by value
throughout the core.
Tuple Fields§
§0: Matrix4<f64>Implementations§
Source§impl Transform
impl Transform
Sourcepub fn from_rt(r: Matrix3<f64>, t: Vector3<f64>) -> Self
pub fn from_rt(r: Matrix3<f64>, t: Vector3<f64>) -> Self
From a rotation matrix and translation vector.
Sourcepub fn from_row_major(v: &[f64]) -> Result<Self>
pub fn from_row_major(v: &[f64]) -> Result<Self>
From 16 row-major values.
Sourcepub fn to_row_major(&self) -> [f64; 16]
pub fn to_row_major(&self) -> [f64; 16]
The 16 entries in row-major order, the layout of Transform::from_row_major and of a RIEGL .dat matrix.
Sourcepub fn translation(dx: f64, dy: f64, dz: f64) -> Self
pub fn translation(dx: f64, dy: f64, dz: f64) -> Self
A pure translation by (dx, dy, dz) (m).
Sourcepub fn rotation_z(deg: f64) -> Self
pub fn rotation_z(deg: f64) -> Self
Rotation about z by deg degrees.
Sourcepub fn from_roll_pitch_yaw(roll: f64, pitch: f64, yaw: f64) -> Self
pub fn from_roll_pitch_yaw(roll: f64, pitch: f64, yaw: f64) -> Self
RIEGL / RiSCAN convention: Rz(yaw) Ry(pitch) Rx(roll) with angles in degrees.
Sourcepub fn rotation(&self) -> Matrix3<f64>
pub fn rotation(&self) -> Matrix3<f64>
The top-left 3x3 block: the rotation (or, for an affine transform, its linear part).
Sourcepub fn translation_vec(&self) -> Vector3<f64>
pub fn translation_vec(&self) -> Vector3<f64>
The translation in the last column (m).
Sourcepub fn inverse(&self) -> Result<Transform>
pub fn inverse(&self) -> Result<Transform>
The inverse transform, or an Invalid error when the matrix is singular.
Sourcepub fn read_matrix_file(path: impl AsRef<Path>) -> Result<Self>
pub fn read_matrix_file(path: impl AsRef<Path>) -> Result<Self>
Read a whitespace-delimited 4x4 matrix file (RIEGL .dat SOP/POP).
Trait Implementations§
impl Copy for Transform
impl StructuralPartialEq for Transform
Auto Trait Implementations§
impl Forget for Transform
impl Freeze for Transform
impl Move for Transform
impl RefUnwindSafe for Transform
impl Send for Transform
impl Sync for Transform
impl Unpin for Transform
impl UnsafeUnpin for Transform
impl UnwindSafe for Transform
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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,
impl<T> Content for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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 moreSource§impl<Src, Dst> LosslessTryInto<Dst> for Srcwhere
Dst: LosslessTryFrom<Src>,
impl<Src, Dst> LosslessTryInto<Dst> for Srcwhere
Dst: LosslessTryFrom<Src>,
Source§fn lossless_try_into(self) -> Option<Dst>
fn lossless_try_into(self) -> Option<Dst>
Source§impl<Src, Dst> LossyInto<Dst> for Srcwhere
Dst: LossyFrom<Src>,
impl<Src, Dst> LossyInto<Dst> for Srcwhere
Dst: LossyFrom<Src>,
Source§fn lossy_into(self) -> Dst
fn lossy_into(self) -> Dst
Source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
Source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
Source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Source§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
Source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
Source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
impl<T> Scalar for T
Source§impl<T> StrictAs for T
impl<T> StrictAs for T
Source§fn strict_as<Dst>(self) -> Dstwhere
T: StrictCast<Dst>,
fn strict_as<Dst>(self) -> Dstwhere
T: StrictCast<Dst>,
Source§impl<Src, Dst> StrictCastFrom<Src> for Dstwhere
Src: StrictCast<Dst>,
impl<Src, Dst> StrictCastFrom<Src> for Dstwhere
Src: StrictCast<Dst>,
Source§fn strict_cast_from(src: Src) -> Dst
fn strict_cast_from(src: Src) -> Dst
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>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
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
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.