pub struct Pose3 {
pub rotation: Rot3,
pub translation: Vec3,
}Expand description
A 3D pose (rotation + translation), representing a rigid body transformation (f32 precision).
Fields§
§rotation: Rot3The rotational part of the pose.
translation: Vec3The translational part of the pose.
Implementations§
Source§impl Pose3
impl Pose3
Sourcepub fn from_translation(translation: Vec3) -> Self
pub fn from_translation(translation: Vec3) -> Self
Creates a pose from a translation vector.
Sourcepub fn translation(x: f32, y: f32, z: f32) -> Self
pub fn translation(x: f32, y: f32, z: f32) -> Self
Creates a pose from translation components.
Sourcepub fn from_rotation(rotation: Rot3) -> Self
pub fn from_rotation(rotation: Rot3) -> Self
Creates a pose from a rotation.
Sourcepub fn from_parts(translation: Vec3, rotation: Rot3) -> Self
pub fn from_parts(translation: Vec3, rotation: Rot3) -> Self
Creates a pose from translation and rotation parts.
Sourcepub fn new(translation: Vec3, axisangle: Vec3) -> Self
pub fn new(translation: Vec3, axisangle: Vec3) -> Self
Creates a pose from translation and axis-angle rotation.
Sourcepub fn rotation(axisangle: Vec3) -> Self
pub fn rotation(axisangle: Vec3) -> Self
Creates a pose from axis-angle rotation only (no translation).
Sourcepub fn prepend_translation(self, translation: Vec3) -> Self
pub fn prepend_translation(self, translation: Vec3) -> Self
Prepends a translation to this pose (applies translation in local frame).
Sourcepub fn append_translation(self, translation: Vec3) -> Self
pub fn append_translation(self, translation: Vec3) -> Self
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: &Self, t: f32) -> Self
pub fn lerp(&self, other: &Self, t: f32) -> Self
Linearly interpolates between two poses.
Uses spherical linear interpolation for the rotation part.
Sourcepub fn from_mat4(mat: Mat4) -> Self
pub fn from_mat4(mat: Mat4) -> Self
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
Available on crate feature approx only.
impl AbsDiffEq for Pose3
approx only.Source§fn default_epsilon() -> Self::Epsilon
fn default_epsilon() -> Self::Epsilon
Source§fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool
fn abs_diff_eq(&self, other: &Self, epsilon: Self::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: Rot3)
fn mul_assign(&mut self, rhs: Rot3)
*= operation. Read moreSource§impl MulAssign for Pose3
impl MulAssign for Pose3
Source§fn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
*= operation. Read moreSource§impl RelativeEq for Pose3
Available on crate feature approx only.
impl RelativeEq for Pose3
approx only.Source§fn default_max_relative() -> Self::Epsilon
fn default_max_relative() -> Self::Epsilon
Source§fn relative_eq(
&self,
other: &Self,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon,
) -> bool
fn relative_eq( &self, other: &Self, epsilon: Self::Epsilon, max_relative: Self::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, 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<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.