Skip to main content

Number

Trait Number 

Source
pub trait Number:
    Copy
    + Clone
    + Debug
    + Display
    + Default
    + Send
    + Sync
    + 'static {
    const ZERO: Self;
    const ONE: Self;
    const TWO: Self;
    const PI: Self;
Show 25 methods // Required methods fn from_i64(v: i64) -> Self; fn from_f64(v: f64) -> Self; fn from_scalar(s: Scalar) -> Self; fn from_ratio(num: i64, den: i64) -> GeopResult<Self>; fn to_f64(self) -> f64; fn add(self, other: Self) -> Self; fn sub(self, other: Self) -> Self; fn mul(self, other: Self) -> Self; fn neg(self) -> Self; fn div(self, other: Self) -> GeopResult<Self>; fn abs(self) -> Self; fn sqrt(self) -> GeopResult<Self>; fn sin(self) -> Self; fn cos(self) -> Self; fn acos(self) -> GeopResult<Self>; fn could_be_equal(self, other: Self) -> bool; fn definitely_not_equal(self, other: Self) -> bool; fn could_be_greater(self, other: Self) -> bool; fn definitely_greater(self, other: Self) -> bool; fn could_be_less(self, other: Self) -> bool; fn definitely_less(self, other: Self) -> bool; fn is_sharp(self) -> bool; fn is_exactly(self, other: Self) -> bool; fn union(self, other: Self) -> Self; // Provided method fn degrees_to_radians(self) -> GeopResult<Self> { ... }
}
Expand description

A number a residual computes with: a Scalar, giving the residual’s value, or a crate::dual::Dual of one, giving its value and its derivatives by the variables it depends on. Every residual is written once, over T: Number, and evaluated with either. The comparisons act on the value alone.

Required Associated Constants§

Source

const ZERO: Self

Source

const ONE: Self

Source

const TWO: Self

Source

const PI: Self

Required Methods§

Source

fn from_i64(v: i64) -> Self

Source

fn from_f64(v: f64) -> Self

Source

fn from_scalar(s: Scalar) -> Self

The scalar s as a constant: depending on no variable.

Source

fn from_ratio(num: i64, den: i64) -> GeopResult<Self>

Source

fn to_f64(self) -> f64

The value’s midpoint, for rendering and debugging.

Source

fn add(self, other: Self) -> Self

Source

fn sub(self, other: Self) -> Self

Source

fn mul(self, other: Self) -> Self

Source

fn neg(self) -> Self

Source

fn div(self, other: Self) -> GeopResult<Self>

Fails where the divisor could be zero.

Source

fn abs(self) -> Self

Source

fn sqrt(self) -> GeopResult<Self>

Source

fn sin(self) -> Self

Source

fn cos(self) -> Self

Source

fn acos(self) -> GeopResult<Self>

Source

fn could_be_equal(self, other: Self) -> bool

Source

fn definitely_not_equal(self, other: Self) -> bool

Source

fn could_be_greater(self, other: Self) -> bool

Source

fn definitely_greater(self, other: Self) -> bool

Source

fn could_be_less(self, other: Self) -> bool

Source

fn definitely_less(self, other: Self) -> bool

Source

fn is_sharp(self) -> bool

Whether it is a single, exactly known point: a value that depends on no variable, and carries no width.

Source

fn is_exactly(self, other: Self) -> bool

Whether its value is exactly other’s, as a set (see Scalar::is_exactly).

Source

fn union(self, other: Self) -> Self

The smallest value containing both (see Scalar::union).

Provided Methods§

Source

fn degrees_to_radians(self) -> GeopResult<Self>

The angle self, given in degrees, in radians.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl Number for Scalar

Source§

const ZERO: Self = Scalar::ZERO

Source§

const ONE: Self = Scalar::ONE

Source§

const TWO: Self = Scalar::TWO

Source§

const PI: Self = Scalar::PI

Source§

impl<const N: usize> Number for Dual<N>

Source§

const ZERO: Self

Source§

const ONE: Self

Source§

const TWO: Self

Source§

const PI: Self