pub trait Scalar: Float + NumCast + FloatConst + Sized + Display + Debug + Trig + AddAssign + SubAssign + MulAssign + DivAssign {
Show 16 associated constants and 2 methods const HALF: Self; const ZERO: Self; const ONE: Self; const TWO: Self; const THREE: Self; const FOUR: Self; const FIVE: Self; const SIX: Self; const SEVEN: Self; const EIGHT: Self; const NINE: Self; const TEN: Self; const MIN: Self; const MAX: Self; const EPSILON: Self; const DIV_EPSILON: Self = Self::EPSILON; // Required method fn value(v: f32) -> Self; // Provided method fn epsilon_for(_reference: Self) -> Self { ... }
}
Available on crate feature canvas only.

Required Associated Constants§

const HALF: Self

const ZERO: Self

const ONE: Self

const TWO: Self

const THREE: Self

const FOUR: Self

const FIVE: Self

const SIX: Self

const SEVEN: Self

const EIGHT: Self

const NINE: Self

const TEN: Self

const MIN: Self

const MAX: Self

const EPSILON: Self

Provided Associated Constants§

const DIV_EPSILON: Self = Self::EPSILON

Required Methods§

fn value(v: f32) -> Self

Provided Methods§

fn epsilon_for(_reference: Self) -> Self

Epsilon constants are usually not a good way to deal with float precision. Float precision depends on the magnitude of the values and so should appropriate epsilons.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

§

impl Scalar for f32

§

const HALF: f32 = 0.5f32

§

const ZERO: f32 = 0f32

§

const ONE: f32 = 1f32

§

const TWO: f32 = 2f32

§

const THREE: f32 = 3f32

§

const FOUR: f32 = 4f32

§

const FIVE: f32 = 5f32

§

const SIX: f32 = 6f32

§

const SEVEN: f32 = 7f32

§

const EIGHT: f32 = 8f32

§

const NINE: f32 = 9f32

§

const TEN: f32 = 10f32

§

const MIN: f32 = -3.40282347E+38f32

§

const MAX: f32 = 3.40282347E+38f32

§

const EPSILON: f32 = 9.99999974E-5f32

§

fn epsilon_for(reference: f32) -> f32

§

fn value(v: f32) -> f32

§

impl Scalar for f64

§

const HALF: f64 = 0.5f64

§

const ZERO: f64 = 0f64

§

const ONE: f64 = 1f64

§

const TWO: f64 = 2f64

§

const THREE: f64 = 3f64

§

const FOUR: f64 = 4f64

§

const FIVE: f64 = 5f64

§

const SIX: f64 = 6f64

§

const SEVEN: f64 = 7f64

§

const EIGHT: f64 = 8f64

§

const NINE: f64 = 9f64

§

const TEN: f64 = 10f64

§

const MIN: f64 = -1.7976931348623157E+308f64

§

const MAX: f64 = 1.7976931348623157E+308f64

§

const EPSILON: f64 = 1.0E-8f64

§

fn epsilon_for(reference: f64) -> f64

§

fn value(v: f32) -> f64

Implementors§