Struct ImplicitCurve2

Source
pub struct ImplicitCurve2 {
    pub field: Field2,
    pub cells: Vec<ImplicitCell>,
}
Expand description

A stretch of a field’s zero set, in the parameters of the surface the field lives on. The parameter t runs over [0, cells.len()]: cell i covers [i, i + 1], its free parameter moving linearly from from to to.

Fields§

§field: Field2

The field whose zero the curve is.

§cells: Vec<ImplicitCell>

The cells, each starting where the previous ends.

Implementations§

Source§

impl ImplicitCurve2

Source

pub fn end(&self) -> Scalar

The parameter range, [0, cells.len()].

Source

pub fn solve_cell(&self, cell: &ImplicitCell, free: Scalar) -> Option<Scalar>

The solved value of cell at free value free.

Source

pub fn point(&self, t: Scalar) -> Option<Point2>

The point at t, or None outside [0, cells.len()].

Source

pub fn derivative(&self, t: Scalar) -> Option<Vec2>

dP/dt.

Source

pub fn second_derivative(&self, t: Scalar) -> Option<Vec2>

d2P/dt2.

Source

pub fn parameter_of(&self, p: Point2) -> Option<Scalar>

The parameter of a point on the curve: the cell whose box holds it, and where its free value falls in the cell.

Source

pub fn shifted(&self, du: Scalar, dv: Scalar) -> Self

The same curve moved by whole periods (du, dv) in parameters.

Source

pub fn closure(&self, periodic_u: bool, periodic_v: bool) -> Option<Vec2>

The offset from the curve’s start to its end in parameters when it closes up to whole periods of 2 pi in the periodic parameters ((0, 0) for a loop that does not wind), or None when it is open.

Source

pub fn sub(&self, t0: Scalar, t1: Scalar, closure: Option<Vec2>) -> Option<Self>

The stretch from t0 to t1, as a curve of its own over [0, cells]. With t0 > t1 the stretch runs on past the end and round from the start, which needs the curve’s closure offset.

Source

pub fn rotated(&self, t: Scalar, closure: Vec2) -> Option<Self>

A closed curve’s whole loop, starting at t instead of at 0.

Source

pub fn clipped(&self, lo: Point2, hi: Point2) -> Vec<Self>

The stretches of the curve inside the box [lo, hi], each as a curve of its own. Crossings of the box’s sides are found by a scan of each cell and bisection on the distance to the box.

Source

pub fn reversed(&self) -> Self

The same curve run backwards: t becomes cells.len() - t.

Source

pub fn turning_points(&self, lo: Scalar, hi: Scalar) -> Vec<Scalar> ⓘ

Parameters in (lo, hi) where the curve may stop being monotone in u or v: every cell boundary, and inside each cell every point where the solved parameter turns (the field’s partial along the free parameter changes sign on the curve). Between consecutive values the curve is monotone in both parameters.

Each turning point is isolated with interval bounds of that partial over boxes that certainly hold the curve (the solved parameter moves at most max |F_free| / min |F_solved| per unit of the free one), so none is missed; a double root, where the sign does not change, is not a turn and is not reported.

Source

pub fn is_finite(&self) -> bool

Whether every number is finite.

Trait Implementations§

Source§

impl Clone for ImplicitCurve2

Source§

fn clone(&self) -> ImplicitCurve2

Returns a copy 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 Debug for ImplicitCurve2

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for ImplicitCurve2

Source§

fn eq(&self, other: &ImplicitCurve2) -> 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 StructuralPartialEq for ImplicitCurve2

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