Skip to main content

ThreePointCubic

Struct ThreePointCubic 

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

A cubic polynomial composed of two curves that share a common center point.

The curve runs through three points: (0,0), the midpoint, and (1,1).

The Curves class contains a curve defined with this class: Curves::ease_in_out_cubic_emphasized.

The ThreePointCubic class implements third-order Bézier curves, where two curves share an interior midpoint that the curve passes through. If the control points surrounding the middle point (b1, and a2) are not collinear with the middle point, then the curve’s derivative will have a discontinuity (a cusp) at the shared middle point.

See also:

  • Curves, where many more predefined curves are available.
  • Cubic, which defines a single cubic polynomial.
  • CatmullRomCurve, a curve which passes through specific values.

Implementations§

Source§

impl ThreePointCubic

Source

pub const fn new( a1: Offset, b1: Offset, midpoint: Offset, a2: Offset, b2: Offset, ) -> ThreePointCubic

Creates two cubic curves that share a common control point.

Rather than creating a new instance, consider using one of the common three-point cubic curves in Curves.

The arguments correspond to the control points for the two curves, including the midpoint, but do not include the two implied end points at (0,0) and (1,1), which are fixed.

Source

pub const fn a1(&self) -> Offset

The coordinates of the first control point of the first curve.

The line through the point (0, 0) and this control point is tangent to the curve at the point (0, 0).

Source

pub const fn b1(&self) -> Offset

The coordinates of the second control point of the first curve.

The line through the midpoint and this control point is tangent to the curve approaching the midpoint.

Source

pub const fn midpoint(&self) -> Offset

The coordinates of the middle shared point.

The curve will go through this point. If the control points surrounding this middle point (b1, and a2) are not colinear with this point, then the curve’s derivative will have a discontinuity (a cusp) at this point.

Source

pub const fn a2(&self) -> Offset

The coordinates of the first control point of the second curve.

The line through the midpoint and this control point is tangent to the curve approaching the midpoint.

Source

pub const fn b2(&self) -> Offset

The coordinates of the second control point of the second curve.

The line through the point (1, 1) and this control point is tangent to the curve at (1, 1).

Trait Implementations§

Source§

impl Curve for ThreePointCubic

Source§

fn transform_internal(&self, t: f64) -> f64

Returns the value of the curve at point t. Read more
Source§

fn transform(&self, t: f64) -> f64

Returns the value of the curve at point t. Read more
Source§

impl Debug for ThreePointCubic

Source§

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

Formats the value using the given formatter. Read more

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,