Struct nannou::math::Euler [−][src]
#[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:
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
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> AbsDiffEq<Euler<A>> for Euler<A> where
A: Angle,
[src]
A: Angle,
type Epsilon = <A as AbsDiffEq<A>>::Epsilon
Used for specifying relative comparisons.
pub fn default_epsilon() -> <A as AbsDiffEq<A>>::Epsilon
[src]
pub fn abs_diff_eq(
&self,
other: &Euler<A>,
epsilon: <A as AbsDiffEq<A>>::Epsilon
) -> bool
[src]
&self,
other: &Euler<A>,
epsilon: <A as AbsDiffEq<A>>::Epsilon
) -> bool
pub fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
impl<A> Clone for Euler<A> where
A: Clone,
[src]
A: Clone,
impl<A> Copy for Euler<A> where
A: Copy,
[src]
A: Copy,
impl<A> Debug for Euler<A> where
A: Debug,
[src]
A: Debug,
impl<'de, A> Deserialize<'de> for Euler<A> where
A: Deserialize<'de>,
[src]
A: Deserialize<'de>,
pub 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> Eq for Euler<A> where
A: Eq,
[src]
A: Eq,
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>>,
pub 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 Matrix4<<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>>,
impl<S> From<Quaternion<S>> for Euler<Rad<S>> where
S: BaseFloat,
[src]
S: BaseFloat,
pub fn from(src: Quaternion<S>) -> Euler<Rad<S>>
[src]
impl<A> PartialEq<Euler<A>> for Euler<A> where
A: PartialEq<A>,
[src]
A: PartialEq<A>,
impl<A> RelativeEq<Euler<A>> for Euler<A> where
A: Angle,
[src]
A: Angle,
pub fn default_max_relative() -> <A as AbsDiffEq<A>>::Epsilon
[src]
pub fn relative_eq(
&self,
other: &Euler<A>,
epsilon: <A as AbsDiffEq<A>>::Epsilon,
max_relative: <A as AbsDiffEq<A>>::Epsilon
) -> bool
[src]
&self,
other: &Euler<A>,
epsilon: <A as AbsDiffEq<A>>::Epsilon,
max_relative: <A as AbsDiffEq<A>>::Epsilon
) -> bool
pub fn relative_ne(
&self,
other: &Rhs,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
&self,
other: &Rhs,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
impl<A> Serialize for Euler<A> where
A: Serialize,
[src]
A: Serialize,
pub 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> StructuralEq for Euler<A>
[src]
impl<A> StructuralPartialEq for Euler<A>
[src]
impl<A> UlpsEq<Euler<A>> for Euler<A> where
A: Angle,
[src]
A: Angle,
Auto Trait Implementations
impl<A> RefUnwindSafe for Euler<A> where
A: RefUnwindSafe,
A: RefUnwindSafe,
impl<A> Send for Euler<A> where
A: Send,
A: Send,
impl<A> Sync for Euler<A> where
A: Sync,
A: Sync,
impl<A> Unpin for Euler<A> where
A: Unpin,
A: Unpin,
impl<A> UnwindSafe for Euler<A> where
A: UnwindSafe,
A: UnwindSafe,
Blanket Implementations
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
T: Component + Float,
D: AdaptFrom<S, Swp, Dwp, T>,
Swp: WhitePoint,
Dwp: WhitePoint,
[src]
T: Component + Float,
D: AdaptFrom<S, Swp, Dwp, T>,
Swp: WhitePoint,
Dwp: WhitePoint,
pub fn adapt_into_using<M>(self, method: M) -> D where
M: TransformMatrix<Swp, Dwp, T>,
[src]
M: TransformMatrix<Swp, Dwp, T>,
pub fn adapt_into(self) -> D
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> ConvertInto<U> for T where
U: ConvertFrom<T>,
[src]
U: ConvertFrom<T>,
pub fn convert_into(self) -> U
[src]
pub fn convert_unclamped_into(self) -> U
[src]
pub fn try_convert_into(self) -> Result<U, OutOfBounds<U>>
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> Downcast<T> for T
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
pub fn equivalent(&self, key: &K) -> bool
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T> SetParameter for T
pub fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
impl<T> Style for T where
T: Any + Debug + PartialEq<T>,
[src]
T: Any + Debug + PartialEq<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut 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.
pub 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.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Upcast<T> for T
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,