pub struct DPose2 {
pub rotation: DRot2,
pub translation: DVec2,
}Expand description
A 2D pose (rotation + translation), representing a rigid body transformation (f64 precision).
Fields§
§rotation: DRot2The rotational part of the pose.
translation: DVec2The translational part of the pose.
Implementations§
Source§impl DPose2
impl DPose2
Sourcepub fn from_translation(translation: DVec2) -> Self
pub fn from_translation(translation: DVec2) -> Self
Creates a pose from a translation vector.
Sourcepub fn translation(x: f64, y: f64) -> Self
pub fn translation(x: f64, y: f64) -> Self
Creates a pose from translation components.
Sourcepub fn from_rotation(rotation: DRot2) -> Self
pub fn from_rotation(rotation: DRot2) -> Self
Creates a pose from a rotation.
Sourcepub fn rotation(angle: f64) -> Self
pub fn rotation(angle: f64) -> Self
Creates a pose that is a pure rotation with the given angle (in radians).
Sourcepub fn from_parts(translation: DVec2, rotation: DRot2) -> Self
pub fn from_parts(translation: DVec2, rotation: DRot2) -> Self
Creates a pose from translation and rotation parts.
Sourcepub fn prepend_translation(self, translation: DVec2) -> Self
pub fn prepend_translation(self, translation: DVec2) -> Self
Prepends a translation to this pose (applies translation in local frame).
Sourcepub fn append_translation(self, translation: DVec2) -> Self
pub fn append_translation(self, translation: DVec2) -> Self
Appends a translation to this pose (applies translation in world frame).
Sourcepub fn transform_point(&self, p: DVec2) -> DVec2
pub fn transform_point(&self, p: DVec2) -> DVec2
Transforms a 2D point by this pose.
This applies both the rotation and translation.
Sourcepub fn transform_vector(&self, v: DVec2) -> DVec2
pub fn transform_vector(&self, v: DVec2) -> DVec2
Transforms a 2D vector by this pose.
This applies only the rotation (ignores translation).
Sourcepub fn inverse_transform_point(&self, p: DVec2) -> DVec2
pub fn inverse_transform_point(&self, p: DVec2) -> DVec2
Transforms a point by the inverse of this pose.
Sourcepub fn inverse_transform_vector(&self, v: DVec2) -> DVec2
pub fn inverse_transform_vector(&self, v: DVec2) -> DVec2
Transforms a vector by the inverse of this pose.
Trait Implementations§
Source§impl AbsDiffEq for DPose2
Available on crate feature approx only.
impl AbsDiffEq for DPose2
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<DRot2> for DPose2
impl MulAssign<DRot2> for DPose2
Source§fn mul_assign(&mut self, rhs: DRot2)
fn mul_assign(&mut self, rhs: DRot2)
*= operation. Read moreSource§impl MulAssign for DPose2
impl MulAssign for DPose2
Source§fn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
*= operation. Read moreSource§impl RelativeEq for DPose2
Available on crate feature approx only.
impl RelativeEq for DPose2
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 DPose2
impl StructuralPartialEq for DPose2
Auto Trait Implementations§
impl Freeze for DPose2
impl RefUnwindSafe for DPose2
impl Send for DPose2
impl Sync for DPose2
impl Unpin for DPose2
impl UnwindSafe for DPose2
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.