Struct cgmath::Euler [−][src]
#[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
The default tolerance to use when testing values that are close together. Read more
A test for equality that uses the absolute difference to compute the approximate equality of two numbers. Read more
The inverse of AbsDiffEq::abs_diff_eq
.
Performs the conversion.
Performs the conversion.
The default relative tolerance for testing values that are far-apart. Read more
A test for equality that uses a relative comparison if the values are far apart.
The inverse of RelativeEq::relative_eq
.
The default ULPs to tolerate when testing values that are far-apart. Read more
A test for equality that uses units in the last place (ULP) if the values are far apart.
Auto Trait Implementations
impl<A> RefUnwindSafe for Euler<A> where
A: RefUnwindSafe,
impl<A> UnwindSafe for Euler<A> where
A: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more