[−][src]Struct sss_rs::geometry::polynomial::Polynomial
A polynomial function that is made up of a Vec of @Term. It supports common operations done on polynomials including finding the 'y' value with a given 'x' value.
Methods
impl Polynomial
[src]
pub fn new() -> Self
[src]
Creates an empty polynomial with no terms
pub fn from_points(points: &Vec<Point>, degree: usize) -> Result<Self, Error>
[src]
From a given list of points, attempts to use Lagrange interpolation to generate the polynomial that runs through those points. Will return an error if there's not enough pointes to satisfy the @degree requested. If the degree is not to be known, it can be set to @points.len() - 1
pub fn builder() -> PolynomialBuilder
[src]
Returns a PolynomialBuilder struct that provides a builder design pattern.
pub fn get_degree(&self) -> i32
[src]
Gets the degree of the polynomial
pub fn add_to_term(&mut self, term: Term)
[src]
Adds a term to the polynomial
pub fn sub_to_term(&mut self, term: Term)
[src]
Subs aterm from the polynomial
pub fn set_term(&mut self, term: Term)
[src]
Sets the term with degree @term.get_degree() to @term
pub fn set_terms(&mut self, poly: Polynomial)
[src]
Iterates through @poly's terms and sets each of @self's terms to those from @poly
pub fn get_term(&self, degree: i32) -> Term
[src]
Returns a copy of the term with the given degree, or creates a new zero coefficient term and returns it. This term is not added into the polynomial
pub fn add_polynomial(self, rhs: Self) -> Self
[src]
Adds together two polynomials, consuming both and returning the sum
pub fn sub_polynomial(self, rhs: Self) -> Self
[src]
Subtracts one polynomial from the other, consuming both and returning the difference
pub fn mul_polynomial(self, rhs: Self) -> Self
[src]
Multiplies together two polynomials, consuming both and returning the product
pub fn scale<T: Into<Fraction>>(self, scalar: T) -> Self
[src]
Scales the polynomial with the given @scalar. Each term gets multiplied by @scalar with no impact on the terms' degree
pub fn negate(self) -> Self
[src]
Negates the entire polynomial, meaning each term has its sign flipped
pub fn get_y_value(&self, x_val: Fraction) -> Fraction
[src]
Get the corresponding 'y' value to the given 'x' value
Trait Implementations
impl From<Term> for Polynomial
[src]
impl IntoIterator for Polynomial
[src]
Creates an iterator that iterates through the terms of the polynomial
type Item = Term
The type of the elements being iterated over.
type IntoIter = IntoIter<Self::Item>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
impl Clone for Polynomial
[src]
fn clone(&self) -> Polynomial
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Default for Polynomial
[src]
impl Eq for Polynomial
[src]
impl PartialEq<Polynomial> for Polynomial
[src]
impl Display for Polynomial
[src]
impl Debug for Polynomial
[src]
impl Sub<Polynomial> for Polynomial
[src]
type Output = Polynomial
The resulting type after applying the -
operator.
fn sub(self, rhs: Polynomial) -> Self::Output
[src]
impl<'_> Sub<&'_ Polynomial> for Polynomial
[src]
type Output = Polynomial
The resulting type after applying the -
operator.
fn sub(self, rhs: &Polynomial) -> Self::Output
[src]
impl<'_> Sub<Polynomial> for &'_ Polynomial
[src]
type Output = Polynomial
The resulting type after applying the -
operator.
fn sub(self, rhs: Polynomial) -> Self::Output
[src]
impl<'_, '_> Sub<&'_ Polynomial> for &'_ Polynomial
[src]
type Output = Polynomial
The resulting type after applying the -
operator.
fn sub(self, rhs: &Polynomial) -> Self::Output
[src]
impl Sub<Polynomial> for Term
[src]
type Output = Polynomial
The resulting type after applying the -
operator.
fn sub(self, rhs: Polynomial) -> Self::Output
[src]
impl<'_> Sub<&'_ Polynomial> for Term
[src]
type Output = Polynomial
The resulting type after applying the -
operator.
fn sub(self, rhs: &Polynomial) -> Self::Output
[src]
impl<'_> Sub<Polynomial> for &'_ Term
[src]
type Output = Polynomial
The resulting type after applying the -
operator.
fn sub(self, rhs: Polynomial) -> Self::Output
[src]
impl<'_, '_> Sub<&'_ Polynomial> for &'_ Term
[src]
type Output = Polynomial
The resulting type after applying the -
operator.
fn sub(self, rhs: &Polynomial) -> Self::Output
[src]
impl Add<Polynomial> for Polynomial
[src]
type Output = Polynomial
The resulting type after applying the +
operator.
fn add(self, rhs: Polynomial) -> Self::Output
[src]
impl<'_> Add<&'_ Polynomial> for Polynomial
[src]
type Output = Polynomial
The resulting type after applying the +
operator.
fn add(self, rhs: &Polynomial) -> Self::Output
[src]
impl<'_> Add<Polynomial> for &'_ Polynomial
[src]
type Output = Polynomial
The resulting type after applying the +
operator.
fn add(self, rhs: Polynomial) -> Self::Output
[src]
impl<'_, '_> Add<&'_ Polynomial> for &'_ Polynomial
[src]
type Output = Polynomial
The resulting type after applying the +
operator.
fn add(self, rhs: &Polynomial) -> Self::Output
[src]
impl Add<Polynomial> for Term
[src]
type Output = Polynomial
The resulting type after applying the +
operator.
fn add(self, rhs: Polynomial) -> Self::Output
[src]
impl<'_> Add<&'_ Polynomial> for Term
[src]
type Output = Polynomial
The resulting type after applying the +
operator.
fn add(self, rhs: &Polynomial) -> Self::Output
[src]
impl<'_> Add<Polynomial> for &'_ Term
[src]
type Output = Polynomial
The resulting type after applying the +
operator.
fn add(self, rhs: Polynomial) -> Self::Output
[src]
impl<'_, '_> Add<&'_ Polynomial> for &'_ Term
[src]
type Output = Polynomial
The resulting type after applying the +
operator.
fn add(self, rhs: &Polynomial) -> Self::Output
[src]
impl Mul<Polynomial> for Polynomial
[src]
type Output = Polynomial
The resulting type after applying the *
operator.
fn mul(self, rhs: Polynomial) -> Self::Output
[src]
impl<'_> Mul<&'_ Polynomial> for Polynomial
[src]
type Output = Polynomial
The resulting type after applying the *
operator.
fn mul(self, rhs: &Polynomial) -> Self::Output
[src]
impl<'_> Mul<Polynomial> for &'_ Polynomial
[src]
type Output = Polynomial
The resulting type after applying the *
operator.
fn mul(self, rhs: Polynomial) -> Self::Output
[src]
impl<'_, '_> Mul<&'_ Polynomial> for &'_ Polynomial
[src]
type Output = Polynomial
The resulting type after applying the *
operator.
fn mul(self, rhs: &Polynomial) -> Self::Output
[src]
impl Mul<Polynomial> for Term
[src]
type Output = Polynomial
The resulting type after applying the *
operator.
fn mul(self, rhs: Polynomial) -> Self::Output
[src]
impl<'_> Mul<&'_ Polynomial> for Term
[src]
type Output = Polynomial
The resulting type after applying the *
operator.
fn mul(self, rhs: &Polynomial) -> Self::Output
[src]
impl<'_> Mul<Polynomial> for &'_ Term
[src]
type Output = Polynomial
The resulting type after applying the *
operator.
fn mul(self, rhs: Polynomial) -> Self::Output
[src]
impl<'_, '_> Mul<&'_ Polynomial> for &'_ Term
[src]
type Output = Polynomial
The resulting type after applying the *
operator.
fn mul(self, rhs: &Polynomial) -> Self::Output
[src]
impl Neg for Polynomial
[src]
type Output = Self
The resulting type after applying the -
operator.
fn neg(self) -> Self::Output
[src]
impl<'_> Neg for &'_ Polynomial
[src]
type Output = Polynomial
The resulting type after applying the -
operator.
fn neg(self) -> Self::Output
[src]
Auto Trait Implementations
impl Send for Polynomial
impl Sync for Polynomial
impl Unpin for Polynomial
impl UnwindSafe for Polynomial
impl RefUnwindSafe for Polynomial
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<I> IntoIterator for I where
I: Iterator,
[src]
I: Iterator,
type Item = <I as Iterator>::Item
The type of the elements being iterated over.
type IntoIter = I
Which kind of iterator are we turning this into?
fn into_iter(self) -> I
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,