euclid

Trait Trig

Source
pub trait Trig {
    // Required methods
    fn sin(self) -> Self;
    fn cos(self) -> Self;
    fn tan(self) -> Self;
    fn fast_atan2(y: Self, x: Self) -> Self;
    fn degrees_to_radians(deg: Self) -> Self;
    fn radians_to_degrees(rad: Self) -> Self;
}
Expand description

Trait for basic trigonometry functions, so they can be used on generic numeric types

Required Methods§

Source

fn sin(self) -> Self

Source

fn cos(self) -> Self

Source

fn tan(self) -> Self

Source

fn fast_atan2(y: Self, x: Self) -> Self

Source

fn degrees_to_radians(deg: Self) -> Self

Source

fn radians_to_degrees(rad: Self) -> Self

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Trig for f32

Source§

fn fast_atan2(y: f32, x: f32) -> f32

A slightly faster approximation of atan2.

Note that it does not deal with the case where both x and y are 0.

Source§

fn sin(self) -> f32

Source§

fn cos(self) -> f32

Source§

fn tan(self) -> f32

Source§

fn degrees_to_radians(deg: Self) -> Self

Source§

fn radians_to_degrees(rad: Self) -> Self

Source§

impl Trig for f64

Source§

fn fast_atan2(y: f64, x: f64) -> f64

A slightly faster approximation of atan2.

Note that it does not deal with the case where both x and y are 0.

Source§

fn sin(self) -> f64

Source§

fn cos(self) -> f64

Source§

fn tan(self) -> f64

Source§

fn degrees_to_radians(deg: Self) -> Self

Source§

fn radians_to_degrees(rad: Self) -> Self

Implementors§