pub struct Isometry { /* private fields */ }Expand description
A rigid motion: a rotation followed by a translation, p ↦ R p + t.
Lengths and angles are preserved, so a Frame moved by one is still a
frame and geometry moved by one is the same geometry in another place
(docs/DATA-MODEL.md §Conventions: a transform is a frame change).
use arris_math::{Isometry, Point3, Vec3, nalgebra::UnitQuaternion};
use core::f64::consts::FRAC_PI_2;
let quarter_turn = UnitQuaternion::from_axis_angle(&Vec3::z_axis(), FRAC_PI_2);
let m = Isometry::new(quarter_turn, Vec3::new(1.0, 0.0, 0.0));
let p = m.apply(Point3::new(1.0, 0.0, 0.0));
assert!((p - Point3::new(1.0, 1.0, 0.0)).norm() < 1e-15);
let back = m.inverse().apply(p);
assert!((back - Point3::new(1.0, 0.0, 0.0)).norm() < 1e-15);Implementations§
Source§impl Isometry
impl Isometry
Sourcepub fn new(rotation: UnitQuaternion<f64>, translation: Vec3) -> Self
pub fn new(rotation: UnitQuaternion<f64>, translation: Vec3) -> Self
p ↦ rotation · p + translation.
Sourcepub fn from_translation(v: Vec3) -> Self
pub fn from_translation(v: Vec3) -> Self
A pure translation by v.
Sourcepub fn from_rotation(rotation: UnitQuaternion<f64>) -> Self
pub fn from_rotation(rotation: UnitQuaternion<f64>) -> Self
A pure rotation about the origin.
Sourcepub fn rotation(&self) -> UnitQuaternion<f64>
pub fn rotation(&self) -> UnitQuaternion<f64>
The rotation part.
Sourcepub fn translation(&self) -> Vec3
pub fn translation(&self) -> Vec3
The translation part: where the origin goes.
Sourcepub fn apply_vec(&self, v: Vec3) -> Vec3
pub fn apply_vec(&self, v: Vec3) -> Vec3
R v: a vector is a difference of points, so the translation does
not act on it.
Sourcepub fn apply_unit(&self, u: UnitVec3) -> UnitVec3
pub fn apply_unit(&self, u: UnitVec3) -> UnitVec3
R u, re-normalised so the result is unit to rounding.
Sourcepub fn apply_frame(&self, frame: &Frame) -> Frame
pub fn apply_frame(&self, frame: &Frame) -> Frame
The frame moved by this motion; the same as
Frame::transformed.
Trait Implementations§
impl Copy for Isometry
impl StructuralPartialEq for Isometry
Auto Trait Implementations§
impl Freeze for Isometry
impl RefUnwindSafe for Isometry
impl Send for Isometry
impl Sync for Isometry
impl Unpin for Isometry
impl UnsafeUnpin for Isometry
impl UnwindSafe for Isometry
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> Scalar for T
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>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
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
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.