[][src]Struct sss_rs::geometry::term::Term

pub struct Term { /* fields omitted */ }

Represents a term in a polynomial function where the @co coefficient is multiplied by 'x' ^ @degree.

Methods

impl Term[src]

pub fn new<T: Into<Fraction>>(co: T, degree: i32) -> Self[src]

Creates a new Term with a given fraction and degree

pub fn get_degree(&self) -> i32[src]

pub fn set_co(&mut self, co: Fraction)[src]

pub fn get_co<'a>(&'a self) -> &'a Fraction[src]

Return a reference to the coefficient of the term

pub fn term_add_same_degree(self, rhs: Term) -> Result<Term, ()>[src]

This is a consuming operation that attempts to add two terms that have the same degree. NOTE: If the two terms do not have the same degree, only an error will be returned and the values dropped.

pub fn term_add(self, rhs: Term) -> Polynomial[src]

Consuming add operation that adds two Terms together and returns a polynomial. Since the two terms may not have the same degree, they would have to become a polynomial.

pub fn term_sub(self, rhs: Term) -> Polynomial[src]

Consuming sub operation that adds two Terms together and returns a polynomial. Since the two terms may not have the same degree, they would have to become a polynomial.

pub fn term_mul(self, rhs: Term) -> Term[src]

Consuming multiplication operation, returns a Term since the multiplication of two single terms will always return a single term thus not needing to be a polynomial

pub fn term_mul_fraction<T: Into<Fraction>>(self, rhs: T) -> Self[src]

Consuming multiplication operation which scales the term by a given fraction. This is equivalent to @term_mul with the second term having a @degree of 0

pub fn term_add_poly(self, rhs: Polynomial) -> Polynomial[src]

Consuming add operation that adds a polynomial to a given term. These are conveience operations that allow for: Polynomai + Term and Term + Polynomial to give a communitive poperty.

pub fn term_sub_poly(self, rhs: Polynomial) -> Polynomial[src]

See @term_add_poly

pub fn term_mul_poly(self, rhs: Polynomial) -> Polynomial[src]

See @term_add_poly

Methods from Deref<Target = Fraction>

pub fn get_numerator(&self) -> i64[src]

Returns a reference to the numerator of the fraction

pub fn get_denominator(&self) -> i64[src]

Returns a reference to the denominator of the fraction

pub fn is_whole(&self) -> bool[src]

Checks if the given fraction is a whole number, returns true if it is, false otherwise

Trait Implementations

impl AsRef<Fraction> for Term[src]

impl From<Term> for Polynomial[src]

impl Clone for Term[src]

impl Default for Term[src]

impl Eq for Term[src]

impl Ord for Term[src]

impl PartialEq<Term> for Term[src]

impl PartialOrd<Term> for Term[src]

impl Display for Term[src]

impl Debug for Term[src]

impl Sub<Term> for Term[src]

type Output = Polynomial

The resulting type after applying the - operator.

impl<'_> Sub<&'_ Term> for Term[src]

type Output = Polynomial

The resulting type after applying the - operator.

impl<'_> Sub<Term> for &'_ Term[src]

type Output = Polynomial

The resulting type after applying the - operator.

impl<'_, '_> Sub<&'_ Term> for &'_ Term[src]

type Output = Polynomial

The resulting type after applying the - operator.

impl Sub<Polynomial> for Term[src]

type Output = Polynomial

The resulting type after applying the - operator.

impl<'_> Sub<&'_ Polynomial> for Term[src]

type Output = Polynomial

The resulting type after applying the - operator.

impl<'_> Sub<Polynomial> for &'_ Term[src]

type Output = Polynomial

The resulting type after applying the - operator.

impl<'_, '_> Sub<&'_ Polynomial> for &'_ Term[src]

type Output = Polynomial

The resulting type after applying the - operator.

impl Add<Term> for Term[src]

type Output = Polynomial

The resulting type after applying the + operator.

impl<'_> Add<&'_ Term> for Term[src]

type Output = Polynomial

The resulting type after applying the + operator.

impl<'_> Add<Term> for &'_ Term[src]

type Output = Polynomial

The resulting type after applying the + operator.

impl<'_, '_> Add<&'_ Term> for &'_ Term[src]

type Output = Polynomial

The resulting type after applying the + operator.

impl Add<Polynomial> for Term[src]

type Output = Polynomial

The resulting type after applying the + operator.

impl<'_> Add<&'_ Polynomial> for Term[src]

type Output = Polynomial

The resulting type after applying the + operator.

impl<'_> Add<Polynomial> for &'_ Term[src]

type Output = Polynomial

The resulting type after applying the + operator.

impl<'_, '_> Add<&'_ Polynomial> for &'_ Term[src]

type Output = Polynomial

The resulting type after applying the + operator.

impl Mul<Term> for Term[src]

type Output = Term

The resulting type after applying the * operator.

impl<'_> Mul<&'_ Term> for Term[src]

type Output = Term

The resulting type after applying the * operator.

impl<'_> Mul<Term> for &'_ Term[src]

type Output = Term

The resulting type after applying the * operator.

impl<'_, '_> Mul<&'_ Term> for &'_ Term[src]

type Output = Term

The resulting type after applying the * operator.

impl Mul<Fraction> for Term[src]

type Output = Term

The resulting type after applying the * operator.

impl<'_> Mul<&'_ Fraction> for Term[src]

type Output = Term

The resulting type after applying the * operator.

impl<'_> Mul<Fraction> for &'_ Term[src]

type Output = Term

The resulting type after applying the * operator.

impl<'_, '_> Mul<&'_ Fraction> for &'_ Term[src]

type Output = Term

The resulting type after applying the * operator.

impl Mul<Polynomial> for Term[src]

type Output = Polynomial

The resulting type after applying the * operator.

impl<'_> Mul<&'_ Polynomial> for Term[src]

type Output = Polynomial

The resulting type after applying the * operator.

impl<'_> Mul<Polynomial> for &'_ Term[src]

type Output = Polynomial

The resulting type after applying the * operator.

impl<'_, '_> Mul<&'_ Polynomial> for &'_ Term[src]

type Output = Polynomial

The resulting type after applying the * operator.

impl Neg for Term[src]

type Output = Self

The resulting type after applying the - operator.

impl<'_> Neg for &'_ Term[src]

type Output = Term

The resulting type after applying the - operator.

impl Deref for Term[src]

type Target = Fraction

The resulting type after dereferencing.

impl StructuralPartialEq for Term[src]

impl StructuralEq for Term[src]

Auto Trait Implementations

impl Send for Term

impl Sync for Term

impl Unpin for Term

impl UnwindSafe for Term

impl RefUnwindSafe for Term

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = !

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]