Struct lyon::tessellation::fixed::Fp32
[−]
[src]
pub struct Fp32<F = _16> { /* fields omitted */ }
A 32 fixed point number. The size of the fractional is defined by the type parameter F.
Methods
impl<F> Fp32<F> where F: FractionalBits
fn one() -> Fp32<F>
fn from_i32(val: i32) -> Fp32<F>
fn truncate_to_i32(self) -> i32
Convert to an i32, truncating the fractional part
fn mul_div(self, m: Fp32<F>, d: Fp32<F>) -> Fp32<F>
Computes the self * m / d in one go, avoid the precision loss from shifting bits back and forth.
fn min_val() -> Fp32<F>
fn max_val() -> Fp32<F>
fn to_fp64<NewF>(self) -> Fp64<NewF> where NewF: FractionalBits
Casts into a 64 bits fixed point number.
impl<F> Fp32<F> where F: FractionalBits
fn raw(self) -> i32
Returns the internal representation.
This internal represenataion can be used for computations to avoid bit-shifting between each operation. The number of divisions should be equal to the number of multiplications performed in order to balance out the bit shifts that were skipped.
fn from_raw(bits: i32) -> Fp32<F>
fn zero() -> Fp32<F>
fn is_zero(self) -> bool
fn epsilon() -> Fp32<F>
Smallest increment that can be reresented with this type.
fn from_f32(val: f32) -> Fp32<F>
Converts from a 32 bits floating point value.
fn to_f32(self) -> f32
Converts to a 32 bits floating point value.
fn from_f64(val: f64) -> Fp32<F>
Converts from a 64 bits floating point value.
fn to_f64(self) -> f64
Converts to a 64 bits floating point value.
fn sign(self) -> i32
Returns 1 if the number of positive, -1 if it is negative.
fn rem(self, other: Fp32<F>) -> Fp32<F>
Returns the result of self % other.
fn min(self, other: Fp32<F>) -> Fp32<F>
Returns the lowest of the two values.
fn max(self, other: Fp32<F>) -> Fp32<F>
Returns the highest of the two values.
fn min_max(self, other: Fp32<F>) -> (Fp32<F>, Fp32<F>)
Returns the lowest and highest of the two values in order.
fn abs(self) -> Fp32<F>
Returns the absolute value of this number.
fn to_fixed<NewF>(self) -> Fp32<NewF> where NewF: FractionalBits
Returns the same number with a different fractional precision.