#[repr(C)]pub struct SvgCubicCurve {
pub start: SvgPoint,
pub ctrl_1: SvgPoint,
pub ctrl_2: SvgPoint,
pub end: SvgPoint,
}Expand description
A cubic bezier curve defined by start, two control points, and end point.
Fields§
§start: SvgPoint§ctrl_1: SvgPoint§ctrl_2: SvgPoint§end: SvgPointImplementations§
Source§impl SvgCubicCurve
impl SvgCubicCurve
Sourcepub const fn new(
start: SvgPoint,
ctrl_1: SvgPoint,
ctrl_2: SvgPoint,
end: SvgPoint,
) -> Self
pub const fn new( start: SvgPoint, ctrl_1: SvgPoint, ctrl_2: SvgPoint, end: SvgPoint, ) -> Self
Creates a new SvgCubicCurve from start, two control points, and end point
Sourcepub fn reverse(&mut self)
pub fn reverse(&mut self)
Reverses the curve direction in place, swapping start/end and ctrl_1/ctrl_2.
Sourcepub fn get_x_at_t(&self, t: f64) -> f64
pub fn get_x_at_t(&self, t: f64) -> f64
Evaluates the x coordinate of the curve at parameter t in [0, 1].
Sourcepub fn get_y_at_t(&self, t: f64) -> f64
pub fn get_y_at_t(&self, t: f64) -> f64
Evaluates the y coordinate of the curve at parameter t in [0, 1].
Sourcepub fn get_length(&self) -> f64
pub fn get_length(&self) -> f64
Returns the approximate arc length of the curve using linear sampling.
Sourcepub fn get_t_at_offset(&self, offset: f64) -> f64
pub fn get_t_at_offset(&self, offset: f64) -> f64
Returns the parameter t corresponding to a given arc-length offset.
Sourcepub fn get_tangent_vector_at_t(&self, t: f64) -> SvgVector
pub fn get_tangent_vector_at_t(&self, t: f64) -> SvgVector
Returns the normalized tangent vector at parameter t.
Sourcepub fn get_bounds(&self) -> SvgRect
pub fn get_bounds(&self) -> SvgRect
Returns the axis-aligned bounding box of the curve’s control points.
Trait Implementations§
Source§impl Clone for SvgCubicCurve
impl Clone for SvgCubicCurve
Source§fn clone(&self) -> SvgCubicCurve
fn clone(&self) -> SvgCubicCurve
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SvgCubicCurve
impl Debug for SvgCubicCurve
Source§impl PartialEq for SvgCubicCurve
impl PartialEq for SvgCubicCurve
Source§fn eq(&self, other: &SvgCubicCurve) -> bool
fn eq(&self, other: &SvgCubicCurve) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl PartialOrd for SvgCubicCurve
impl PartialOrd for SvgCubicCurve
impl Copy for SvgCubicCurve
impl StructuralPartialEq for SvgCubicCurve
Auto Trait Implementations§
impl Freeze for SvgCubicCurve
impl RefUnwindSafe for SvgCubicCurve
impl Send for SvgCubicCurve
impl Sync for SvgCubicCurve
impl Unpin for SvgCubicCurve
impl UnsafeUnpin for SvgCubicCurve
impl UnwindSafe for SvgCubicCurve
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