Inkscape
Vector Graphics Editor
|
Abstract continuous curve on a plane defined on [0,1]. More...
#include <curve.h>
Public Member Functions | |
virtual | ~Curve () |
Evaluate the curve | |
virtual Point | initialPoint () const =0 |
Retrieve the start of the curve. | |
virtual Point | finalPoint () const =0 |
Retrieve the end of the curve. | |
virtual bool | isDegenerate () const =0 |
Check whether the curve has exactly zero length. | |
virtual bool | isLineSegment () const |
Check whether the curve is a line segment. | |
virtual Interval | timeRange () const |
Get the interval of allowed time values. | |
virtual Point | pointAt (Coord t) const |
Evaluate the curve at a specified time value. | |
virtual Coord | valueAt (Coord t, Dim2 d) const |
Evaluate one of the coordinates at the specified time value. | |
virtual Point | operator() (Coord t) const |
Evaluate the function at the specified time value. | |
virtual std::vector< Point > | pointAndDerivatives (Coord t, unsigned n) const =0 |
Evaluate the curve and its derivatives. | |
Change the curve's endpoints | |
virtual void | setInitial (Point const &v)=0 |
Change the starting point of the curve. | |
virtual void | setFinal (Point const &v)=0 |
Change the ending point of the curve. | |
Compute the bounding box | |
virtual Rect | boundsFast () const =0 |
Quickly compute the curve's approximate bounding box. | |
virtual Rect | boundsExact () const =0 |
Compute the curve's exact bounding box. | |
virtual void | expandToTransformed (Rect &bbox, Affine const &transform) const =0 |
Expand the given rectangle to include the transformed curve, assuming it already contains its initial point. | |
virtual OptRect | boundsLocal (OptInterval const &i, unsigned deg) const =0 |
OptRect | boundsLocal (OptInterval const &a) const |
Compute the bounding box of a part of the curve. | |
Create new curves based on this one | |
virtual Curve * | duplicate () const =0 |
Create an exact copy of this curve. | |
void | transform (Affine const &m) |
Transform this curve by an affine transformation. | |
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 |
virtual Curve * | transformed (Affine const &m) const |
Create a curve transformed by an affine transformation. | |
virtual Curve * | portion (Coord a, Coord b) const =0 |
Create a curve that corresponds to a part of this curve. | |
Curve * | portion (Interval const &i) const |
A version of that accepts an Interval. | |
virtual Curve * | reverse () const |
Create a reversed version of this curve. | |
virtual Curve * | derivative () const =0 |
Create a derivative of this curve. | |
Advanced operations | |
virtual Coord | nearestTime (Point const &p, Coord a=0, Coord b=1) const |
Compute a time value at which the curve comes closest to a specified point. | |
Coord | nearestTime (Point const &p, Interval const &i) const |
A version that takes an Interval. | |
virtual std::vector< Coord > | allNearestTimes (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< Coord > | allNearestTimes (Point const &p, Interval const &i) |
A version that takes an Interval. | |
virtual Coord | length (Coord tolerance=0.01) const |
Compute the arc length of this curve. | |
virtual std::vector< Coord > | roots (Coord v, Dim2 d) const =0 |
Computes time values at which the curve intersects an axis-aligned line. | |
virtual int | winding (Point const &p) const |
Compute the partial winding number of this curve. | |
virtual std::vector< CurveIntersection > | intersect (Curve const &other, Coord eps=EPSILON) const |
Compute intersections with another curve. | |
virtual std::vector< CurveIntersection > | intersectSelf (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. | |
virtual D2< SBasis > | toSBasis () const =0 |
Convert the curve to a symmetric power basis polynomial. | |
Miscellaneous | |
virtual int | degreesOfFreedom () const |
Return the number of independent parameters required to represent all variations of this curve. | |
bool | operator== (Curve const &c) const |
Test equality of two curves. | |
virtual bool | isNear (Curve const &c, Coord precision) const =0 |
Test whether two curves are approximately the same. | |
virtual void | feed (PathSink &sink, bool moveto_initial) const |
Feed the curve to a PathSink. | |
Protected Member Functions | |
virtual bool | _equalTo (Curve const &c) const =0 |
Abstract continuous curve on a plane defined on [0,1].
Formally, a curve in 2Geom is defined as a function \(\mathbf{C}: [0, 1] \to \mathbb{R}^2\) (a function that maps the unit interval to points on a 2D plane). Its image (the set of points the curve passes through) will be denoted \(\mathcal{C} = \mathbf{C}[ [0, 1] ]\). All curve types available in 2Geom are continuous and differentiable on their interior, e.g. \((0, 1)\). Sometimes the curve's image (value set) is referred to as the curve itself for simplicity, but keep in mind that it's not strictly correct.
It is common to think of the parameter as time. The curve can then be interpreted as describing the position of some moving object from time \(t=0\) to \(t=1\). Because of this, the parameter is frequently called the time value.
Some methods return pointers to newly allocated curves. They are expected to be freed by the caller when no longer used. Default implementations are provided for some methods.
|
protectedpure virtual |
Implemented in Geom::BezierCurve, Geom::EllipticalArc, and Geom::SBasisCurve.
Referenced by operator==().
|
virtual |
Compute time values at which the curve comes closest to a specified point.
p | Query point |
a | Minimum time value to consider |
b | Maximum time value to consider; \(a < b\) |
Reimplemented in Geom::SBasisCurve, and Geom::EllipticalArc.
Definition at line 51 of file curve.cpp.
References Geom::all_nearest_times(), and toSBasis().
Referenced by allNearestTimes().
A version that takes an Interval.
Definition at line 270 of file curve.h.
References allNearestTimes(), Geom::GenericInterval< C >::max(), and Geom::GenericInterval< C >::min().
|
pure virtual |
Compute the curve's exact bounding box.
This method can be dramatically slower than boundsFast() depending on the curve type.
Implemented in Geom::BezierCurve, Geom::EllipticalArc, and Geom::SBasisCurve.
Referenced by Geom::Path::boundsExact().
|
pure virtual |
Quickly compute the curve's approximate bounding box.
The resulting rectangle is guaranteed to contain all points belonging to the curve, but it might not be the smallest such rectangle. This method is usually fast.
Implemented in Geom::BezierCurve, Geom::EllipticalArc, and Geom::SBasisCurve.
Referenced by Geom::Path::boundsFast().
|
inline |
Compute the bounding box of a part of the curve.
Since this method returns the smallest possible bounding rectangle of the specified portion, it can also be rather slow.
a | An interval specifying a part of the curve, or nothing. If \([0, 1] \subseteq a\), then the bounding box for the entire curve is calculated. |
Definition at line 180 of file curve.h.
References boundsLocal().
Referenced by boundsLocal().
|
pure virtual |
Implemented in Geom::BezierCurve, and Geom::SBasisCurve.
Referenced by Geom::pair_intersect().
|
inlinevirtual |
Return the number of independent parameters required to represent all variations of this curve.
For example, for Bezier curves it returns the curve's order multiplied by 2.
Reimplemented in Geom::BezierCurve, Geom::EllipticalArc, and Geom::SBasisCurve.
|
pure 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.
Implemented in Geom::BezierCurveN< degree >, Geom::BezierCurveN< 1 >, Geom::BezierCurveN< degree >, Geom::BezierCurveN< 1 >, Geom::BezierCurve, Geom::BezierCurveN< degree >, Geom::BezierCurveN< 1 >, Geom::EllipticalArc, and Geom::SBasisCurve.
Referenced by Geom::curve_mono_splits(), and intersectSelf().
|
pure virtual |
Create an exact copy of this curve.
Implemented in Geom::BezierCurve, Geom::BezierCurveN< degree >, Geom::BezierCurveN< 1 >, Geom::EllipticalArc, Geom::Path::ClosingSegment, Geom::Path::StitchSegment, and Geom::SBasisCurve.
Referenced by Inkscape::LivePathEffect::LPERoughen::doEffect(), Geom::new_clone(), and transformed().
|
pure virtual |
Expand the given rectangle to include the transformed curve, assuming it already contains its initial point.
bbox[in,out] | bbox The rectangle to expand; it is assumed to already contain (initialPoint() * transform). |
transform | The transform to apply to the curve before taking its bounding box. |
Implemented in Geom::BezierCurveN< degree >, Geom::BezierCurveN< 1 >, Geom::BezierCurveN< degree >, Geom::BezierCurveN< 1 >, Geom::BezierCurveN< degree >, Geom::BezierCurveN< 1 >, Geom::BezierCurveN< degree >, Geom::BezierCurveN< 1 >, Geom::BezierCurveN< degree >, Geom::BezierCurveN< 1 >, Geom::BezierCurveN< degree >, Geom::BezierCurveN< 1 >, Geom::BezierCurve, Geom::BezierCurveN< degree >, Geom::BezierCurveN< 1 >, Geom::EllipticalArc, and Geom::SBasisCurve.
|
virtual |
Feed the curve to a PathSink.
Reimplemented in Geom::BezierCurveN< degree >, Geom::BezierCurveN< 1 >, Geom::BezierCurveN< degree >, Geom::BezierCurveN< 1 >, Geom::BezierCurveN< degree >, Geom::BezierCurveN< 1 >, Geom::BezierCurveN< degree >, Geom::BezierCurveN< 1 >, Geom::BezierCurveN< degree >, Geom::BezierCurveN< 1 >, Geom::BezierCurveN< degree >, Geom::BezierCurveN< 1 >, Geom::BezierCurveN< degree >, Geom::BezierCurveN< 1 >, Geom::EllipticalArc, and Geom::BezierCurve.
Definition at line 214 of file curve.cpp.
References Geom::PathSink::curveTo(), initialPoint(), Geom::PathSink::moveTo(), Geom::sbasis_to_bezier(), and toSBasis().
Referenced by Geom::BezierCurve::feed().
|
pure virtual |
Retrieve the end of the curve.
Implemented in Geom::BezierCurve, Geom::EllipticalArc, and Geom::SBasisCurve.
Referenced by Inkscape::UI::Tools::PenTool::_bsplineSpiroOff(), Inkscape::UI::Tools::PenTool::_bsplineSpiroOn(), Inkscape::UI::Tools::PencilTool::_fitAndSplit(), Inkscape::UI::Tools::PencilTool::_interpolate(), Inkscape::UI::Tools::PencilTool::_sketchInterpolate(), Inkscape::UI::Tools::PenTool::_undoLastPoint(), Inkscape::UI::Tools::CalligraphicTool::accumulate(), Inkscape::LivePathEffect::LPERoughen::addNodesAndJitter(), Inkscape::LivePathEffect::LPEMeasureSegments::doBeforeEffect(), Inkscape::LivePathEffect::LPEBSpline::doBSplineFromWidget(), Inkscape::LivePathEffect::LPEPerspectiveEnvelope::doEffect(), Inkscape::LivePathEffect::LPERoughen::doEffect(), Inkscape::LivePathEffect::LPECopyRotate::doEffect_path(), Inkscape::LivePathEffect::LPEDashedStroke::doEffect_path(), Inkscape::LivePathEffect::LPEFilletChamfer::doEffect_path(), Inkscape::LivePathEffect::LPEMirrorSymmetry::doEffect_path(), Inkscape::LivePathEffect::LPEShowHandles::generateHelperPath(), Inkscape::LivePathEffect::LPESimplify::generateHelperPathAndSmooth(), Inkscape::half_outline(), Geom::BezierCurveN< degree >::intersect(), Geom::EllipticalArc::intersect(), Inkscape::LivePathEffect::LPERoughen::jitter(), Inkscape::LivePathEffect::FilletChamferKnotHolderEntity::knot_get(), SPCurve::nodes_in_path(), Inkscape::LivePathEffect::size_nondegenerate(), Inkscape::LivePathEffect::sp_bspline_do_effect(), and Inkscape::LivePathEffect::LPESlice::splititem().
|
pure virtual |
Retrieve the start of the curve.
Implemented in Geom::BezierCurve, Geom::EllipticalArc, and Geom::SBasisCurve.
Referenced by Inkscape::UI::Tools::PenTool::_bsplineSpiroEndAnchorOff(), Inkscape::UI::Tools::PenTool::_bsplineSpiroEndAnchorOn(), Inkscape::UI::Tools::PenTool::_bsplineSpiroMotion(), Inkscape::UI::Tools::PenTool::_lastpointToCurve(), Inkscape::UI::Tools::PenTool::_undoLastPoint(), Inkscape::UI::Tools::CalligraphicTool::accumulate(), Inkscape::LivePathEffect::LPERoughen::addNodesAndJitter(), Inkscape::LivePathEffect::LPEFilletChamfer::doBeforeEffect(), Inkscape::LivePathEffect::LPEMeasureSegments::doBeforeEffect(), Inkscape::LivePathEffect::LPEBSpline::doBSplineFromWidget(), Inkscape::LivePathEffect::LPEAttachPath::doEffect(), Inkscape::LivePathEffect::LPEPerspectiveEnvelope::doEffect(), Inkscape::LivePathEffect::LPERoughen::doEffect(), Inkscape::LivePathEffect::LPECopyRotate::doEffect_path(), Inkscape::LivePathEffect::LPEDashedStroke::doEffect_path(), Inkscape::LivePathEffect::LPEFilletChamfer::doEffect_path(), Inkscape::LivePathEffect::LPEMirrorSymmetry::doEffect_path(), Inkscape::LivePathEffect::LPETransform2Pts::doOnApply(), Geom::PathSink::feed(), feed(), Inkscape::LivePathEffect::LPEShowHandles::generateHelperPath(), Inkscape::LivePathEffect::LPESimplify::generateHelperPathAndSmooth(), Inkscape::half_outline(), Geom::BezierCurveN< degree >::intersect(), Geom::EllipticalArc::intersect(), Inkscape::LivePathEffect::LPERoughen::jitter(), Inkscape::LivePathEffect::FilletChamferKnotHolderEntity::knot_get(), SPCurve::nodes_in_path(), Inkscape::outline_join(), SPCurve::penultimate_point(), Inkscape::LivePathEffect::LPEFilletChamfer::setSelected(), Inkscape::LivePathEffect::size_nondegenerate(), Inkscape::LivePathEffect::sp_bspline_do_effect(), Inkscape::LivePathEffect::LPESlice::splititem(), and Inkscape::LivePathEffect::NodeSatelliteArrayParam::updateAmmount().
|
virtual |
Compute intersections with another curve.
Reimplemented in Geom::BezierCurveN< degree >, Geom::BezierCurveN< 1 >, Geom::BezierCurveN< degree >, Geom::BezierCurveN< 1 >, Geom::BezierCurveN< degree >, Geom::BezierCurveN< 1 >, Geom::BezierCurveN< degree >, Geom::BezierCurveN< 1 >, Geom::BezierCurveN< degree >, Geom::BezierCurveN< 1 >, Geom::BezierCurveN< degree >, Geom::BezierCurveN< 1 >, Geom::BezierCurve, Geom::BezierCurveN< degree >, Geom::BezierCurveN< 1 >, and Geom::EllipticalArc.
Definition at line 97 of file curve.cpp.
Referenced by Geom::BezierCurveN< degree >::intersect(), Geom::BezierCurve::intersect(), and Geom::EllipticalArc::intersect().
|
virtual |
Compute intersections of this curve with itself.
Represents a sub-arc of the curve.
A closure to split the curve into portions at the prescribed split points.
A closure to find pairwise intersections between the passed subcurves.
Definition at line 103 of file curve.cpp.
References derivative(), Geom::EPSILON, portion(), result, roots(), Geom::split(), Geom::Interval::valueAt(), Geom::X, and Geom::Y.
|
pure virtual |
Check whether the curve has exactly zero length.
Implemented in Geom::BezierCurveN< degree >, Geom::BezierCurveN< 1 >, Geom::BezierCurve, Geom::BezierCurveN< degree >, Geom::BezierCurveN< 1 >, Geom::EllipticalArc, and Geom::SBasisCurve.
Referenced by arcLengthAt(), Inkscape::LivePathEffect::LPEFilletChamfer::doEffect_path(), and timeAtArcLength().
|
inlinevirtual |
Check whether the curve is a line segment.
Reimplemented in Geom::BezierCurveN< degree >, Geom::BezierCurveN< 1 >, Geom::BezierCurve, Geom::BezierCurveN< degree >, Geom::BezierCurveN< 1 >, Geom::EllipticalArc, and Geom::SBasisCurve.
Definition at line 98 of file curve.h.
Referenced by arcLengthAt(), Geom::BezierCurveN< degree >::intersect(), Geom::EllipticalArc::intersect(), and timeAtArcLength().
Test whether two curves are approximately the same.
Implemented in Geom::SBasisCurve, Geom::BezierCurve, and Geom::EllipticalArc.
Referenced by Geom::parting_point().
Compute the arc length of this curve.
For a curve \(\mathbf{C}(t) = (C_x(t), C_y(t))\), arc length is defined for 2D curves as
\[ \ell = \int_{0}^{1} \sqrt { [C_x'(t)]^2 + [C_y'(t)]^2 }\, \text{d}t \]
In other words, we divide the curve into infinitely small linear segments and add together their lengths. Of course we can't subdivide the curve into infinitely many segments on a computer, so this method returns an approximation. Not that there is usually no closed form solution to such integrals, so this method might be slow.
tolerance | Maximum allowed error |
Reimplemented in Geom::BezierCurve, and Geom::SBasisCurve.
Definition at line 56 of file curve.cpp.
References toSBasis().
Referenced by arcLengthAt(), Inkscape::LivePathEffect::LPEPowerStroke::doEffect_path(), Inkscape::LivePathEffect::FilletChamferKnotHolderEntity::knot_set(), NodeSatellite::time(), timeAtArcLength(), unitTangentAt(), and Inkscape::LivePathEffect::NodeSatelliteArrayParam::updateCanvasIndicators().
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.
p | Query point |
a | Minimum time value to consider |
b | Maximum time value to consider; \(a < b\) |
Reimplemented in Geom::BezierCurveN< degree >, Geom::BezierCurveN< 1 >, Geom::BezierCurveN< degree >, Geom::BezierCurveN< 1 >, Geom::BezierCurve, Geom::BezierCurveN< degree >, Geom::BezierCurveN< 1 >, Geom::SBasisCurve, and Geom::EllipticalArc.
Definition at line 46 of file curve.cpp.
References Geom::nearest_time(), and toSBasis().
Referenced by nearestTime().
A version that takes an Interval.
Definition at line 257 of file curve.h.
References Geom::GenericInterval< C >::max(), Geom::GenericInterval< C >::min(), and nearestTime().
|
pure virtual |
Implemented in Geom::BezierCurve, Geom::EllipticalArc, Geom::SBasisCurve, Geom::BezierCurve, Geom::EllipticalArc, and Geom::SBasisCurve.
|
inlinevirtual |
Reimplemented in Geom::BezierCurve, Geom::EllipticalArc, and Geom::SBasisCurve.
|
inlinevirtual |
Reimplemented in Geom::BezierCurve, Geom::EllipticalArc, Geom::SBasisCurve, and Geom::EllipticalArc.
|
inlinevirtual |
Reimplemented in Geom::BezierCurve, Geom::EllipticalArc, Geom::SBasisCurve, Geom::BezierCurve, and Geom::EllipticalArc.
|
inlinevirtual |
Reimplemented in Geom::BezierCurve, Geom::EllipticalArc, Geom::SBasisCurve, Geom::BezierCurve, and Geom::EllipticalArc.
|
inlinevirtual |
Reimplemented in Geom::BezierCurve, Geom::EllipticalArc, and Geom::SBasisCurve.
|
inlinevirtual |
Reimplemented in Geom::BezierCurve, Geom::EllipticalArc, Geom::SBasisCurve, and Geom::EllipticalArc.
|
inline |
Test equality of two curves.
Equality means that for any time value, the evaluation of either curve will yield the same value. This means non-degenerate curves are not equal to their reverses. Note that this tests for exact equality.
Definition at line 340 of file curve.h.
References _equalTo(), and c.
|
pure virtual |
Evaluate the curve and its derivatives.
This will return a vector that contains the value of the curve and the specified number of derivatives. However, the returned vector might contain less elements than specified if some derivatives do not exist.
t | Time value |
n | The number of derivatives to compute |
Implemented in Geom::BezierCurve, and Geom::SBasisCurve.
Referenced by Inkscape::LivePathEffect::LPEAttachPath::doEffect(), Geom::intersect_polish_root(), pointAt(), and unitTangentAt().
Evaluate the curve at a specified time value.
t | Time value |
Reimplemented in Geom::BezierCurve, Geom::EllipticalArc, and Geom::SBasisCurve.
Definition at line 110 of file curve.h.
References pointAndDerivatives().
Referenced by Inkscape::LivePathEffect::LPERoughen::addNodesAndJitter(), Inkscape::LivePathEffect::LPERoughen::doEffect(), Inkscape::LivePathEffect::LPEFilletChamfer::doEffect_path(), Inkscape::UI::Tools::MarkerTool::get_marker_transform(), Geom::get_nodetype(), NodeSatellite::getPosition(), Geom::BezierCurveN< degree >::intersect(), Inkscape::LivePathEffect::LPERoughen::jitter(), Inkscape::LivePathEffect::FilletChamferKnotHolderEntity::knot_set(), NodeSatellite::lenToRad(), Geom::mono_intersect(), operator()(), Geom::pair_intersect(), Geom::parting_point(), Geom::PathVector::pointAt(), Geom::Path::pointAt(), Geom::PathVector::pointAt(), sp_shape_marker_get_transform(), and valueAt().
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.
a | Beginning of the interval specifying the portion of the curve |
b | End of the interval |
Implemented in Geom::BezierCurve, Geom::BezierCurveN< degree >, Geom::BezierCurveN< 1 >, Geom::SBasisCurve, and Geom::EllipticalArc.
Referenced by Geom::Path::appendPortionTo(), arcLengthAt(), Inkscape::LivePathEffect::LPEFilletChamfer::doEffect_path(), intersectSelf(), NodeSatellite::lenToRad(), Geom::parting_point(), and reverse().
A version of that accepts an Interval.
Definition at line 228 of file curve.h.
References Geom::GenericInterval< C >::max(), Geom::GenericInterval< C >::min(), and portion().
Referenced by portion().
|
inlinevirtual |
Create a reversed version of this curve.
The result corresponds to portion(1, 0)
, but this method might be faster.
Reimplemented in Geom::BezierCurve, Geom::BezierCurveN< degree >, Geom::BezierCurveN< 1 >, Geom::EllipticalArc, Geom::Path::ClosingSegment, and Geom::Path::StitchSegment.
Definition at line 234 of file curve.h.
References portion().
Referenced by Inkscape::UI::Tools::PencilTool::_fitAndSplit(), Inkscape::UI::Tools::PencilTool::_interpolate(), Inkscape::UI::Tools::PencilTool::_sketchInterpolate(), Inkscape::LivePathEffect::LPEAttachPath::doEffect(), Inkscape::UI::Tools::MarkerTool::get_marker_transform(), Geom::get_nodetype(), sp_shape_marker_get_transform(), and sp_shape_marker_get_transform_at_end().
Computes time values at which the curve intersects an axis-aligned line.
v | The coordinate of the line |
d | Which axis the coordinate is on. X means a vertical line, Y a horizontal line. |
Implemented in Geom::BezierCurve, Geom::SBasisCurve, and Geom::EllipticalArc.
Referenced by Geom::curve_mono_splits(), intersectSelf(), and winding().
|
pure virtual |
Change the ending point of the curve.
After calling this method, it is guaranteed that \(\mathbf{C}(0) = \mathbf{p}\), and the curve is still continuous. The precise new shape of the curve varies with curve type.
p | New ending point of the curve |
Implemented in Geom::EllipticalArc, Geom::BezierCurve, and Geom::SBasisCurve.
Referenced by Geom::SVGPathParser::_closePath(), and Geom::Path::appendPortionTo().
|
pure virtual |
Change the starting point of the curve.
After calling this method, it is guaranteed that \(\mathbf{C}(0) = \mathbf{p}\), and the curve is still continuous. The precise new shape of the curve varies with curve type.
p | New starting point of the curve |
Implemented in Geom::EllipticalArc, Geom::BezierCurve, and Geom::SBasisCurve.
Referenced by Geom::Path::appendPortionTo(), and Inkscape::LivePathEffect::LPEFilletChamfer::doEffect_path().
|
inlinevirtual |
Convert the curve to a symmetric power basis polynomial.
Symmetric power basis polynomials (S-basis for short) are numerical representations of curves with excellent numerical properties. Most high level operations provided by 2Geom are implemented in terms of S-basis operations, so every curve has to provide a method to convert it to an S-basis polynomial on two variables. See SBasis class reference for more information.
Implemented in Geom::BezierCurve, Geom::EllipticalArc, and Geom::SBasisCurve.
Referenced by Inkscape::UI::PathManipulator::_bsplineHandleReposition(), Inkscape::UI::Tools::PenTool::_bsplineSpiroMotion(), allNearestTimes(), Inkscape::LivePathEffect::LPEBSpline::doBSplineFromWidget(), feed(), length(), monotonic_smash_intersect(), nearestTime(), NodeSatellite::radToLen(), Inkscape::LivePathEffect::sp_bspline_do_effect(), Inkscape::UI::PathManipulator::subdivideSegment(), and timeAtArcLength().
|
inline |
Transform this curve by an affine transformation.
Because of this method, all curve types must be closed under affine transformations.
m | Affine describing the affine transformation |
Definition at line 193 of file curve.h.
Referenced by Geom::Ellipse::axis(), Geom::BezierCurve::expandToTransformed(), Geom::BezierCurveN< degree >::expandToTransformed(), Geom::EllipticalArc::expandToTransformed(), Geom::SBasisCurve::expandToTransformed(), Geom::Ellipse::semiaxis(), and transformed().
Create a curve transformed by an affine transformation.
This method returns a new curve instead modifying the existing one.
m | Affine describing the affine transformation |
Definition at line 209 of file curve.h.
References duplicate(), and transform().
Compute a vector tangent to the curve.
This will return an unit vector (a Point with length() equal to 1) that denotes a vector tangent to the curve. This vector is defined as \( \mathbf{v}(t) = \frac{\mathbf{C}'(t)}{||\mathbf{C}'(t)||} \). It is pointed in the direction of increasing \(t\), at the specified time value. The method uses l'Hopital's rule when the derivative is zero. A zero vector is returned if no non-zero derivative could be found.
t | Time value |
n | The maximum order of derivative to consider |
Definition at line 201 of file curve.cpp.
References Geom::are_near(), length(), and pointAndDerivatives().
Referenced by Inkscape::UI::Tools::EraserTool::_accumulate(), Inkscape::UI::Tools::PencilTool::_fitAndSplit(), Inkscape::UI::Tools::PencilTool::_interpolate(), Inkscape::UI::Tools::PencilTool::_sketchInterpolate(), Geom::find_direction_of_travel(), Inkscape::UI::Tools::MarkerTool::get_marker_transform(), Geom::get_nodetype(), sp_shape_marker_get_transform(), sp_shape_marker_get_transform_at_end(), and winding().
Evaluate one of the coordinates at the specified time value.
t | Time value |
d | The dimension to evaluate |
Reimplemented in Geom::BezierCurve, Geom::EllipticalArc, and Geom::SBasisCurve.
Definition at line 116 of file curve.h.
References pointAt().
Referenced by Geom::PathVector::valueAt(), Geom::Path::valueAt(), Geom::PathVector::valueAt(), and winding().
|
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.
p | Point where the winding number should be determined |
Reimplemented in Geom::BezierCurveN< degree >, Geom::BezierCurveN< 1 >, Geom::BezierCurveN< degree >, Geom::BezierCurveN< 1 >, Geom::BezierCurveN< degree >, Geom::BezierCurveN< 1 >, and Geom::EllipticalArc.
Definition at line 61 of file curve.cpp.
References roots(), unitTangentAt(), valueAt(), Geom::X, and Geom::Y.
Referenced by Geom::BezierCurveN< degree >::winding().