Skip to main content

TwoPolynomials

Struct TwoPolynomials 

Source
pub struct TwoPolynomials<T, P>
where P: Generic1DPoly<T>, T: Clone + Neg<Output = T> + AddAssign + Add<Output = T> + Mul<Output = T> + MulAssign + From<SmallIntegers> + Sub<Output = T>,
{ /* private fields */ }
Expand description

T is the type being used to represent the real numbers have two polynomials which can be used as functions from T to T so used for an R -> R^2 curve

Implementations§

Source§

impl<const N: usize, T> TwoPolynomials<T, SymmetricalBasisPolynomial<N, T>>
where T: Clone + Neg<Output = T> + AddAssign + Add<Output = T> + Mul<Output = T> + MulAssign + From<SmallIntegers> + Sub<Output = T> + SubAssign<T> + PartialEq,

Source

pub fn pretty_format( &self, variable: &str, zero_pred: &impl Fn(&T) -> bool, ) -> String
where T: Debug,

Source§

impl<T, P> TwoPolynomials<T, P>
where T: Clone + Neg<Output = T> + AddAssign + Add<Output = T> + Mul<Output = T> + MulAssign + From<SmallIntegers> + Sub<Output = T> + SubAssign, P: Generic1DPoly<T>,

Source

pub fn differentiate(self) -> Result<Self, DifferentiateError>

differentiate each component

§Errors

the subspace for the components does not have to be closed under d/dx operator

Source

pub fn evaluate_at(&self, t: T) -> (T, T)

Source

pub fn evaluate_at_many<const POINT_COUNT: usize>( &self, ts: [T; POINT_COUNT], ) -> [(T, T); POINT_COUNT]

Source

pub fn evaluate_at_zero(&self) -> (T, T)

Source

pub fn evaluate_at_one(&self) -> (T, T)

Source

pub fn evaluate_at_neg_one(&self) -> (T, T)

Source

pub fn linear_approx_poly( self, around_here: PointSpecifier<T>, ) -> Result<Self, Result<DifferentiateError, MonomialError>>

first order approximation around the given point

§Errors

it might fail because the subspace for each component does not have to be closed under d/dx operator another possibility is that the subspace does not include the linear function x that should be very unusual, because we typically truncate by degree and 1 is too low of a degree to fall to the chopping block

Source

pub fn apply_matrix(self, two_d_matrix: [[T; 2]; 2]) -> Self
where P: Clone,

A B x C D y

Source

pub fn reflect_y(self) -> Self

Source

pub fn reflect_x(self) -> Self

Source

pub fn swap_axes(self) -> Self

Source§

impl<T, P> TwoPolynomials<T, P>
where T: Clone + Neg<Output = T> + AddAssign + Add<Output = T> + Mul<Output = T> + MulAssign + From<SmallIntegers> + Sub<Output = T> + SubAssign + DivAssign<T>, P: Generic1DPoly<T> + Clone + FundamentalTheorem<T>,

Source

pub fn normals_to_point( self, point: (T, T), zero_pred: &impl Fn(&T) -> bool, my_sqrt: &impl Fn(&T) -> Option<T>, my_cube_root: &impl Fn(&T) -> (Option<T>, Option<T>), ) -> Result<Vec<(T, usize)>, NormalTangentError>

given a parameterized curve in the plane find the values of the parameter where the tangent at that point is perpendicular to the displacement vector pointing between the given point and the curve

§Errors
  • one of the errors associated with differentiate
  • a dot product was not in the subspace
  • a polynomial was not exactly solvable
Source

pub fn tangents_to_points( self, point: (T, T), zero_pred: &impl Fn(&T) -> bool, my_sqrt: &impl Fn(&T) -> Option<T>, my_cube_root: &impl Fn(&T) -> (Option<T>, Option<T>), ) -> Result<Vec<(T, usize)>, NormalTangentError>

given a parameterized curve in the plane find the values of the parameter where the tangent at that point is in the same direction as the displacement vector pointing between the given point and the curve

§Errors
  • one of the errors associated with differentiate
  • a cross product was not in the subspace
  • a polynomial was not exactly solvable
Source

pub fn collision_curve( self, other: Self, zero_pred: &impl Fn(&T) -> bool, my_sqrt: &impl Fn(&T) -> Option<T>, my_cube_root: &impl Fn(&T) -> (Option<T>, Option<T>), ) -> Result<Vec<(T, usize)>, NormalTangentError>

given two parameterized curves in the plane find the values of the parameter where the distance between the two curves becomes 0

§Errors
  • a norm squared was not in the subspace
  • a polynomial was not exactly solvable
Source

pub fn signed_curvature_times_speed_cubed_and_speed_squared( self, zero_pred: &impl Fn(&T) -> bool, ) -> Result<(P, P), NormalTangentError>

for the curvature kappa, take the absolute value of the first output polynomial (in P) then divide by the speed cubed the speed squared is the second output we can’t do it purely within this level of generality with P because you can’t take the square root nor can we divide

§Errors
  • one of the errors associated with differentiate
  • a dot product was not in the subspace
  • a cross product was not in the subspace
Source

pub fn speed_squared( self, zero_pred: &impl Fn(&T) -> bool, ) -> Result<P, NormalTangentError>

speed squared

§Errors
  • one of the errors associated with differentiate
  • a dot product was not in the subspace

Trait Implementations§

Source§

impl<T, P> Add<(T, T)> for TwoPolynomials<T, P>
where T: Clone + Neg<Output = T> + AddAssign + Add<Output = T> + Mul<Output = T> + MulAssign + From<SmallIntegers> + Sub<Output = T> + SubAssign, P: Generic1DPoly<T>,

Source§

type Output = TwoPolynomials<T, P>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl<T, P> Add for TwoPolynomials<T, P>
where T: Clone + Neg<Output = T> + AddAssign + Add<Output = T> + Mul<Output = T> + MulAssign + From<SmallIntegers> + Sub<Output = T> + SubAssign, P: Generic1DPoly<T>,

Source§

type Output = TwoPolynomials<T, P>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl<T, P> AddAssign<(T, T)> for TwoPolynomials<T, P>
where T: Clone + Neg<Output = T> + AddAssign + Add<Output = T> + Mul<Output = T> + MulAssign + From<SmallIntegers> + Sub<Output = T> + SubAssign, P: Generic1DPoly<T>,

Source§

fn add_assign(&mut self, rhs: (T, T))

Performs the += operation. Read more
Source§

impl<T, P> AddAssign for TwoPolynomials<T, P>
where T: Clone + Neg<Output = T> + AddAssign + Add<Output = T> + Mul<Output = T> + MulAssign + From<SmallIntegers> + Sub<Output = T> + SubAssign, P: Generic1DPoly<T>,

Source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
Source§

impl<T, P> Clone for TwoPolynomials<T, P>
where T: Clone + Neg<Output = T> + AddAssign + Add<Output = T> + Mul<Output = T> + MulAssign + From<SmallIntegers> + Sub<Output = T> + SubAssign, P: Generic1DPoly<T> + Clone,

Source§

fn clone(&self) -> Self

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, P> Mul<T> for TwoPolynomials<T, P>
where T: Clone + Neg<Output = T> + AddAssign + Add<Output = T> + Mul<Output = T> + MulAssign + From<SmallIntegers> + Sub<Output = T> + SubAssign, P: Generic1DPoly<T>,

Source§

type Output = TwoPolynomials<T, P>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl<T, P> MulAssign<T> for TwoPolynomials<T, P>
where T: Clone + Neg<Output = T> + AddAssign + Add<Output = T> + Mul<Output = T> + MulAssign + From<SmallIntegers> + Sub<Output = T> + SubAssign, P: Generic1DPoly<T>,

Source§

fn mul_assign(&mut self, rhs: T)

Performs the *= operation. Read more
Source§

impl<T, P> Neg for TwoPolynomials<T, P>
where T: Clone + Neg<Output = T> + AddAssign + Add<Output = T> + Mul<Output = T> + MulAssign + From<SmallIntegers> + Sub<Output = T> + SubAssign, P: Generic1DPoly<T>,

Source§

type Output = TwoPolynomials<T, P>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl<T, P> Sub<(T, T)> for TwoPolynomials<T, P>
where T: Clone + Neg<Output = T> + AddAssign + Add<Output = T> + Mul<Output = T> + MulAssign + From<SmallIntegers> + Sub<Output = T> + SubAssign, P: Generic1DPoly<T>,

Source§

type Output = TwoPolynomials<T, P>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl<T, P> Sub for TwoPolynomials<T, P>
where T: Clone + Neg<Output = T> + AddAssign + Add<Output = T> + Mul<Output = T> + MulAssign + From<SmallIntegers> + Sub<Output = T> + SubAssign, P: Generic1DPoly<T>,

Source§

type Output = TwoPolynomials<T, P>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl<T, P> SubAssign<(T, T)> for TwoPolynomials<T, P>
where T: Clone + Neg<Output = T> + AddAssign + Add<Output = T> + Mul<Output = T> + MulAssign + From<SmallIntegers> + Sub<Output = T> + SubAssign, P: Generic1DPoly<T>,

Source§

fn sub_assign(&mut self, rhs: (T, T))

Performs the -= operation. Read more
Source§

impl<T, P> SubAssign for TwoPolynomials<T, P>
where T: Clone + Neg<Output = T> + AddAssign + Add<Output = T> + Mul<Output = T> + MulAssign + From<SmallIntegers> + Sub<Output = T> + SubAssign, P: Generic1DPoly<T>,

Source§

fn sub_assign(&mut self, rhs: Self)

Performs the -= operation. Read more

Auto Trait Implementations§

§

impl<T, P> Freeze for TwoPolynomials<T, P>
where P: Freeze,

§

impl<T, P> RefUnwindSafe for TwoPolynomials<T, P>

§

impl<T, P> Send for TwoPolynomials<T, P>
where P: Send, T: Send,

§

impl<T, P> Sync for TwoPolynomials<T, P>
where P: Sync, T: Sync,

§

impl<T, P> Unpin for TwoPolynomials<T, P>
where P: Unpin, T: Unpin,

§

impl<T, P> UnsafeUnpin for TwoPolynomials<T, P>
where P: UnsafeUnpin,

§

impl<T, P> UnwindSafe for TwoPolynomials<T, P>
where P: UnwindSafe, T: UnwindSafe,

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> 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.