Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
Geom::BezierCurveN< degree > Class Template Reference

Bezier curve with compile-time specified order. More...

#include <bezier-curve.h>

Inheritance diagram for Geom::BezierCurveN< degree >:
Geom::BezierCurve Geom::Curve

Public Member Functions

std::pair< BezierCurveN, BezierCurveNsubdivide (Coord t) const
 Divide a Bezier curve into two curves.
 
bool isDegenerate () const override
 Check whether the curve has exactly zero length.
 
bool isLineSegment () const override
 Return false if there are at least 3 distinct control points, true otherwise.
 
Curveduplicate () const override
 Create an exact copy of this curve.
 
Curveportion (Coord f, Coord t) const override
 Create a curve that corresponds to a part of this curve.
 
Curvereverse () const override
 Create a reversed version of this curve.
 
Curvederivative () const override
 Create a derivative of this curve.
 
Coord nearestTime (Point const &p, Coord from=0, Coord to=1) const override
 Compute a time value at which the curve comes closest to a specified point.
 
std::vector< CurveIntersectionintersect (Curve const &other, Coord eps=EPSILON) const override
 Compute intersections with another curve.
 
int winding (Point const &p) const override
 Compute the partial winding number of this curve.
 
void feed (PathSink &sink, bool moveto_initial) const override
 Feed the curve to a PathSink.
 
void expandToTransformed (Rect &bbox, Affine const &transform) const override
 Expand the given rectangle to include the transformed curve, assuming it already contains its initial point.
 
bool isDegenerate () const
 Check whether the curve has exactly zero length.
 
bool isLineSegment () const
 Return false if there are at least 3 distinct control points, true otherwise.
 
Curvederivative () const
 Create a derivative of this curve.
 
Coord nearestTime (Point const &, Coord, Coord) const
 Compute a time value at which the curve comes closest to a specified point.
 
std::vector< CurveIntersectionintersect (Curve const &, Coord) const
 Compute intersections with another curve.
 
std::vector< CurveIntersectionintersect (Curve const &, Coord) const
 Compute intersections with another curve.
 
std::vector< CurveIntersectionintersect (Curve const &, Coord) const
 Compute intersections with another curve.
 
int winding (Point const &) const
 Compute the partial winding number of this curve.
 
void feed (PathSink &sink, bool moveto_initial) const
 Feed the curve to a PathSink.
 
void feed (PathSink &sink, bool moveto_initial) const
 Feed the curve to a PathSink.
 
void feed (PathSink &sink, bool moveto_initial) const
 Feed the curve to a PathSink.
 
void expandToTransformed (Rect &bbox, Affine const &transform) const
 Expand the given rectangle to include the transformed curve, assuming it already contains its initial point.
 
void expandToTransformed (Rect &bbox, Affine const &transform) const
 Expand the given rectangle to include the transformed curve, assuming it already contains its initial point.
 
void expandToTransformed (Rect &bbox, Affine const &transform) const
 Expand the given rectangle to include the transformed curve, assuming it already contains its initial point.
 
Curvederivative () const
 Create a derivative of this curve.
 
Coord nearestTime (Point const &p, Coord from, Coord to) const
 Compute a time value at which the curve comes closest to a specified point.
 
std::vector< CurveIntersectionintersect (Curve const &other, Coord eps) const
 Compute intersections with another curve.
 
std::vector< CurveIntersectionintersect (Curve const &other, Coord eps) const
 Compute intersections with another curve.
 
std::vector< CurveIntersectionintersect (Curve const &other, Coord eps) const
 Compute intersections with another curve.
 
int winding (Point const &p) const
 Compute the partial winding number of this curve.
 
void feed (PathSink &sink, bool moveto_initial) const
 Feed the curve to a PathSink.
 
void feed (PathSink &sink, bool moveto_initial) const
 Feed the curve to a PathSink.
 
void feed (PathSink &sink, bool moveto_initial) const
 Feed the curve to a PathSink.
 
void expandToTransformed (Rect &bbox, Affine const &transform) const
 Expand the given rectangle to include the transformed curve, assuming it already contains its initial point.
 
void expandToTransformed (Rect &bbox, Affine const &transform) const
 Expand the given rectangle to include the transformed curve, assuming it already contains its initial point.
 
void expandToTransformed (Rect &bbox, Affine const &transform) const
 Expand the given rectangle to include the transformed curve, assuming it already contains its initial point.
 
Construct Bezier curves
 BezierCurveN ()
 Construct a Bezier curve of the specified order with all points zero.
 
 BezierCurveN (D2< Bezier > const &x)
 Construct from 2D Bezier polynomial.
 
 BezierCurveN (Bezier x, Bezier y)
 Construct from two 1D Bezier polynomials of the same order.
 
 BezierCurveN (std::vector< Point > const &points)
 Construct a Bezier curve from a vector of its control points.
 
 BezierCurveN (Point c0, Point c1)
 Construct a linear segment from its endpoints.
 
 BezierCurveN (Point c0, Point c1, Point c2)
 Construct a quadratic Bezier curve from its control points.
 
 BezierCurveN (Point c0, Point c1, Point c2, Point c3)
 Construct a cubic Bezier curve from its control points.
 
- Public Member Functions inherited from Geom::BezierCurve
 BezierCurve (D2< Bezier > const &b)
 
Point initialPoint () const override
 Retrieve the start of the curve.
 
Point finalPoint () const override
 Retrieve the end of the curve.
 
void setInitial (Point const &v) override
 Change the starting point of the curve.
 
void setFinal (Point const &v) override
 Change the ending point of the curve.
 
Rect boundsFast () const override
 Quickly compute the curve's approximate bounding box.
 
Rect boundsExact () const override
 Compute the curve's exact bounding box.
 
OptRect boundsLocal (OptInterval const &i, unsigned deg) const override
 
void operator*= (Translate const &tr) override
 
void operator*= (Scale const &s) override
 
void operator*= (Affine const &m) override
 
int degreesOfFreedom () const override
 Return the number of independent parameters required to represent all variations of this curve.
 
std::vector< Coordroots (Coord v, Dim2 d) const override
 Computes time values at which the curve intersects an axis-aligned line.
 
Coord length (Coord tolerance) const override
 Compute the arc length of this curve.
 
Point pointAt (Coord t) const override
 Evaluate the curve at a specified time value.
 
std::vector< PointpointAndDerivatives (Coord t, unsigned n) const override
 Evaluate the curve and its derivatives.
 
Coord valueAt (Coord t, Dim2 d) const override
 Evaluate one of the coordinates at the specified time value.
 
D2< SBasistoSBasis () const override
 Convert the curve to a symmetric power basis polynomial.
 
bool isNear (Curve const &c, Coord precision) const override
 Test whether two curves are approximately the same.
 
std::vector< CoordtimesWithRadiusOfCurvature (double radius) const
 Computes the times where the radius of curvature of the bezier curve equals the given radius.
 
virtual void operator*= (Translate const &tr)
 
virtual void operator*= (Scale const &s)
 
virtual void operator*= (Rotate const &r)
 
virtual void operator*= (HShear const &hs)
 
virtual void operator*= (VShear const &vs)
 
virtual void operator*= (Zoom const &z)
 
virtual void operator*= (Affine const &m)=0
 
unsigned order () const
 Get the order of the Bezier curve.
 
unsigned size () const
 Get the number of control points.
 
Point controlPoint (unsigned ix) const
 Access control points of the curve.
 
Point operator[] (unsigned ix) const
 
std::vector< PointcontrolPoints () const
 Get the control points.
 
D2< Bezier > const & fragment () const
 
void setPoint (unsigned ix, Point const &v)
 Modify a control point.
 
virtual void setPoints (std::vector< Point > const &ps)
 Set new control points.
 
- Public Member Functions inherited from Geom::Curve
virtual ~Curve ()
 
virtual Interval timeRange () const
 Get the interval of allowed time values.
 
virtual Point operator() (Coord t) const
 Evaluate the function at the specified time value.
 
OptRect boundsLocal (OptInterval const &a) const
 Compute the bounding box of a part of the curve.
 
void transform (Affine const &m)
 Transform this curve by an affine transformation.
 
virtual Curvetransformed (Affine const &m) const
 Create a curve transformed by an affine transformation.
 
Curveportion (Interval const &i) const
 A version of that accepts an Interval.
 
Coord nearestTime (Point const &p, Interval const &i) const
 A version that takes an Interval.
 
virtual std::vector< CoordallNearestTimes (Point const &p, Coord from=0, Coord to=1) const
 Compute time values at which the curve comes closest to a specified point.
 
std::vector< CoordallNearestTimes (Point const &p, Interval const &i)
 A version that takes an Interval.
 
virtual std::vector< CurveIntersectionintersectSelf (Coord eps=EPSILON) const
 Compute intersections of this curve with itself.
 
virtual Point unitTangentAt (Coord t, unsigned n=3) const
 Compute a vector tangent to the curve.
 
bool operator== (Curve const &c) const
 Test equality of two curves.
 

Static Private Member Functions

template<unsigned required_degree>
static void assert_degree (BezierCurveN< required_degree > const *)
 

Additional Inherited Members

- Static Public Member Functions inherited from Geom::BezierCurve
static BezierCurvecreate (std::vector< Point > const &pts)
 Construct a curve from a vector of control points.
 
- Protected Member Functions inherited from Geom::BezierCurve
 BezierCurve ()
 
 BezierCurve (Bezier const &x, Bezier const &y)
 
 BezierCurve (std::vector< Point > const &pts)
 
bool _equalTo (Curve const &c) const override
 
- Protected Attributes inherited from Geom::BezierCurve
D2< Bezierinner
 

Detailed Description

template<unsigned degree>
class Geom::BezierCurveN< degree >

Bezier curve with compile-time specified order.

Template Parameters
degreeunsigned value indicating the order of the Bezier curve

Definition at line 179 of file bezier-curve.h.

Constructor & Destructor Documentation

◆ BezierCurveN() [1/7]

template<unsigned degree>
Geom::BezierCurveN< degree >::BezierCurveN ( )
inline

◆ BezierCurveN() [2/7]

template<unsigned degree>
Geom::BezierCurveN< degree >::BezierCurveN ( D2< Bezier > const &  x)
inlineexplicit

Construct from 2D Bezier polynomial.

Definition at line 194 of file bezier-curve.h.

References Geom::BezierCurve::inner.

◆ BezierCurveN() [3/7]

template<unsigned degree>
Geom::BezierCurveN< degree >::BezierCurveN ( Bezier  x,
Bezier  y 
)
inline

Construct from two 1D Bezier polynomials of the same order.

Definition at line 199 of file bezier-curve.h.

References Geom::BezierCurve::inner.

◆ BezierCurveN() [4/7]

template<unsigned degree>
Geom::BezierCurveN< degree >::BezierCurveN ( std::vector< Point > const &  points)
inline

Construct a Bezier curve from a vector of its control points.

Definition at line 204 of file bezier-curve.h.

References degree, and Geom::BezierCurve::inner.

◆ BezierCurveN() [5/7]

template<unsigned degree>
Geom::BezierCurveN< degree >::BezierCurveN ( Point  c0,
Point  c1 
)
inline

Construct a linear segment from its endpoints.

Definition at line 215 of file bezier-curve.h.

References Geom::BezierCurve::inner.

◆ BezierCurveN() [6/7]

template<unsigned degree>
Geom::BezierCurveN< degree >::BezierCurveN ( Point  c0,
Point  c1,
Point  c2 
)
inline

Construct a quadratic Bezier curve from its control points.

Definition at line 222 of file bezier-curve.h.

References Geom::BezierCurve::inner.

◆ BezierCurveN() [7/7]

template<unsigned degree>
Geom::BezierCurveN< degree >::BezierCurveN ( Point  c0,
Point  c1,
Point  c2,
Point  c3 
)
inline

Construct a cubic Bezier curve from its control points.

Definition at line 229 of file bezier-curve.h.

References Geom::BezierCurve::inner.

Member Function Documentation

◆ assert_degree()

template<unsigned degree>
template<unsigned required_degree>
static void Geom::BezierCurveN< degree >::assert_degree ( BezierCurveN< required_degree > const *  )
inlinestaticprivate

Definition at line 183 of file bezier-curve.h.

◆ derivative() [1/3]

Curve * Geom::BezierCurveN< 1 >::derivative ( ) const
virtual

Create a derivative of this curve.

It's best to think of the derivative in physical terms: if the curve describes the position of some object on the plane from time \(t=0\) to \(t=1\) as said in the introduction, then the curve's derivative describes that object's speed at the same times. The second derivative refers to its acceleration, the third to jerk, etc.

Returns
New curve \(\mathbf{D} = \mathbf{C}'\).

Reimplemented from Geom::BezierCurve.

◆ derivative() [2/3]

Curve * Geom::BezierCurveN< 1 >::derivative ( ) const
virtual

Create a derivative of this curve.

It's best to think of the derivative in physical terms: if the curve describes the position of some object on the plane from time \(t=0\) to \(t=1\) as said in the introduction, then the curve's derivative describes that object's speed at the same times. The second derivative refers to its acceleration, the third to jerk, etc.

Returns
New curve \(\mathbf{D} = \mathbf{C}'\).

Reimplemented from Geom::BezierCurve.

Definition at line 370 of file bezier-curve.cpp.

References inner(), Geom::X, and Geom::Y.

◆ derivative() [3/3]

template<unsigned degree>
Curve * Geom::BezierCurveN< degree >::derivative ( ) const
inlineoverridevirtual

Create a derivative of this curve.

It's best to think of the derivative in physical terms: if the curve describes the position of some object on the plane from time \(t=0\) to \(t=1\) as said in the introduction, then the curve's derivative describes that object's speed at the same times. The second derivative refers to its acceleration, the third to jerk, etc.

Returns
New curve \(\mathbf{D} = \mathbf{C}'\).

Reimplemented from Geom::BezierCurve.

Definition at line 322 of file bezier-curve.h.

References degree, Geom::derivative(), inner(), Geom::X, and Geom::Y.

Referenced by Geom::EllipticalArc::derivative().

◆ duplicate()

template<unsigned degree>
Curve * Geom::BezierCurveN< degree >::duplicate ( ) const
inlineoverridevirtual

Create an exact copy of this curve.

Returns
Pointer to a newly allocated curve, identical to the original

Reimplemented from Geom::BezierCurve.

Reimplemented in Geom::Path::ClosingSegment, and Geom::Path::StitchSegment.

Definition at line 264 of file bezier-curve.h.

References Geom::BezierCurveN< degree >::BezierCurveN().

◆ expandToTransformed() [1/7]

void Geom::BezierCurveN< 1 >::expandToTransformed ( Rect bbox,
Affine const &  transform 
) const
virtual

Expand the given rectangle to include the transformed curve, assuming it already contains its initial point.

Parameters
bbox[in,out]bbox The rectangle to expand; it is assumed to already contain (initialPoint() * transform).
transformThe transform to apply to the curve before taking its bounding box.

Reimplemented from Geom::BezierCurve.

◆ expandToTransformed() [2/7]

void Geom::BezierCurveN< 2 >::expandToTransformed ( Rect bbox,
Affine const &  transform 
) const
virtual

Expand the given rectangle to include the transformed curve, assuming it already contains its initial point.

Parameters
bbox[in,out]bbox The rectangle to expand; it is assumed to already contain (initialPoint() * transform).
transformThe transform to apply to the curve before taking its bounding box.

Reimplemented from Geom::BezierCurve.

◆ expandToTransformed() [3/7]

void Geom::BezierCurveN< 3 >::expandToTransformed ( Rect bbox,
Affine const &  transform 
) const
virtual

Expand the given rectangle to include the transformed curve, assuming it already contains its initial point.

Parameters
bbox[in,out]bbox The rectangle to expand; it is assumed to already contain (initialPoint() * transform).
transformThe transform to apply to the curve before taking its bounding box.

Reimplemented from Geom::BezierCurve.

◆ expandToTransformed() [4/7]

void Geom::BezierCurveN< 1 >::expandToTransformed ( Rect bbox,
Affine const &  transform 
) const
virtual

Expand the given rectangle to include the transformed curve, assuming it already contains its initial point.

Parameters
bbox[in,out]bbox The rectangle to expand; it is assumed to already contain (initialPoint() * transform).
transformThe transform to apply to the curve before taking its bounding box.

Reimplemented from Geom::BezierCurve.

Definition at line 643 of file bezier-curve.cpp.

References Geom::GenericRect< C >::expandTo().

◆ expandToTransformed() [5/7]

void Geom::BezierCurveN< 2 >::expandToTransformed ( Rect bbox,
Affine const &  transform 
) const
virtual

Expand the given rectangle to include the transformed curve, assuming it already contains its initial point.

Parameters
bbox[in,out]bbox The rectangle to expand; it is assumed to already contain (initialPoint() * transform).
transformThe transform to apply to the curve before taking its bounding box.

Reimplemented from Geom::BezierCurve.

Definition at line 649 of file bezier-curve.cpp.

References Geom::bezier_expand_to_image().

◆ expandToTransformed() [6/7]

void Geom::BezierCurveN< 3 >::expandToTransformed ( Rect bbox,
Affine const &  transform 
) const
virtual

Expand the given rectangle to include the transformed curve, assuming it already contains its initial point.

Parameters
bbox[in,out]bbox The rectangle to expand; it is assumed to already contain (initialPoint() * transform).
transformThe transform to apply to the curve before taking its bounding box.

Reimplemented from Geom::BezierCurve.

Definition at line 657 of file bezier-curve.cpp.

References Geom::bezier_expand_to_image().

◆ expandToTransformed() [7/7]

template<unsigned degree>
void Geom::BezierCurveN< degree >::expandToTransformed ( Rect bbox,
Affine const &  transform 
) const
inlineoverridevirtual

Expand the given rectangle to include the transformed curve, assuming it already contains its initial point.

Parameters
bbox[in,out]bbox The rectangle to expand; it is assumed to already contain (initialPoint() * transform).
transformThe transform to apply to the curve before taking its bounding box.

Reimplemented from Geom::BezierCurve.

Definition at line 297 of file bezier-curve.h.

References Geom::BezierCurve::expandToTransformed(), and Geom::Curve::transform().

◆ feed() [1/7]

void Geom::BezierCurveN< 1 >::feed ( PathSink sink,
bool  moveto_initial 
) const
virtual

Feed the curve to a PathSink.

Reimplemented from Geom::BezierCurve.

◆ feed() [2/7]

void Geom::BezierCurveN< 2 >::feed ( PathSink sink,
bool  moveto_initial 
) const
virtual

Feed the curve to a PathSink.

Reimplemented from Geom::BezierCurve.

◆ feed() [3/7]

void Geom::BezierCurveN< 3 >::feed ( PathSink sink,
bool  moveto_initial 
) const
virtual

Feed the curve to a PathSink.

Reimplemented from Geom::BezierCurve.

◆ feed() [4/7]

void Geom::BezierCurveN< 1 >::feed ( PathSink sink,
bool  moveto_initial 
) const
virtual

Feed the curve to a PathSink.

Reimplemented from Geom::BezierCurve.

Definition at line 602 of file bezier-curve.cpp.

References Geom::PathSink::lineTo(), and Geom::PathSink::moveTo().

◆ feed() [5/7]

void Geom::BezierCurveN< 2 >::feed ( PathSink sink,
bool  moveto_initial 
) const
virtual

Feed the curve to a PathSink.

Reimplemented from Geom::BezierCurve.

Definition at line 611 of file bezier-curve.cpp.

References Geom::PathSink::moveTo(), and Geom::PathSink::quadTo().

◆ feed() [6/7]

void Geom::BezierCurveN< 3 >::feed ( PathSink sink,
bool  moveto_initial 
) const
virtual

Feed the curve to a PathSink.

Reimplemented from Geom::BezierCurve.

Definition at line 620 of file bezier-curve.cpp.

References Geom::PathSink::curveTo(), and Geom::PathSink::moveTo().

◆ feed() [7/7]

template<unsigned degree>
void Geom::BezierCurveN< degree >::feed ( PathSink sink,
bool  moveto_initial 
) const
inlineoverridevirtual

Feed the curve to a PathSink.

Reimplemented from Geom::BezierCurve.

Definition at line 293 of file bezier-curve.h.

References Geom::BezierCurve::feed().

◆ intersect() [1/7]

std::vector< CurveIntersection > Geom::BezierCurveN< 1 >::intersect ( Curve const &  other,
Coord  eps 
) const
virtual

Compute intersections with another curve.

Reimplemented from Geom::BezierCurve.

◆ intersect() [2/7]

std::vector< CurveIntersection > Geom::BezierCurveN< 2 >::intersect ( Curve const &  other,
Coord  eps 
) const
virtual

Compute intersections with another curve.

Reimplemented from Geom::BezierCurve.

◆ intersect() [3/7]

std::vector< CurveIntersection > Geom::BezierCurveN< 3 >::intersect ( Curve const &  other,
Coord  eps 
) const
virtual

Compute intersections with another curve.

Reimplemented from Geom::BezierCurve.

◆ intersect() [4/7]

std::vector< CurveIntersection > Geom::BezierCurveN< 1 >::intersect ( Curve const &  other,
Coord  eps 
) const
virtual

Compute intersections with another curve.

Filter out candidate times outside of the interval [0, 1] fuzzed so as to accommodate for epsilon.

Reimplemented from Geom::BezierCurve.

Definition at line 399 of file bezier-curve.cpp.

References Geom::cross(), Geom::distance(), Geom::dot(), Geom::Curve::finalPoint(), Geom::infinity(), Geom::Curve::initialPoint(), Geom::Curve::intersect(), Geom::Curve::isLineSegment(), Geom::Point::isZero(), len, Geom::Point::length(), Geom::middle_point(), Geom::Point::normalized(), Geom::Curve::pointAt(), result, Geom::transpose_in_place(), and w.

◆ intersect() [5/7]

std::vector< CurveIntersection > Geom::BezierCurveN< 2 >::intersect ( Curve const &  other,
Coord  eps 
) const
virtual

Compute intersections with another curve.

Reimplemented from Geom::BezierCurve.

Definition at line 556 of file bezier-curve.cpp.

References Geom::BezierCurve::intersect().

◆ intersect() [6/7]

std::vector< CurveIntersection > Geom::BezierCurveN< 3 >::intersect ( Curve const &  other,
Coord  eps 
) const
virtual

Compute intersections with another curve.

Reimplemented from Geom::BezierCurve.

Definition at line 572 of file bezier-curve.cpp.

References Geom::BezierCurve::intersect().

◆ intersect() [7/7]

template<unsigned degree>
std::vector< CurveIntersection > Geom::BezierCurveN< degree >::intersect ( Curve const &  other,
Coord  eps = EPSILON 
) const
inlineoverridevirtual

Compute intersections with another curve.

Reimplemented from Geom::BezierCurve.

Definition at line 286 of file bezier-curve.h.

References Geom::BezierCurve::intersect().

Referenced by Geom::BezierCurve::intersect(), Geom::EllipticalArc::intersect(), TEST(), TEST(), TEST(), TEST(), and TEST_F().

◆ isDegenerate() [1/2]

bool Geom::BezierCurveN< 1 >::isDegenerate ( ) const
inlinevirtual

Check whether the curve has exactly zero length.

Returns
True if the curve's initial point is exactly the same as its final point, and it contains no other points (its value set contains only one element).

Reimplemented from Geom::BezierCurve.

Definition at line 327 of file bezier-curve.h.

References inner(), Geom::X, and Geom::Y.

◆ isDegenerate() [2/2]

template<unsigned degree>
bool Geom::BezierCurveN< degree >::isDegenerate ( ) const
inlineoverridevirtual

Check whether the curve has exactly zero length.

Returns
True if the curve's initial point is exactly the same as its final point, and it contains no other points (its value set contains only one element).

Reimplemented from Geom::BezierCurve.

Definition at line 252 of file bezier-curve.h.

References Geom::BezierCurve::isDegenerate().

Referenced by Geom::Path::_includesClosingSegment(), Geom::Path::back_closed(), Geom::Path::size_closed(), and sp_gradient_reset_to_userspace().

◆ isLineSegment() [1/2]

bool Geom::BezierCurveN< 1 >::isLineSegment ( ) const
inlinevirtual

Return false if there are at least 3 distinct control points, true otherwise.

Reimplemented from Geom::BezierCurve.

Definition at line 330 of file bezier-curve.h.

◆ isLineSegment() [2/2]

template<unsigned degree>
bool Geom::BezierCurveN< degree >::isLineSegment ( ) const
inlineoverridevirtual

Return false if there are at least 3 distinct control points, true otherwise.

Reimplemented from Geom::BezierCurve.

Definition at line 256 of file bezier-curve.h.

References degree, and Geom::BezierCurve::isLineSegment().

◆ nearestTime() [1/3]

Coord Geom::BezierCurveN< 1 >::nearestTime ( Point const &  p,
Coord  a,
Coord  b 
) const
virtual

Compute a time value at which the curve comes closest to a specified point.

The first value with the smallest distance is returned if there are multiple such points.

Parameters
pQuery point
aMinimum time value to consider
bMaximum time value to consider; \(a < b\)
Returns
\(q \in [a, b]: ||\mathbf{C}(q) - \mathbf{p}|| = \inf(\{r \in \mathbb{R} : ||\mathbf{C}(r) - \mathbf{p}||\})\)

Reimplemented from Geom::BezierCurve.

◆ nearestTime() [2/3]

Coord Geom::BezierCurveN< 1 >::nearestTime ( Point const &  p,
Coord  a,
Coord  b 
) const
virtual

Compute a time value at which the curve comes closest to a specified point.

The first value with the smallest distance is returned if there are multiple such points.

Parameters
pQuery point
aMinimum time value to consider
bMaximum time value to consider; \(a < b\)
Returns
\(q \in [a, b]: ||\mathbf{C}(q) - \mathbf{p}|| = \inf(\{r \in \mathbb{R} : ||\mathbf{C}(r) - \mathbf{p}||\})\)

Reimplemented from Geom::BezierCurve.

Definition at line 376 of file bezier-curve.cpp.

References Geom::dot().

◆ nearestTime() [3/3]

template<unsigned degree>
Coord Geom::BezierCurveN< degree >::nearestTime ( Point const &  p,
Coord  a = 0,
Coord  b = 1 
) const
inlineoverridevirtual

Compute a time value at which the curve comes closest to a specified point.

The first value with the smallest distance is returned if there are multiple such points.

Parameters
pQuery point
aMinimum time value to consider
bMaximum time value to consider; \(a < b\)
Returns
\(q \in [a, b]: ||\mathbf{C}(q) - \mathbf{p}|| = \inf(\{r \in \mathbb{R} : ||\mathbf{C}(r) - \mathbf{p}||\})\)

Reimplemented from Geom::BezierCurve.

Definition at line 283 of file bezier-curve.h.

References Geom::BezierCurve::nearestTime().

Referenced by GrDrag::addStopNearPoint(), Geom::EllipticalArc::allNearestTimes(), Geom::distance(), Inkscape::distance_to_segment(), gr_knot_moved_midpoint_handler(), RectHandle::hit(), GrDrag::selected_move(), and sp_item_gradient_set_coords().

◆ portion()

template<unsigned degree>
Curve * Geom::BezierCurveN< degree >::portion ( Coord  a,
Coord  b 
) const
inlineoverridevirtual

Create a curve that corresponds to a part of this curve.

For \(a > b\), the returned portion will be reversed with respect to the original. The returned curve will always be of the same type.

Parameters
aBeginning of the interval specifying the portion of the curve
bEnd of the interval
Returns
New curve \(\mathbf{D}\) such that:
  • \(\mathbf{D}(0) = \mathbf{C}(a)\)
  • \(\mathbf{D}(1) = \mathbf{C}(b)\)
  • \(\mathbf{D}[ [0, 1] ] = \mathbf{C}[ [a?b] ]\), where \([a?b] = [\min(a, b), \max(a, b)]\)

Reimplemented from Geom::BezierCurve.

Definition at line 267 of file bezier-curve.h.

References Geom::BezierCurveN< degree >::BezierCurveN(), degree, Geom::BezierCurve::inner, Geom::BezierCurve::pointAt(), and Geom::portion().

◆ reverse()

template<unsigned degree>
Curve * Geom::BezierCurveN< degree >::reverse ( ) const
inlineoverridevirtual

Create a reversed version of this curve.

The result corresponds to portion(1, 0), but this method might be faster.

Returns
Pointer to a new curve \(\mathbf{D}\) such that \(\forall_{x \in [0, 1]} \mathbf{D}(x) = \mathbf{C}(1-x)\)

Reimplemented from Geom::BezierCurve.

Reimplemented in Geom::Path::ClosingSegment, and Geom::Path::StitchSegment.

Definition at line 274 of file bezier-curve.h.

References Geom::BezierCurveN< degree >::BezierCurveN(), degree, Geom::BezierCurve::finalPoint(), Geom::BezierCurve::initialPoint(), Geom::BezierCurve::inner, and Geom::reverse().

◆ subdivide()

template<unsigned degree>
std::pair< BezierCurveN, BezierCurveN > Geom::BezierCurveN< degree >::subdivide ( Coord  t) const
inline

Divide a Bezier curve into two curves.

Parameters
tTime value
Returns
Pair of Bezier curves \((\mathbf{D}, \mathbf{E})\) such that \(\mathbf{D}[ [0,1] ] = \mathbf{C}[ [0,t] ]\) and \(\mathbf{E}[ [0,1] ] = \mathbf{C}[ [t,1] ]\)

Definition at line 245 of file bezier-curve.h.

References Geom::BezierCurveN< degree >::BezierCurveN(), Geom::BezierCurve::inner, Geom::X, and Geom::Y.

Referenced by Inkscape::LivePathEffect::LPERoughen::addNodesAndJitter(), Inkscape::LivePathEffect::path_from_piecewise_fix_cusps(), and Inkscape::UI::PathManipulator::subdivideSegment().

◆ winding() [1/3]

int Geom::BezierCurveN< 1 >::winding ( Point const &  p) const
virtual

Compute the partial winding number of this curve.

The partial winding number is equal to the difference between the number of roots at which the curve goes in the +Y direction and the number of roots at which the curve goes in the -Y direction. This method is mainly useful for implementing path winding calculation. It will ignore roots which are local maxima on the Y axis.

Parameters
pPoint where the winding number should be determined
Returns
Winding number contribution at p

Reimplemented from Geom::Curve.

◆ winding() [2/3]

int Geom::BezierCurveN< 1 >::winding ( Point const &  p) const
virtual

Compute the partial winding number of this curve.

The partial winding number is equal to the difference between the number of roots at which the curve goes in the +Y direction and the number of roots at which the curve goes in the -Y direction. This method is mainly useful for implementing path winding calculation. It will ignore roots which are local maxima on the Y axis.

Parameters
pPoint where the winding number should be determined
Returns
Winding number contribution at p

Reimplemented from Geom::Curve.

Definition at line 585 of file bezier-curve.cpp.

References inner(), Geom::lerp(), Geom::X, and Geom::Y.

◆ winding() [3/3]

template<unsigned degree>
int Geom::BezierCurveN< degree >::winding ( Point const &  p) const
inlineoverridevirtual

Compute the partial winding number of this curve.

The partial winding number is equal to the difference between the number of roots at which the curve goes in the +Y direction and the number of roots at which the curve goes in the -Y direction. This method is mainly useful for implementing path winding calculation. It will ignore roots which are local maxima on the Y axis.

Parameters
pPoint where the winding number should be determined
Returns
Winding number contribution at p

Reimplemented from Geom::Curve.

Definition at line 290 of file bezier-curve.h.

References Geom::Curve::winding().


The documentation for this class was generated from the following file: