Trait nannou::math::prelude::Angle [−][src]
pub trait Angle: Copy + Clone + PartialEq<Self> + PartialOrd<Self> + AbsDiffEq<Self, Epsilon = Self::Unitless, Epsilon = Self::Unitless, Epsilon = Self::Unitless> + RelativeEq<Self> + UlpsEq<Self> + Zero<Output = Self> + Neg<Output = Self> + Add<Self> + Sub<Self, Output = Self> + Rem<Self, Output = Self> + Mul<Self::Unitless, Output = Self> + Div<Self, Output = Self::Unitless, Output = Self> + Div<Self::Unitless> + Sum<Self> { type Unitless: BaseFloat;}Show methods
pub fn full_turn() -> Self; pub fn sin(self) -> Self::Unitless; pub fn cos(self) -> Self::Unitless; pub fn tan(self) -> Self::Unitless; pub fn sin_cos(self) -> (Self::Unitless, Self::Unitless); pub fn asin(ratio: Self::Unitless) -> Self; pub fn acos(ratio: Self::Unitless) -> Self; pub fn atan(ratio: Self::Unitless) -> Self; pub fn atan2(a: Self::Unitless, b: Self::Unitless) -> Self; pub fn normalize(self) -> Self { ... } pub fn normalize_signed(self) -> Self { ... } pub fn opposite(self) -> Self { ... } pub fn bisect(self, other: Self) -> Self { ... } pub fn turn_div_2() -> Self { ... } pub fn turn_div_3() -> Self { ... } pub fn turn_div_4() -> Self { ... } pub fn turn_div_6() -> Self { ... } pub fn csc(self) -> Self::Unitless { ... } pub fn cot(self) -> Self::Unitless { ... } pub fn sec(self) -> Self::Unitless { ... }
Angles and their associated trigonometric functions.
Typed angles allow for the writing of self-documenting code that makes it clear when semantic violations have occured - for example, adding degrees to radians, or adding a number to an angle.
Associated Types
Loading content...Required methods
pub fn full_turn() -> Self
[src]
A full rotation.
pub fn sin(self) -> Self::Unitless
[src]
Compute the sine of the angle, returning a unitless ratio.
use cgmath::prelude::*; use cgmath::Rad; let angle = Rad(35.0); let ratio: f32 = Rad::sin(angle);
pub fn cos(self) -> Self::Unitless
[src]
Compute the cosine of the angle, returning a unitless ratio.
use cgmath::prelude::*; use cgmath::Rad; let angle = Rad(35.0); let ratio: f32 = Rad::cos(angle);
pub fn tan(self) -> Self::Unitless
[src]
Compute the tangent of the angle, returning a unitless ratio.
use cgmath::prelude::*; use cgmath::Rad; let angle = Rad(35.0); let ratio: f32 = Rad::tan(angle);
pub fn sin_cos(self) -> (Self::Unitless, Self::Unitless)
[src]
Compute the sine and cosine of the angle, returning the result as a pair.
This does not have any performance benefits, but calculating both the sine and cosine of a single angle is a common operation.
use cgmath::prelude::*; use cgmath::Rad; let angle = Rad(35.0); let (s, c) = Rad::sin_cos(angle);
pub fn asin(ratio: Self::Unitless) -> Self
[src]
Compute the arcsine of the ratio, returning the resulting angle.
use cgmath::prelude::*; use cgmath::Rad; let angle: Rad<f32> = Rad::asin(0.5);
pub fn acos(ratio: Self::Unitless) -> Self
[src]
Compute the arccosine of the ratio, returning the resulting angle.
use cgmath::prelude::*; use cgmath::Rad; let angle: Rad<f32> = Rad::acos(0.5);
pub fn atan(ratio: Self::Unitless) -> Self
[src]
Compute the arctangent of the ratio, returning the resulting angle.
use cgmath::prelude::*; use cgmath::Rad; let angle: Rad<f32> = Rad::atan(0.5);
pub fn atan2(a: Self::Unitless, b: Self::Unitless) -> Self
[src]
Provided methods
pub fn normalize(self) -> Self
[src]
Return the angle, normalized to the range [0, full_turn)
.
pub fn normalize_signed(self) -> Self
[src]
Return the angle, normalized to the range [-turn_div_2, turn_div_2)
.
pub fn opposite(self) -> Self
[src]
Return the angle rotated by half a turn.
pub fn bisect(self, other: Self) -> Self
[src]
Returns the interior bisector of the two angles.
pub fn turn_div_2() -> Self
[src]
Half of a full rotation.
pub fn turn_div_3() -> Self
[src]
A third of a full rotation.
pub fn turn_div_4() -> Self
[src]
A quarter of a full rotation.
pub fn turn_div_6() -> Self
[src]
A sixth of a full rotation.
pub fn csc(self) -> Self::Unitless
[src]
Compute the cosecant of the angle.
This is the same as computing the reciprocal of Self::sin
.
use cgmath::prelude::*; use cgmath::Rad; let angle = Rad(35.0); let ratio: f32 = Rad::csc(angle);
pub fn cot(self) -> Self::Unitless
[src]
Compute the cotangent of the angle.
This is the same as computing the reciprocal of Self::tan
.
use cgmath::prelude::*; use cgmath::Rad; let angle = Rad(35.0); let ratio: f32 = Rad::cot(angle);
pub fn sec(self) -> Self::Unitless
[src]
Compute the secant of the angle.
This is the same as computing the reciprocal of Self::cos
.
use cgmath::prelude::*; use cgmath::Rad; let angle = Rad(35.0); let ratio: f32 = Rad::sec(angle);
Implementors
impl<S> Angle for Deg<S> where
S: BaseFloat,
[src]
S: BaseFloat,
type Unitless = S
pub fn full_turn() -> Deg<S>
[src]
pub fn sin(self) -> S
[src]
pub fn cos(self) -> S
[src]
pub fn tan(self) -> S
[src]
pub fn sin_cos(self) -> (S, S)
[src]
pub fn asin(a: S) -> Deg<S>
[src]
pub fn acos(a: S) -> Deg<S>
[src]
pub fn atan(a: S) -> Deg<S>
[src]
pub fn atan2(a: S, b: S) -> Deg<S>
[src]
impl<S> Angle for Rad<S> where
S: BaseFloat,
[src]
S: BaseFloat,