[−][src]Struct nannou::math::Euler
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.
Methods
impl<A> Euler<A> where
A: Angle,
[src]
A: Angle,
pub 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> Copy for Euler<A> where
A: Angle + Copy,
[src]
A: Angle + Copy,
impl<A> Serialize for Euler<A> where
A: Angle + Serialize,
[src]
A: Angle + Serialize,
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
[src]
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
impl<A> Eq for Euler<A> where
A: Angle + Eq,
[src]
A: Angle + Eq,
impl<'de, A> Deserialize<'de> for Euler<A> where
A: Angle + Deserialize<'de>,
[src]
A: Angle + Deserialize<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<Euler<A>, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
[src]
__deserializer: __D
) -> Result<Euler<A>, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
impl<A> Rand for Euler<A> where
A: Angle + Rand,
[src]
A: Angle + Rand,
impl<A> Debug for Euler<A> where
A: Angle + Debug,
[src]
A: Angle + Debug,
impl<A> PartialEq<Euler<A>> for Euler<A> where
A: Angle + PartialEq<A>,
[src]
A: Angle + PartialEq<A>,
impl<A> ApproxEq for Euler<A> where
A: Angle,
[src]
A: Angle,
type Epsilon = <A as ApproxEq>::Epsilon
Used for specifying relative comparisons.
fn default_epsilon() -> <A as ApproxEq>::Epsilon
[src]
fn default_max_relative() -> <A as ApproxEq>::Epsilon
[src]
fn default_max_ulps() -> u32
[src]
fn relative_eq(
&self,
other: &Euler<A>,
epsilon: <A as ApproxEq>::Epsilon,
max_relative: <A as ApproxEq>::Epsilon
) -> bool
[src]
&self,
other: &Euler<A>,
epsilon: <A as ApproxEq>::Epsilon,
max_relative: <A as ApproxEq>::Epsilon
) -> bool
fn ulps_eq(
&self,
other: &Euler<A>,
epsilon: <A as ApproxEq>::Epsilon,
max_ulps: u32
) -> bool
[src]
&self,
other: &Euler<A>,
epsilon: <A as ApproxEq>::Epsilon,
max_ulps: u32
) -> bool
fn relative_ne(
&self,
other: &Self,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
[src]
&self,
other: &Self,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
fn ulps_ne(&self, other: &Self, epsilon: Self::Epsilon, max_ulps: u32) -> bool
[src]
impl<A> Clone for Euler<A> where
A: Angle + Clone,
[src]
A: Angle + Clone,
impl<A> From<Euler<A>> for Matrix4<<A as Angle>::Unitless> where
A: Angle + Into<Rad<<A as Angle>::Unitless>>,
[src]
A: Angle + Into<Rad<<A as Angle>::Unitless>>,
impl<S> From<Quaternion<S>> for Euler<Rad<S>> where
S: BaseFloat,
[src]
S: BaseFloat,
fn from(src: Quaternion<S>) -> Euler<Rad<S>>
[src]
impl<A> From<Euler<A>> for Basis3<<A as Angle>::Unitless> where
A: Angle + Into<Rad<<A as Angle>::Unitless>>,
[src]
A: Angle + Into<Rad<<A as Angle>::Unitless>>,
fn from(src: Euler<A>) -> Basis3<<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]
A: Angle + Into<Rad<<A as Angle>::Unitless>>,
impl<A> From<Euler<A>> for Matrix3<<A as Angle>::Unitless> where
A: Angle + Into<Rad<<A as Angle>::Unitless>>,
[src]
A: Angle + Into<Rad<<A as Angle>::Unitless>>,
Auto Trait Implementations
impl<A> Send for Euler<A> where
A: Send,
A: Send,
impl<A> Unpin for Euler<A> where
A: Unpin,
A: Unpin,
impl<A> Sync for Euler<A> where
A: Sync,
A: Sync,
impl<A> UnwindSafe for Euler<A> where
A: UnwindSafe,
A: UnwindSafe,
impl<A> RefUnwindSafe for Euler<A> where
A: RefUnwindSafe,
A: RefUnwindSafe,
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
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]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
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]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Style for T where
T: Any + Debug + PartialEq<T>,
[src]
T: Any + Debug + PartialEq<T>,
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<T> Content for T
[src]
fn ref_from_ptr(ptr: *mut c_void, size: usize) -> Option<*mut T>
[src]
fn is_size_suitable(size: usize) -> bool
[src]
fn indiv_size() -> usize
[src]
impl<T> SafeBorrow<T> for T
[src]
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
D: AdaptFrom<S, Swp, Dwp, T>,
Dwp: WhitePoint,
Swp: WhitePoint,
T: Component + Float,
[src]
D: AdaptFrom<S, Swp, Dwp, T>,
Dwp: WhitePoint,
Swp: WhitePoint,
T: Component + Float,
fn adapt_into_using<M>(self, method: M) -> D where
M: TransformMatrix<Swp, Dwp, T>,
[src]
M: TransformMatrix<Swp, Dwp, T>,
fn adapt_into(self) -> D
[src]
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,