CubicBezier2d

Struct CubicBezier2d 

Source
pub struct CubicBezier2d { /* private fields */ }
Expand description

A cubic bezier curve

Implementations§

Source§

impl CubicBezier2d

Source

pub const fn new(points: &[Point2d; 4]) -> Self

Creates a new cubic bezier curve that passes through the provided control points.

Source

pub fn line(start: Point2d, end: Point2d) -> Self

Creates a cubic bezier curve which is a straight line passing through the given endpoints.

Source

pub fn quadratic(points: &[Point2d; 3]) -> Self

Creates a cubic bezier curve which is identical to the quadratic bezier curve that passes through the provided control points.

Source

pub fn subdivide(&self, t: f64) -> [CubicBezier2d; 2]

Subdivide the curve into two sub curves at the value t.

Source

pub fn reverse(&mut self)

Reverses the order of the control points in the bezier curve, such that the point which at t=0 is now at t=1 and vise versa.

Trait Implementations§

Source§

impl Clone for CubicBezier2d

Source§

fn clone(&self) -> CubicBezier2d

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 Debug for CubicBezier2d

Source§

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

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

impl ParametricCurve2d for CubicBezier2d

Source§

fn sample(&self, t: f64) -> Point2d

Samples the parametric curve.
Source§

fn bounds(&self) -> Interval<f64>

Returns the minimum and maximum t-values that define the bounds of the curve.
Source§

fn sample_dt(&self, t: f64) -> Vector2d

Samples the derivative of the parametric curve. Read more
Source§

fn sample_dt2(&self, t: f64) -> Vector2d

Samples the second derivative of the parametric curve. Read more
Source§

impl Copy for CubicBezier2d

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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.