Struct truck_geometry::base::cgmath::Euler
source · #[repr(C)]pub struct Euler<A> {
pub x: A,
pub y: A,
pub z: A,
}
Expand description
A set of Euler angles representing a rotation in three-dimensional space.
This type is marked as #[repr(C)]
.
The axis rotation sequence is XYZ. That is, the rotation is first around the X axis, then the Y axis, and lastly the Z axis (using intrinsic rotations). Since all three rotation axes are used, the angles are Tait–Bryan angles rather than proper Euler angles.
§Ranges
- x: [-pi, pi]
- y: [-pi/2, pi/2]
- z: [-pi, pi]
§Defining rotations using Euler angles
Note that while Euler angles are intuitive to define, they are prone to
gimbal lock and are challenging to interpolate between. Instead we
recommend that you convert them to a more robust representation, such as a
quaternion or a rotation matrix. To this end, From<Euler<A>>
conversions
are provided for the following types:
For example, to define a quaternion that applies the following:
- a 90° rotation around the x axis
- a 45° rotation around the y axis
- a 15° rotation around the z axis
you can use the following code:
use cgmath::{Deg, Euler, Quaternion};
let rotation = Quaternion::from(Euler {
x: Deg(90.0),
y: Deg(45.0),
z: Deg(15.0),
});
Fields§
§x: A
The angle to apply around the x axis. Also known at the pitch.
y: A
The angle to apply around the y axis. Also known at the yaw.
z: A
The angle to apply around the z axis. Also known at the roll.
Implementations§
Trait Implementations§
source§impl<A> AbsDiffEq for Euler<A>where
A: Angle,
impl<A> AbsDiffEq for Euler<A>where
A: Angle,
source§fn default_epsilon() -> <A as AbsDiffEq>::Epsilon
fn default_epsilon() -> <A as AbsDiffEq>::Epsilon
source§fn abs_diff_eq(
&self,
other: &Euler<A>,
epsilon: <A as AbsDiffEq>::Epsilon,
) -> bool
fn abs_diff_eq( &self, other: &Euler<A>, epsilon: <A 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<'de, A> Deserialize<'de> for Euler<A>where
A: Deserialize<'de>,
impl<'de, A> Deserialize<'de> for Euler<A>where
A: Deserialize<'de>,
source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Euler<A>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Euler<A>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
source§impl<A> RelativeEq for Euler<A>where
A: Angle,
impl<A> RelativeEq for Euler<A>where
A: Angle,
source§fn default_max_relative() -> <A as AbsDiffEq>::Epsilon
fn default_max_relative() -> <A as AbsDiffEq>::Epsilon
source§fn relative_eq(
&self,
other: &Euler<A>,
epsilon: <A as AbsDiffEq>::Epsilon,
max_relative: <A as AbsDiffEq>::Epsilon,
) -> bool
fn relative_eq( &self, other: &Euler<A>, epsilon: <A as AbsDiffEq>::Epsilon, max_relative: <A 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
.source§impl<A> Serialize for Euler<A>where
A: Serialize,
impl<A> Serialize for Euler<A>where
A: Serialize,
source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
source§impl<A> UlpsEq for Euler<A>where
A: Angle,
impl<A> UlpsEq for Euler<A>where
A: Angle,
source§fn default_max_ulps() -> u32
fn default_max_ulps() -> u32
impl<A> Copy for Euler<A>where
A: Copy,
impl<A> Eq for Euler<A>where
A: Eq,
impl<A> StructuralPartialEq for Euler<A>
Auto Trait Implementations§
impl<A> Freeze for Euler<A>where
A: Freeze,
impl<A> RefUnwindSafe for Euler<A>where
A: RefUnwindSafe,
impl<A> Send for Euler<A>where
A: Send,
impl<A> Sync for Euler<A>where
A: Sync,
impl<A> Unpin for Euler<A>where
A: Unpin,
impl<A> UnwindSafe for Euler<A>where
A: UnwindSafe,
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)