pub struct Pose3 {
pub rotation: Quat,
pub translation: Vec3,
}Expand description
A 3D pose (rotation + translation), representing a rigid body transformation (f32 precision).
Fields§
§rotation: QuatThe rotational part of the pose.
translation: Vec3The translational part of the pose.
Implementations§
Source§impl Pose3
impl Pose3
Sourcepub fn from_translation(translation: Vec3) -> Pose3
pub fn from_translation(translation: Vec3) -> Pose3
Creates a pose from a translation vector.
Sourcepub fn translation(x: f32, y: f32, z: f32) -> Pose3
pub fn translation(x: f32, y: f32, z: f32) -> Pose3
Creates a pose from translation components.
Sourcepub fn from_rotation(rotation: Quat) -> Pose3
pub fn from_rotation(rotation: Quat) -> Pose3
Creates a pose from a rotation.
Sourcepub fn from_parts(translation: Vec3, rotation: Quat) -> Pose3
pub fn from_parts(translation: Vec3, rotation: Quat) -> Pose3
Creates a pose from translation and rotation parts.
Sourcepub fn new(translation: Vec3, axisangle: Vec3) -> Pose3
pub fn new(translation: Vec3, axisangle: Vec3) -> Pose3
Creates a pose from translation and axis-angle rotation.
Sourcepub fn rotation(axisangle: Vec3) -> Pose3
pub fn rotation(axisangle: Vec3) -> Pose3
Creates a pose from axis-angle rotation only (no translation).
Sourcepub fn prepend_translation(self, translation: Vec3) -> Pose3
pub fn prepend_translation(self, translation: Vec3) -> Pose3
Prepends a translation to this pose (applies translation in local frame).
Sourcepub fn append_translation(self, translation: Vec3) -> Pose3
pub fn append_translation(self, translation: Vec3) -> Pose3
Appends a translation to this pose (applies translation in world frame).
Sourcepub fn transform_point(&self, p: Vec3) -> Vec3
pub fn transform_point(&self, p: Vec3) -> Vec3
Transforms a 3D point by this pose.
This applies both the rotation and translation.
Sourcepub fn transform_vector(&self, v: Vec3) -> Vec3
pub fn transform_vector(&self, v: Vec3) -> Vec3
Transforms a 3D vector by this pose.
This applies only the rotation (ignores translation).
Sourcepub fn inverse_transform_point(&self, p: Vec3) -> Vec3
pub fn inverse_transform_point(&self, p: Vec3) -> Vec3
Transforms a point by the inverse of this pose.
Sourcepub fn inverse_transform_vector(&self, v: Vec3) -> Vec3
pub fn inverse_transform_vector(&self, v: Vec3) -> Vec3
Transforms a vector by the inverse of this pose.
Sourcepub fn lerp(&self, other: &Pose3, t: f32) -> Pose3
pub fn lerp(&self, other: &Pose3, t: f32) -> Pose3
Linearly interpolates between two poses.
Uses spherical linear interpolation for the rotation part.
Sourcepub fn from_mat4(mat: Mat4) -> Pose3
pub fn from_mat4(mat: Mat4) -> Pose3
Creates a pose from a homogeneous 4x4 matrix.
The matrix is assumed to represent a rigid body transformation (rotation + translation only, no scaling or shearing).
Sourcepub fn look_at_rh(eye: Vec3, target: Vec3, up: Vec3) -> Pose3
pub fn look_at_rh(eye: Vec3, target: Vec3, up: Vec3) -> Pose3
Builds a right-handed look-at view matrix.
It maps the view direction target - eye to the negative z axis to and the eye to the origin. This conforms to the common notion of right-handed camera look-at view matrix from the computer graphics community, i.e. the camera is assumed to look toward its local -z axis.
§Arguments
eye: The eye position.target: The target position.up: A vector approximately aligned with required the vertical axis. The only requirement of this parameter is to not be collinear to target - eye.
Sourcepub fn face_towards(eye: Vec3, target: Vec3, up: Vec3) -> Pose3
pub fn face_towards(eye: Vec3, target: Vec3, up: Vec3) -> Pose3
Creates a pose that corresponds to the local frame of an observer standing at the point eye and looking toward target.
It maps the z axis to the view direction target - eye and the origin to the eye.
§Arguments
eye: The observer position.target: The target position.up: Vertical direction. The only requirement of this parameter is to not be collinear to eye - at. Non-collinearity is not checked.
Trait Implementations§
Source§impl AbsDiffEq for Pose3
impl AbsDiffEq for Pose3
Source§fn default_epsilon() -> <Pose3 as AbsDiffEq>::Epsilon
fn default_epsilon() -> <Pose3 as AbsDiffEq>::Epsilon
Source§fn abs_diff_eq(
&self,
other: &Pose3,
epsilon: <Pose3 as AbsDiffEq>::Epsilon,
) -> bool
fn abs_diff_eq( &self, other: &Pose3, epsilon: <Pose3 as AbsDiffEq>::Epsilon, ) -> bool
Source§fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
AbsDiffEq::abs_diff_eq.Source§impl MulAssign<Quat> for Pose3
impl MulAssign<Quat> for Pose3
Source§fn mul_assign(&mut self, rhs: Quat)
fn mul_assign(&mut self, rhs: Quat)
*= operation. Read moreSource§impl MulAssign for Pose3
impl MulAssign for Pose3
Source§fn mul_assign(&mut self, rhs: Pose3)
fn mul_assign(&mut self, rhs: Pose3)
*= operation. Read moreSource§impl RelativeEq for Pose3
impl RelativeEq for Pose3
Source§fn default_max_relative() -> <Pose3 as AbsDiffEq>::Epsilon
fn default_max_relative() -> <Pose3 as AbsDiffEq>::Epsilon
Source§fn relative_eq(
&self,
other: &Pose3,
epsilon: <Pose3 as AbsDiffEq>::Epsilon,
max_relative: <Pose3 as AbsDiffEq>::Epsilon,
) -> bool
fn relative_eq( &self, other: &Pose3, epsilon: <Pose3 as AbsDiffEq>::Epsilon, max_relative: <Pose3 as AbsDiffEq>::Epsilon, ) -> bool
Source§fn relative_ne(
&self,
other: &Rhs,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon,
) -> bool
fn relative_ne( &self, other: &Rhs, epsilon: Self::Epsilon, max_relative: Self::Epsilon, ) -> bool
RelativeEq::relative_eq.impl Copy for Pose3
impl StructuralPartialEq for Pose3
Auto Trait Implementations§
impl Freeze for Pose3
impl RefUnwindSafe for Pose3
impl Send for Pose3
impl Sync for Pose3
impl Unpin for Pose3
impl UnwindSafe for Pose3
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
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<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.