# [−][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

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

- `Basis3`
- `Matrix3`
- `Matrix4`
- `Quaternion`

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]

#### `fn clone(&self) -> Euler<A>`[src]

Returns a copy of the value. Read more

#### `fn clone_from(&mut self, source: &Self)`1.0.0[src]

Performs copy-assignment from `source`. Read more

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

#### `fn eq(&self, other: &Euler<A>) -> bool`[src]

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

#### `fn ne(&self, other: &Euler<A>) -> bool`[src]

This method tests for `!=`.

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

#### `fn from(src: Euler<A>) -> Matrix3<A::Unitless>`[src]

Performs the conversion.

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

#### `fn from(src: Euler<A>) -> Matrix4<A::Unitless>`[src]

Performs the conversion.

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

#### `fn from(src: Euler<A>) -> Quaternion<A::Unitless>`[src]

Performs the conversion.

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

#### `fn from(src: Quaternion<S>) -> Euler<Rad<S>>`[src]

Performs the conversion.

### `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]

#### `fn fmt(&self, f: &mut Formatter) -> Result`[src]

Formats the value using the given formatter. Read more

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

#### `type Epsilon = A::Epsilon`

Used for specifying relative comparisons.

#### `fn default_epsilon() -> A::Epsilon`[src]

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

#### `fn abs_diff_eq(&self, other: &Self, epsilon: A::Epsilon) -> bool`[src]

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

#### `fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool`[src]

The inverse of `ApproxEq::abs_diff_eq`.

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

#### `fn default_max_relative() -> A::Epsilon`[src]

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

#### `fn relative_eq(
&self,
other: &Self,
epsilon: A::Epsilon,
max_relative: A::Epsilon
) -> bool`[src]

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

#### `fn relative_ne(
&self,
other: &Rhs,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool`[src]

The inverse of `ApproxEq::relative_eq`.

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

#### `fn default_max_ulps() -> u32`[src]

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

#### `fn ulps_eq(&self, other: &Self, epsilon: A::Epsilon, max_ulps: u32) -> bool`[src]

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

#### `fn ulps_ne(&self, other: &Rhs, epsilon: Self::Epsilon, max_ulps: u32) -> bool`[src]

The inverse of `ApproxEq::ulps_eq`.

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

#### `fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Euler<A>`[src]

Generate a random value of `T`, using `rng` as the source of randomness.

#### `fn sample_iter<R>(&'a self, rng: &'a mut R) -> DistIter<'a, Self, R, T> where
R: Rng,` [src]

Create an iterator that generates random values of `T`, using `rng` as the source of randomness. Read more

## 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.

#### `fn to_owned(&self) -> T`[src]

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

#### `fn clone_into(&self, target: &mut T)`[src]

🔬 This is a nightly-only experimental API. (`toowned_clone_into`)

recently added

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

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

#### `fn into(self) -> U`[src]

Performs the conversion.

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

#### `fn from(t: T) -> T`[src]

Performs the conversion.

### `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.

#### `fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>`[src]

Performs the conversion.

### `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.

#### `fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>`[src]

Performs the conversion.

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

#### `fn borrow_mut(&mut self) -> &mut T`[src]

Mutably borrows from an owned value. Read more

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

#### `fn borrow(&self) -> &T`[src]

Immutably borrows from an owned value. Read more

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

#### `fn type_id(&self) -> TypeId`[src]

Gets the `TypeId` of `self`. Read more

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g., `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g., `vec -> usize` or `* -> vec`)

Search multiple things at once by splitting your query with comma (e.g., `str,u8` or `String,struct:Vec,test`)