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:

  1. a 90° rotation around the x axis
  2. a 45° rotation around the y axis
  3. 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§

source§

impl<A> Euler<A>

source

pub const fn new(x: A, y: A, z: A) -> Euler<A>

Construct a set of euler angles.

§Arguments
  • x - The angle to apply around the x axis. Also known at the pitch.
  • y - The angle to apply around the y axis. Also known at the yaw.
  • z - The angle to apply around the z axis. Also known at the roll.

Trait Implementations§

source§

impl<A> AbsDiffEq for Euler<A>
where A: Angle,

source§

type Epsilon = <A as AbsDiffEq>::Epsilon

Used for specifying relative comparisons.
source§

fn default_epsilon() -> <A as AbsDiffEq>::Epsilon

The default tolerance to use when testing values that are close together. Read more
source§

fn abs_diff_eq( &self, other: &Euler<A>, epsilon: <A as AbsDiffEq>::Epsilon, ) -> bool

A test for equality that uses the absolute difference to compute the approximate equality of two numbers.
source§

fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool

The inverse of AbsDiffEq::abs_diff_eq.
source§

impl<A> Clone for Euler<A>
where A: Clone,

source§

fn clone(&self) -> Euler<A>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<A> Debug for Euler<A>
where A: Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

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>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl<A> From<Euler<A>> for Basis3<<A as Angle>::Unitless>
where A: Angle + Into<Rad<<A as Angle>::Unitless>>,

source§

fn from(src: Euler<A>) -> Basis3<<A as Angle>::Unitless>

Create a three-dimensional rotation matrix from a set of euler angles.

source§

impl<A> From<Euler<A>> for Matrix3<<A as Angle>::Unitless>
where A: Angle + Into<Rad<<A as Angle>::Unitless>>,

source§

fn from(src: Euler<A>) -> Matrix3<<A as Angle>::Unitless>

Converts to this type from the input type.
source§

impl<A> From<Euler<A>> for Matrix4<<A as Angle>::Unitless>
where A: Angle + Into<Rad<<A as Angle>::Unitless>>,

source§

fn from(src: Euler<A>) -> Matrix4<<A as Angle>::Unitless>

Converts to this type from the input type.
source§

impl<A> From<Euler<A>> for Quaternion<<A as Angle>::Unitless>
where A: Angle + Into<Rad<<A as Angle>::Unitless>>,

source§

fn from(src: Euler<A>) -> Quaternion<<A as Angle>::Unitless>

Converts to this type from the input type.
source§

impl<S> From<Quaternion<S>> for Euler<Rad<S>>
where S: BaseFloat,

source§

fn from(src: Quaternion<S>) -> Euler<Rad<S>>

Converts to this type from the input type.
source§

impl<A> PartialEq for Euler<A>
where A: PartialEq,

source§

fn eq(&self, other: &Euler<A>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<A> RelativeEq for Euler<A>
where A: Angle,

source§

fn default_max_relative() -> <A as AbsDiffEq>::Epsilon

The default relative tolerance for testing values that are far-apart. Read more
source§

fn relative_eq( &self, other: &Euler<A>, epsilon: <A as AbsDiffEq>::Epsilon, max_relative: <A as AbsDiffEq>::Epsilon, ) -> bool

A test for equality that uses a relative comparison if the values are far apart.
source§

fn relative_ne( &self, other: &Rhs, epsilon: Self::Epsilon, max_relative: Self::Epsilon, ) -> bool

The inverse of RelativeEq::relative_eq.
source§

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,

Serialize this value into the given Serde serializer. Read more
source§

impl<A> UlpsEq for Euler<A>
where A: Angle,

source§

fn default_max_ulps() -> u32

The default ULPs to tolerate when testing values that are far-apart. Read more
source§

fn ulps_eq( &self, other: &Euler<A>, epsilon: <A as AbsDiffEq>::Epsilon, max_ulps: u32, ) -> bool

A test for equality that uses units in the last place (ULP) if the values are far apart.
source§

fn ulps_ne(&self, other: &Rhs, epsilon: Self::Epsilon, max_ulps: u32) -> bool

The inverse of UlpsEq::ulps_eq.
source§

impl<A> Copy for Euler<A>
where A: Copy,

source§

impl<A> Eq for Euler<A>
where A: Eq,

source§

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> Tolerance for T
where T: AbsDiffEq<Epsilon = f64> + Debug,

source§

fn near(&self, other: &Self) -> bool

The “distance” is less than TOLERANCE.
source§

fn near2(&self, other: &Self) -> bool

The “distance” is less than TOLERANCR2.
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,