[][src]Struct cgmath::Euler

#[repr(C)]
pub struct Euler<A> {
    pub x: A,
    pub y: A,
    pub z: A,
}

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

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.

Methods

impl<A> Euler<A>[src]

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

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

impl<A: Eq> Eq for Euler<A>[src]

impl<A: Clone> Clone for Euler<A>[src]

impl<A: PartialEq> PartialEq<Euler<A>> for Euler<A>[src]

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

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

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

impl<S: BaseFloat> From<Quaternion<S>> for Euler<Rad<S>>[src]

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

fn from(src: Euler<A>) -> Basis3<A::Unitless>[src]

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

impl<A: Copy> Copy for Euler<A>[src]

impl<A: Debug> Debug for Euler<A>[src]

impl<A: Angle> AbsDiffEq<Euler<A>> for Euler<A>[src]

type Epsilon = A::Epsilon

Used for specifying relative comparisons.

impl<A: Angle> RelativeEq<Euler<A>> for Euler<A>[src]

impl<A: Angle> UlpsEq<Euler<A>> for Euler<A>[src]

impl<A> Distribution<Euler<A>> for Standard where
    Standard: Distribution<A>,
    A: Angle
[src]

Auto Trait Implementations

impl<A> Send for Euler<A> where
    A: Send

impl<A> Unpin for Euler<A> where
    A: Unpin

impl<A> Sync for Euler<A> where
    A: Sync

impl<A> UnwindSafe for Euler<A> where
    A: UnwindSafe

impl<A> RefUnwindSafe for Euler<A> where
    A: RefUnwindSafe

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]