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>
impl<Coord: Coordinate> BezierCurve for Curve<Coord>
source§fn start_point(&self) -> Coord
fn start_point(&self) -> Coord
The start point of this curve
source§fn control_points(&self) -> (Coord, Coord)
fn control_points(&self) -> (Coord, Coord)
The control points in this curve
source§fn reverse<Curve: BezierCurveFactory<Point = Self::Point>>(self) -> Curve
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
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>
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)
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
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
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>
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>
fn find_extremities(&self) -> Vec<f64>
Finds the t values where this curve has extremities
source§fn estimate_length(&self) -> f64
fn estimate_length(&self) -> f64
Attempts to estimate the length of this curve
source§impl<Coord: Coordinate> BezierCurveFactory for Curve<Coord>
impl<Coord: Coordinate> BezierCurveFactory for Curve<Coord>
source§fn from_points(
start: Coord,
(control_point1, control_point2): (Coord, Coord),
end: Coord
) -> Self
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
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§impl<Coord: Coordinate> Geo for Curve<Coord>
impl<Coord: Coordinate> Geo for Curve<Coord>
source§impl<Coord: Coordinate> HasBoundingBox for Curve<Coord>
impl<Coord: Coordinate> HasBoundingBox for Curve<Coord>
source§fn get_bounding_box<Bounds: BoundingBox<Point = Self::Point>>(&self) -> Bounds
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>
impl<Coord: PartialEq + Coordinate> PartialEq<Curve<Coord>> for Curve<Coord>
impl<Coord: Copy + Coordinate> Copy for Curve<Coord>
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more