Numeric

Struct Numeric 

Source
pub struct Numeric(/* private fields */);
Expand description

A number value

Implementations§

Source§

impl Numeric

Source

pub fn is_const(&self) -> bool

Check if this numeric is a constant

Source

pub fn distance<T: Object>(point: impl Into<Point>, object: T) -> Self

Distance between a point and an object

Source

pub fn complex(real: impl Into<Numeric>, imaginary: impl Into<Numeric>) -> Self

A complex number

Source

pub fn angle( a: impl Into<Point>, b: impl Into<Point>, c: impl Into<Point>, ) -> Self

An angle defined by three points

Source

pub fn angle_lines(k: impl Into<Line>, l: impl Into<Line>) -> Self

Angle between two lines

Source

pub fn atan2(y: impl Into<Numeric>, x: impl Into<Numeric>) -> Self

atan2 function

Source

pub fn pow(self, exponent: impl Into<Numeric>) -> Self

Raise this number to a power.

Source

pub fn real(self) -> Self

Get the real part of this number

Source

pub fn imaginary(self) -> Self

Get the imaginary part of this number

Source

pub fn ln(self) -> Self

Natural logarithm (base e)

Source

pub fn exp(self) -> Self

Exponential function (e^this)

Source

pub fn arg(self) -> Self

Get the argument of a complex number.

Source

pub fn point(self) -> Point

Convert this to a point

Source

pub fn sin(self) -> Numeric

Get the sine of this angle.

Source

pub fn cos(self) -> Numeric

Get the cosine of this angle.

Source

pub fn asin(self) -> Numeric

Get the arcsine of this angle.

Source

pub fn acos(self) -> Numeric

Get the arccosine of this angle.

Source

pub fn atan(self) -> Numeric

Get the arctan of this angle.

Source

pub fn normalize(self) -> Numeric

Normalize the value (abs of 1)

Trait Implementations§

Source§

impl<T: Into<Numeric>> Add<T> for Numeric

Source§

type Output = Numeric

The resulting type after applying the + operator.
Source§

fn add(self, rhs: T) -> Self::Output

Performs the + operation. Read more
Source§

impl<T: Into<Numeric>> AddAssign<T> for Numeric

Source§

fn add_assign(&mut self, rhs: T)

Performs the += operation. Read more
Source§

impl Bounded for Numeric

Source§

fn min_value() -> Self

Returns the smallest finite number this type can represent
Source§

fn max_value() -> Self

Returns the largest finite number this type can represent
Source§

impl Clone for Numeric

Source§

fn clone(&self) -> Numeric

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Into<Numeric>> Div<T> for Numeric

Source§

type Output = Numeric

The resulting type after applying the / operator.
Source§

fn div(self, rhs: T) -> Self::Output

Performs the / operation. Read more
Source§

impl<T: Into<Numeric>> DivAssign<T> for Numeric

Source§

fn div_assign(&mut self, rhs: T)

Performs the /= operation. Read more
Source§

impl Expr for Numeric

Source§

type Target = Numeric

Target primitive type.
Source§

fn get_type() -> ElementType

Get the element type of this expression
Source§

fn var(expr: String) -> Var<Self::Target>

Create a variable of target type
Source§

impl From<&Numeric> for Numeric

Source§

fn from(value: &Self) -> Self

Converts to this type from the input type.
Source§

impl<T: Copy + Into<Numeric>> From<&T> for Numeric

Source§

fn from(value: &T) -> Self

Converts to this type from the input type.
Source§

impl From<&Var<Numeric>> for Numeric

Source§

fn from(value: &Var<Numeric>) -> Self

Converts to this type from the input type.
Source§

impl From<Numeric> for Expression

Source§

fn from(value: Numeric) -> Self

Converts to this type from the input type.
Source§

impl From<f64> for Numeric

Source§

fn from(value: f64) -> Self

Converts to this type from the input type.
Source§

impl<T: Into<Numeric>> Mul<T> for Numeric

Source§

type Output = Numeric

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: T) -> Self::Output

Performs the * operation. Read more
Source§

impl<T: Into<Numeric>> MulAssign<T> for Numeric

Source§

fn mul_assign(&mut self, rhs: T)

Performs the *= operation. Read more
Source§

impl Neg for Numeric

Source§

type Output = Numeric

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl Num for Numeric

Source§

type FromStrRadixErr = &'static str

Source§

fn from_str_radix(str: &str, radix: u32) -> Result<Self, Self::FromStrRadixErr>

Convert from a string and radix (typically 2..=36). Read more
Source§

impl One for Numeric

Source§

fn is_one(&self) -> bool

WARNING: This is not necessarily always precise

Source§

fn one() -> Self

Returns the multiplicative identity element of Self, 1. Read more
Source§

fn set_one(&mut self)

Sets self to the multiplicative identity element of Self, 1.
Source§

impl<T> PartialEq<T> for Numeric
where Numeric: for<'a> From<&'a T>,

Source§

fn eq(&self, other: &T) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: Into<Numeric>> Rem<T> for Numeric

Source§

type Output = Numeric

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: T) -> Self::Output

Performs the % operation. Read more
Source§

impl<T: Into<Numeric>> RemAssign<T> for Numeric

Source§

fn rem_assign(&mut self, rhs: T)

Performs the %= operation. Read more
Source§

impl<T: Into<Numeric>> Sub<T> for Numeric

Source§

type Output = Numeric

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: T) -> Self::Output

Performs the - operation. Read more
Source§

impl<T: Into<Numeric>> SubAssign<T> for Numeric

Source§

fn sub_assign(&mut self, rhs: T)

Performs the -= operation. Read more
Source§

impl Zero for Numeric

Source§

fn is_zero(&self) -> bool

WARNING: This is not necessarily always precise

Source§

fn zero() -> Self

Returns the additive identity element of Self, 0. Read more
Source§

fn set_zero(&mut self)

Sets self to the additive identity element of Self, 0.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> LowerBounded for T
where T: Bounded,

Source§

fn min_value() -> T

Returns the smallest finite number this type can represent
Source§

impl<T> NumericAccess for T
where Numeric: From<T>,

Source§

fn pow(self, exponent: impl Into<Numeric>) -> Numeric

Raise the number to a power
Source§

fn real(self) -> Numeric

Get the real part of this number
Source§

fn imaginary(self) -> Numeric

Get the imaginary part of this number
Source§

fn arg(self) -> Numeric

Get this complex number’s argument
Source§

fn point(self) -> Point

Convert this number to a point
Source§

fn ln(self) -> Numeric

Natural logarithm (base e)
Source§

fn exp(self) -> Numeric

Exponential function (e^this)
Source§

fn sin(self) -> Numeric

Get the sine of this angle.
Source§

fn cos(self) -> Numeric

Get the cosine of this angle.
Source§

fn asin(self) -> Numeric

Get the arcsine of this angle.
Source§

fn acos(self) -> Numeric

Get the arccosine of this angle.
Source§

fn atan(self) -> Numeric

Get the arctan of this angle.
Source§

fn normalize(self) -> Numeric

Normalize this value (abs of 1)
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> UpperBounded for T
where T: Bounded,

Source§

fn max_value() -> T

Returns the largest finite number this type can represent
Source§

impl<T> NumAssign for T
where T: Num + NumAssignOps,

Source§

impl<T, Rhs> NumAssignOps<Rhs> for T
where T: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs> + RemAssign<Rhs>,

Source§

impl<T> NumAssignRef for T
where T: NumAssign + for<'r> NumAssignOps<&'r T>,

Source§

impl<T, Rhs, Output> NumOps<Rhs, Output> for T
where T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>,

Source§

impl<T> NumRef for T
where T: Num + for<'r> NumOps<&'r T>,

Source§

impl<T, Base> RefNum<Base> for T
where T: NumOps<Base, Base> + for<'r> NumOps<&'r Base, Base>,