pub struct Pose { /* private fields */ }Expand description
A 3D position and local-frame orientation after evaluating a linkage step.
§Pose and coordinate values
let rotation = Mat3::yaw(FRAC_PI_2) * Mat3::IDENTITY;
let forward = rotation.forward();
let left = rotation.left();
let up = rotation.up();
assert!(forward.is_close_to(&Vec3::from([0.0, 1.0, 0.0]), 1e-5));
assert!(left[0] < 0.0);
assert_eq!(up.into_array(), [0.0, 0.0, 1.0]);
assert!((rotation.as_array()[0][0]).abs() < 1e-5);
let position = Vec3::from([1.0, 2.0, 3.0]);
let offset = (position + Vec3::from([1.0, 0.0, 0.0])) * 2.0;
assert_eq!(offset[0], 4.0);
assert!(offset.distance_to(position) > 0.0);
assert!(offset.is_close_to(&Vec3::from([4.0, 4.0, 6.0]), 1e-5));
let pose = Pose::new(rotation, position);
let start = Pose::start();
let _orientation = pose.orientation();
let _position = pose.position();
let _screen = pose.project(&Projection::front_orthographic(Point::new(0, 0), 10.0));
assert!(!pose.is_close_to(&start, 1e-5));Implementations§
Source§impl Pose
impl Pose
Sourcepub const fn new(orientation: Mat3, position: Vec3) -> Self
pub const fn new(orientation: Mat3, position: Vec3) -> Self
Create a pose from an orientation and position.
See the pose and coordinate example.
Sourcepub fn project(self, projection: &Projection) -> (f32, f32)
pub fn project(self, projection: &Projection) -> (f32, f32)
Project this pose’s position through projection into screen-space (x, y).
See the pose and coordinate example.
Sourcepub const fn start() -> Self
pub const fn start() -> Self
Return the origin pose with identity orientation.
See the pose and coordinate example.
Sourcepub const fn orientation(self) -> Mat3
pub const fn orientation(self) -> Mat3
Return this pose’s orientation matrix.
Sourcepub fn is_close_to(&self, other: &Self, tolerance: f32) -> bool
pub fn is_close_to(&self, other: &Self, tolerance: f32) -> bool
Return true when all orientation and position components are within tolerance.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Pose
impl RefUnwindSafe for Pose
impl Send for Pose
impl Sync for Pose
impl Unpin for Pose
impl UnsafeUnpin for Pose
impl UnwindSafe for Pose
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> 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>,
Casts the value.
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>
Casts the value.
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>,
Casts the value.
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)
Casts the value.
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>,
Casts the value.
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
Casts the value.
Source§impl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
Source§fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
Source§fn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> WrappingAs for T
impl<T> WrappingAs for T
Source§fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
Source§fn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
Casts the value.