Struct flo_curves::bezier::Curve

source ·
pub struct Curve<Coord: Coordinate> {
    pub start_point: Coord,
    pub end_point: Coord,
    pub control_points: (Coord, Coord),
}
Expand description

Represents a Bezier curve

Fields§

§start_point: Coord§end_point: Coord§control_points: (Coord, Coord)

Trait Implementations§

source§

impl<Coord: Coordinate> BezierCurve for Curve<Coord>

source§

fn start_point(&self) -> Coord

The start point of this curve
source§

fn end_point(&self) -> Coord

The end point of this curve
source§

fn control_points(&self) -> (Coord, Coord)

The control points in this curve
source§

fn reverse<Curve: BezierCurveFactory<Point = Self::Point>>(self) -> Curve

Reverses the direction of this curve
source§

fn point_at_pos(&self, t: f64) -> Self::Point

Given a value t from 0 to 1, returns a point on this curve
source§

fn t_for_point(&self, point: &Self::Point) -> Option<f64>

Given a point that is on or very close to the curve, returns the t value where the point can be found (or None if the point is not very close to the curve) Read more
source§

fn subdivide<Curve: BezierCurveFactory<Point = Self::Point>>( &self, t: f64 ) -> (Curve, Curve)

Given a value t from 0 to 1, finds a point on this curve and subdivides it, returning the two resulting curves
source§

fn bounding_box<Bounds: BoundingBox<Point = Self::Point>>(&self) -> Bounds

Computes the bounds of this bezier curve
source§

fn fast_bounding_box<Bounds: BoundingBox<Point = Self::Point>>(&self) -> Bounds

Faster but less accurate bounding box for a curve Read more
source§

fn search_with_bounds<MatchFn: Fn(Self::Point, Self::Point) -> bool>( &self, max_error: f64, match_fn: MatchFn ) -> Vec<f64>

Given a function that determines if a searched-for point is within a bounding box, searches the curve for the t values for the corresponding points
source§

fn find_extremities(&self) -> Vec<f64>

Finds the t values where this curve has extremities
source§

fn estimate_length(&self) -> f64

Attempts to estimate the length of this curve
source§

fn section(&self, t_min: f64, t_max: f64) -> CurveSection<'_, Self>

Create a section from this curve. Consider calling subsection for curves that are already CurveSections.
source§

impl<Coord: Coordinate> BezierCurveFactory for Curve<Coord>

source§

fn from_points( start: Coord, (control_point1, control_point2): (Coord, Coord), end: Coord ) -> Self

Creates a new bezier curve of the same type from some points
source§

fn from_curve<Curve: BezierCurve<Point = Self::Point>>(curve: &Curve) -> Self

Creates a new bezier curve of this type from an equivalent curve of another type
source§

fn fit_from_points(points: &[Self::Point], max_error: f64) -> Option<Vec<Self>>

Generates a curve by attempting to find a best fit against a set of points
source§

impl<Coord: Clone + Coordinate> Clone for Curve<Coord>

source§

fn clone(&self) -> Curve<Coord>

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<Coord: Debug + Coordinate> Debug for Curve<Coord>

source§

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

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

impl<Coord: Coordinate> Geo for Curve<Coord>

§

type Point = Coord

The type of a point in this geometry
source§

impl<Coord: Coordinate> HasBoundingBox for Curve<Coord>

source§

fn get_bounding_box<Bounds: BoundingBox<Point = Self::Point>>(&self) -> Bounds

Computes the bounds of this bezier curve

source§

impl<Coord: PartialEq + Coordinate> PartialEq<Curve<Coord>> for Curve<Coord>

source§

fn eq(&self, other: &Curve<Coord>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<Coord: Copy + Coordinate> Copy for Curve<Coord>

source§

impl<Coord: Coordinate> StructuralPartialEq for Curve<Coord>

Auto Trait Implementations§

§

impl<Coord> RefUnwindSafe for Curve<Coord>where Coord: RefUnwindSafe,

§

impl<Coord> Send for Curve<Coord>where Coord: Send,

§

impl<Coord> Sync for Curve<Coord>where Coord: Sync,

§

impl<Coord> Unpin for Curve<Coord>where Coord: Unpin,

§

impl<Coord> UnwindSafe for Curve<Coord>where Coord: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. 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 Twhere 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<Curve> NormalCurve for Curvewhere Curve: BezierCurve, <Curve as Geo>::Point: Normalize,

source§

fn tangent_at_pos(&self, t: f64) -> <Curve as Geo>::Point

Computes the tangent vector to the curve at the specified t value Read more
source§

fn normal_at_pos(&self, t: f64) -> <Curve as Geo>::Point

Computes the normal vector to the curve at the specified t value Read more
source§

impl<T> ToOwned for Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.