Struct nannou::math::Euler[][src]

#[repr(C)]
pub struct Euler<A> where
    A: Angle
{ 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

  • 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

The angle to apply around the x axis. Also known at the pitch.

The angle to apply around the y axis. Also known at the yaw.

The angle to apply around the z axis. Also known at the roll.

Methods

impl<A> Euler<A> where
    A: Angle
[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> Rand for Euler<A> where
    A: Angle + Rand
[src]

Generates a random instance of this type using the specified source of randomness. Read more

impl<A> Clone for Euler<A> where
    A: Angle + Clone
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<A> Debug for Euler<A> where
    A: Angle + Debug
[src]

Formats the value using the given formatter. Read more

impl<'de, A> Deserialize<'de> for Euler<A> where
    A: Angle + Deserialize<'de>, 
[src]

Deserialize this value from the given Serde deserializer. Read more

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

Performs the conversion.

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

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

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

Performs the conversion.

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

Performs the conversion.

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

Performs the conversion.

impl<A> ApproxEq for Euler<A> where
    A: Angle
[src]

Used for specifying relative comparisons.

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

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

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

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

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

The inverse of ApproxEq::relative_eq.

The inverse of ApproxEq::ulps_eq.

impl<A> Serialize for Euler<A> where
    A: Angle + Serialize
[src]

Serialize this value into the given Serde serializer. Read more

impl<A> Copy for Euler<A> where
    A: Angle + Copy
[src]

impl<A> Eq for Euler<A> where
    A: Angle + Eq
[src]

impl<A> PartialEq<Euler<A>> for Euler<A> where
    A: Angle + PartialEq<A>, 
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

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

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