Inkscape
Vector Graphics Editor
|
Elliptical arc curve. More...
#include <elliptical-arc.h>
Public Member Functions | |
EllipticalArc () | |
Creates an arc with all variables set to zero. | |
EllipticalArc (Point const &ip, Point const &r, Coord rot_angle, bool large_arc, bool sweep, Point const &fp) | |
Create a new elliptical arc. | |
EllipticalArc (Point const &ip, Coord rx, Coord ry, Coord rot_angle, bool large_arc, bool sweep, Point const &fp) | |
Create a new elliptical arc, giving the ellipse's rays as separate coordinates. | |
Point | initialPoint () const override |
Retrieve the start of the curve. | |
Point | finalPoint () const override |
Retrieve the end of the curve. | |
Curve * | duplicate () const override |
Create an exact copy of this curve. | |
void | setInitial (Point const &p) override |
Change the starting point of the curve. | |
void | setFinal (Point const &p) override |
Change the ending point of the curve. | |
bool | isDegenerate () const override |
Check whether the curve has exactly zero length. | |
bool | isLineSegment () const override |
Check whether the curve is a line segment. | |
Rect | boundsFast () const override |
Quickly compute the curve's approximate bounding box. | |
Rect | boundsExact () const override |
Compute bounds of an elliptical arc. | |
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. | |
OptRect | boundsLocal (OptInterval const &i, unsigned int deg) const override |
std::vector< double > | roots (double v, Dim2 d) const override |
Computes time values at which the curve intersects an axis-aligned line. | |
std::vector< double > | allNearestTimes (Point const &p, double from=0, double to=1) const override |
Compute time values at which the curve comes closest to a specified point. | |
double | nearestTime (Point const &p, double from=0, double to=1) const override |
Compute a time value at which the curve comes closest to a specified point. | |
std::vector< CurveIntersection > | intersect (Curve const &other, Coord eps=EPSILON) const override |
Compute intersections with another curve. | |
int | degreesOfFreedom () const override |
Return the number of independent parameters required to represent all variations of this curve. | |
Curve * | derivative () const override |
Create a derivative of this curve. | |
void | operator*= (Translate const &tr) override |
void | operator*= (Scale const &s) override |
void | operator*= (Rotate const &r) override |
void | operator*= (Zoom const &z) override |
void | operator*= (Affine const &m) override |
std::vector< Point > | pointAndDerivatives (Coord t, unsigned int n) const override |
D2< SBasis > | toSBasis () const override |
Convert the curve to a symmetric power basis polynomial. | |
Curve * | portion (double f, double t) const override |
Create a curve that corresponds to a part of this curve. | |
Curve * | reverse () const override |
Create a reversed version of this curve. | |
bool | isNear (Curve const &other, Coord precision) const override |
Test whether two curves are approximately the same. | |
void | feed (PathSink &sink, bool moveto_initial) const override |
Feed the curve to a PathSink. | |
int | winding (Point const &p) const override |
Compute the partial winding number of this curve. | |
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 |
Retrieve basic information | |
Coord | center (Dim2 d) const |
Get a coordinate of the elliptical arc's center. | |
Point | center () const |
Get the arc's center. | |
Coord | ray (Dim2 d) const |
Get one of the ellipse's rays. | |
Point | rays () const |
Get both rays as a point. | |
Angle | rotationAngle () const |
Get the defining ellipse's rotation. | |
bool | largeArc () const |
Whether the arc is larger than half an ellipse. | |
bool | sweep () const |
Whether the arc turns clockwise. | |
Angle | initialAngle () const |
Angle | finalAngle () const |
Modify parameters | |
void | set (Point const &ip, double rx, double ry, double rot_angle, bool large_arc, bool sweep, Point const &fp) |
Change all of the arc's parameters. | |
void | set (Point const &ip, Point const &r, Angle rot_angle, bool large_arc, bool sweep, Point const &fp) |
Change all of the arc's parameters. | |
void | setEndpoints (Point const &ip, Point const &fp) |
Change the initial and final point in one operation. | |
Evaluate the arc as a function | |
bool | containsAngle (Angle angle) const |
Check whether the arc contains the given angle. | |
Point | pointAtAngle (Coord t) const |
Evaluate the arc at the specified angular coordinate. | |
Coord | valueAtAngle (Coord t, Dim2 d) const |
Evaluate one of the arc's coordinates at the specified angle. | |
Coord | timeAtAngle (Angle a) const |
Compute the curve time value corresponding to the given angular value. | |
Angle | angleAt (Coord t) const |
Compute the angular domain value corresponding to the given time value. | |
Coord | sweepAngle () const |
Compute the amount by which the angle parameter changes going from start to end. | |
Coord | angularExtent () const |
Get the elliptical angle spanned by the arc. | |
AngleInterval | angularInterval () const |
Get the angular interval of the arc. | |
Point | pointAt (Coord t) const override |
Evaluate the arc in the curve domain, i.e. \([0, 1]\). | |
Coord | valueAt (Coord t, Dim2 d) const override |
Evaluate a single coordinate on the arc in the curve domain. | |
Affine | unitCircleTransform () const |
Compute a transform that maps the unit circle to the arc's ellipse. | |
Affine | inverseUnitCircleTransform () const |
Compute a transform that maps the arc's ellipse to the unit circle. | |
Deal with degenerate ellipses. | |
bool | isChord () const |
Check whether both rays are nonzero. | |
LineSegment | chord () const |
Get the line segment connecting the arc's endpoints. | |
![]() | |
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. | |
virtual std::vector< Point > | pointAndDerivatives (Coord t, unsigned n) const =0 |
Evaluate the curve and its derivatives. | |
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. | |
void | transform (Affine const &m) |
Transform this curve by an affine transformation. | |
virtual Curve * | transformed (Affine const &m) const |
Create a curve transformed by an affine transformation. | |
Curve * | portion (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. | |
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< 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. | |
bool | operator== (Curve const &c) const |
Test equality of two curves. | |
Protected Member Functions | |
bool | _equalTo (Curve const &c) const override |
Private Member Functions | |
void | _updateCenterAndAngles () |
std::vector< ShapeIntersection > | _filterIntersections (std::vector< ShapeIntersection > &&xs, bool is_first) const |
Convert the passed intersections to curve time parametrization and filter out any invalid intersections. | |
bool | _validateIntersection (ShapeIntersection &xing, bool is_first) const |
Convert the passed intersection to curve time and check whether the intersection is numerically sane. | |
std::vector< ShapeIntersection > | _intersectSameEllipse (EllipticalArc const *other) const |
Check if two arcs on the same ellipse intersect/overlap. | |
Private Attributes | |
Point | _initial_point |
Point | _final_point |
Ellipse | _ellipse |
AngleInterval | _angles |
bool | _large_arc |
Related Symbols | |
(Note that these are not member symbols.) | |
bool | arc_from_sbasis (EllipticalArc &ea, D2< SBasis > const &in, double tolerance=EPSILON, unsigned num_samples=20) |
Fit an elliptical arc to an SBasis fragment. | |
std::ostream & | operator<< (std::ostream &out, EllipticalArc const &ea) |
Debug output for elliptical arcs. | |
Elliptical arc curve.
Elliptical arc is a curve taking the shape of a section of an ellipse.
The arc function has two forms: the regular one, mapping the unit interval to points on 2D plane (the linear domain), and a second form that maps some interval \(A \subseteq [0,2\pi)\) to the same points (the angular domain). The interval \(A\) determines which part of the ellipse forms the arc. The arc is said to contain an angle if its angular domain includes that angle (and therefore it is defined for that angle).
The angular domain considers each ellipse to be a rotated, scaled and translated unit circle: 0 corresponds to \((1,0)\) on the unit circle, \(\pi/2\) corresponds to \((0,1)\), \(\pi\) to \((-1,0)\) and \(3\pi/2\) to \((0,-1)\). After the angle is mapped to a point from a unit circle, the point is transformed using a matrix of this form
\[ M = \left[ \begin{array}{ccc} r_X \cos(\theta) & -r_Y \sin(\theta) & 0 \\ r_X \sin(\theta) & r_Y \cos(\theta) & 0 \\ c_X & c_Y & 1 \end{array} \right] \]
where \(r_X, r_Y\) are the X and Y rays of the ellipse, \(\theta\) is its angle of rotation, and \(c_X, c_Y\) the coordinates of the ellipse's center - thus mapping the angle to some point on the ellipse. Note that for example the point at angluar coordinate 0, the center and the point at angular coordinate \(\pi/4\) do not necessarily create an angle of \(\pi/4\) radians; it is only the case if both axes of the ellipse are of the same length (i.e. it is a circle).
Each arc is defined by five variables: The initial and final point, the ellipse's rays, and the ellipse's rotation. Each set of those parameters corresponds to four different arcs, with two of them larger than half an ellipse and two of them turning clockwise while traveling from initial to final point. The two flags disambiguate between them: "large arc flag" selects the bigger arc, while the "sweep flag" selects the arc going in the direction of positive angles. Angles always increase when going from the +X axis in the direction of the +Y axis, so if Y grows downwards, this means clockwise.
Definition at line 52 of file elliptical-arc.h.
|
inline |
Creates an arc with all variables set to zero.
Definition at line 56 of file elliptical-arc.h.
Referenced by duplicate(), and portion().
|
inline |
Create a new elliptical arc.
ip | Initial point of the arc |
r | Rays of the ellipse as a point |
rot | Angle of rotation of the X axis of the ellipse in radians |
large | If true, the large arc is chosen (always >= 180 degrees), otherwise the smaller arc is chosen |
sweep | If true, the clockwise arc is chosen, otherwise the counter-clockwise arc is chosen |
fp | Final point of the arc |
Definition at line 70 of file elliptical-arc.h.
References _updateCenterAndAngles().
|
inline |
Create a new elliptical arc, giving the ellipse's rays as separate coordinates.
Definition at line 84 of file elliptical-arc.h.
References _updateCenterAndAngles().
|
overrideprotectedvirtual |
Implements Geom::Curve.
Definition at line 885 of file elliptical-arc.cpp.
References _final_point, _initial_point, _large_arc, c, rays(), rotationAngle(), and sweep().
|
private |
Convert the passed intersections to curve time parametrization and filter out any invalid intersections.
Definition at line 604 of file elliptical-arc.cpp.
References _validateIntersection(), and result.
Referenced by intersect().
|
private |
Check if two arcs on the same ellipse intersect/overlap.
other | Another elliptical arc on the same ellipse as this one. |
A closure to create an "intersection" at the prescribed angle.
Definition at line 686 of file elliptical-arc.cpp.
References _angles, _ellipse, angularInterval(), Geom::AngleInterval::contains(), Geom::AngleInterval::finalAngle(), Geom::AngleInterval::initialAngle(), Geom::Ellipse::pointAt(), result, and timeAtAngle().
Referenced by intersect().
|
private |
Definition at line 717 of file elliptical-arc.cpp.
References _angles, _ellipse, _large_arc, Geom::angle_between(), Geom::atan2(), c, finalPoint(), initialPoint(), Geom::Rotate::inverse(), isChord(), Geom::L2(), Geom::middle_point(), ray(), rays(), rotationAngle(), Geom::AngleInterval::setAngles(), Geom::Ellipse::setCenter(), Geom::AngleInterval::setFinal(), Geom::AngleInterval::setInitial(), Geom::Ellipse::setRays(), Geom::Ellipse::setRotationAngle(), Geom::AngleInterval::setSweep(), sweep(), Geom::X, and Geom::Y.
Referenced by EllipticalArc(), EllipticalArc(), set(), set(), setEndpoints(), setFinal(), and setInitial().
|
private |
Convert the passed intersection to curve time and check whether the intersection is numerically sane.
The intersection to convert to curve time and to validate. | |
is_first | If true, this arc is the first of the intersected curves; if false, it's second. |
Note that the intersection is guaranteed to be converted only if the return value is true.
Definition at line 626 of file elliptical-arc.cpp.
References _ellipse, Geom::are_near_rel(), Geom::GenericInterval< C >::contains(), Geom::Intersection< TimeA, TimeB >::first, Geom::Intersection< TimeA, TimeB >::point(), Geom::Ellipse::pointAt(), pointAt(), Geom::Intersection< TimeA, TimeB >::second, and timeAtAngle().
Referenced by _filterIntersections().
|
overridevirtual |
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 from Geom::Curve.
Definition at line 373 of file elliptical-arc.cpp.
References Geom::are_near(), center(), Geom::distanceSq(), Geom::BezierCurveN< degree >::nearestTime(), Geom::BezierCurve::pointAt(), pointAt(), pointAtAngle(), ray(), result, roots(), rotationAngle(), Geom::sincos(), Geom::solve_reals(), timeAtAngle(), Geom::X, and Geom::Y.
Referenced by nearestTime().
Compute the angular domain value corresponding to the given time value.
Definition at line 204 of file elliptical-arc.h.
References _angles, and Geom::AngleInterval::angleAt().
Referenced by pointAndDerivatives(), pointAt(), portion(), and valueAt().
|
inline |
Get the elliptical angle spanned by the arc.
This is basically the absolute value of sweepAngle().
Definition at line 213 of file elliptical-arc.h.
References _angles, and Geom::AngleInterval::extent().
Referenced by portion().
|
inline |
Get the angular interval of the arc.
Definition at line 216 of file elliptical-arc.h.
References _angles.
Referenced by _intersectSameEllipse().
|
overridevirtual |
Compute bounds of an elliptical arc.
The bounds computation works as follows. The extreme X and Y points are either the endpoints or local minima / maxima of the ellipse. We already have endpoints, and we compute the local extremes. The local extremes correspond to two angles separated by \(\pi\). Once we compute these angles, we check whether they belong to the arc, and if they do, we evaluate the ellipse at these angles. The bounding box of the arc is equal to the bounding box of the endpoints and the local extrema that belong to the arc.
Implements Geom::Curve.
Definition at line 106 of file elliptical-arc.cpp.
References _angles, _ellipse, _final_point, _initial_point, Geom::Ellipse::boundsExact(), Geom::AngleInterval::contains(), isChord(), Geom::AngleInterval::isFull(), result, unitCircleTransform(), Geom::X, and Geom::Y.
Referenced by boundsFast().
|
inlineoverridevirtual |
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.
Implements Geom::Curve.
Definition at line 269 of file elliptical-arc.h.
References boundsExact().
|
inlineoverride |
Definition at line 275 of file elliptical-arc.h.
References Geom::SBasisCurve::boundsLocal(), and toSBasis().
|
inline |
Get the arc's center.
Definition at line 107 of file elliptical-arc.h.
References _ellipse, and Geom::Ellipse::center().
Referenced by allNearestTimes(), nearestTime(), roots(), and toSBasis().
Get a coordinate of the elliptical arc's center.
d | The dimension to retrieve |
Definition at line 103 of file elliptical-arc.h.
References _ellipse, and Geom::Ellipse::center().
|
inline |
Get the line segment connecting the arc's endpoints.
Definition at line 250 of file elliptical-arc.h.
References _final_point, and _initial_point.
Referenced by derivative(), isNear(), pointAndDerivatives(), pointAt(), roots(), toSBasis(), and valueAt().
|
inline |
Check whether the arc contains the given angle.
t | The angle to check |
Definition at line 187 of file elliptical-arc.h.
References _angles, and Geom::AngleInterval::contains().
|
inlineoverridevirtual |
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 from Geom::Curve.
Definition at line 289 of file elliptical-arc.h.
|
overridevirtual |
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.
Implements Geom::Curve.
Definition at line 261 of file elliptical-arc.cpp.
References _ellipse, chord(), Geom::BezierCurveN< degree >::derivative(), duplicate(), isChord(), result, and Geom::Ellipse::setCenter().
|
inlineoverridevirtual |
Create an exact copy of this curve.
Implements Geom::Curve.
Definition at line 256 of file elliptical-arc.h.
References EllipticalArc().
Referenced by derivative(), pointAndDerivatives(), portion(), reverse(), and TEST().
|
overridevirtual |
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. |
Implements Geom::Curve.
Definition at line 142 of file elliptical-arc.cpp.
References _angles, _final_point, Geom::AngleInterval::contains(), Geom::contains(), Geom::GenericRect< C >::expandTo(), isChord(), Geom::AngleInterval::isFull(), Geom::Curve::transform(), Geom::GenericRect< C >::unionWith(), unitCircleTransform(), Geom::X, and Geom::Y.
|
overridevirtual |
Feed the curve to a PathSink.
Reimplemented from Geom::Curve.
Definition at line 920 of file elliptical-arc.cpp.
References _final_point, _initial_point, _large_arc, Geom::PathSink::arcTo(), Geom::PathSink::moveTo(), ray(), rotationAngle(), sweep(), Geom::X, and Geom::Y.
|
inline |
Definition at line 134 of file elliptical-arc.h.
References _angles, and Geom::AngleInterval::finalAngle().
Referenced by Geom::CairoPathSink::arcTo(), and winding().
|
inlineoverridevirtual |
Retrieve the end of the curve.
Implements Geom::Curve.
Definition at line 255 of file elliptical-arc.h.
References _final_point.
Referenced by _updateCenterAndAngles(), operator<<(), pointAt(), TEST(), and toSBasis().
|
inline |
Definition at line 133 of file elliptical-arc.h.
References _angles, and Geom::AngleInterval::initialAngle().
Referenced by Geom::CairoPathSink::arcTo(), toSBasis(), and winding().
|
inlineoverridevirtual |
Retrieve the start of the curve.
Implements Geom::Curve.
Definition at line 254 of file elliptical-arc.h.
References _initial_point.
Referenced by _updateCenterAndAngles(), operator<<(), pointAt(), TEST(), and toSBasis().
|
overridevirtual |
Compute intersections with another curve.
Reimplemented from Geom::Curve.
Definition at line 646 of file elliptical-arc.cpp.
References _ellipse, _filterIntersections(), _final_point, _initial_point, _intersectSameEllipse(), Geom::crossings(), Geom::Curve::finalPoint(), Geom::Curve::initialPoint(), Geom::Curve::intersect(), Geom::BezierCurveN< degree >::intersect(), Geom::Ellipse::intersect(), Geom::Curve::isLineSegment(), isLineSegment(), result, and Geom::transpose_in_place().
|
inline |
Compute a transform that maps the arc's ellipse to the unit circle.
Definition at line 234 of file elliptical-arc.h.
References _ellipse, Geom::Ellipse::inverseUnitCircleTransform(), and result.
|
inline |
Check whether both rays are nonzero.
If they are not, the arc is represented as a line segment instead.
Definition at line 244 of file elliptical-arc.h.
References ray(), Geom::X, and Geom::Y.
Referenced by _updateCenterAndAngles(), boundsExact(), derivative(), expandToTransformed(), isLineSegment(), isNear(), operator*=(), pointAndDerivatives(), pointAt(), roots(), toSBasis(), and valueAt().
|
inlineoverridevirtual |
Check whether the curve has exactly zero length.
Implements Geom::Curve.
Definition at line 265 of file elliptical-arc.h.
References _final_point, and _initial_point.
|
inlineoverridevirtual |
Check whether the curve is a line segment.
Reimplemented from Geom::Curve.
Definition at line 268 of file elliptical-arc.h.
References isChord().
Referenced by intersect().
Test whether two curves are approximately the same.
Implements Geom::Curve.
Definition at line 901 of file elliptical-arc.cpp.
References _ellipse, _final_point, _initial_point, Geom::are_near(), c, chord(), isChord(), isNear(), and sweep().
Referenced by isNear().
|
inline |
Whether the arc is larger than half an ellipse.
Definition at line 126 of file elliptical-arc.h.
References _large_arc.
Referenced by operator<<(), and winding().
|
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.
p | Query point |
a | Minimum time value to consider |
b | Maximum time value to consider; \(a < b\) |
Reimplemented from Geom::Curve.
Definition at line 281 of file elliptical-arc.h.
References allNearestTimes(), Geom::are_near(), center(), ray(), Geom::X, and Geom::Y.
|
overridevirtual |
Implements Geom::Curve.
Definition at line 860 of file elliptical-arc.cpp.
References _angles, _ellipse, _final_point, _initial_point, Geom::Affine::det(), isChord(), Geom::middle_point(), Geom::Ellipse::setCenter(), Geom::AngleInterval::setFinal(), Geom::AngleInterval::setInitial(), Geom::Ellipse::setRays(), Geom::Ellipse::setRotationAngle(), Geom::AngleInterval::setSweep(), sweep(), and Geom::Ellipse::timeAt().
|
virtual |
Implements Geom::Curve.
|
inlinevirtual |
Reimplemented from Geom::Curve.
|
inlinevirtual |
Reimplemented from Geom::Curve.
|
overridevirtual |
Reimplemented from Geom::Curve.
Definition at line 846 of file elliptical-arc.cpp.
References _ellipse, _final_point, and _initial_point.
|
inlinevirtual |
Reimplemented from Geom::Curve.
|
overridevirtual |
Reimplemented from Geom::Curve.
Definition at line 839 of file elliptical-arc.cpp.
References _ellipse, _final_point, and _initial_point.
|
inlinevirtual |
Reimplemented from Geom::Curve.
|
overridevirtual |
Reimplemented from Geom::Curve.
Definition at line 832 of file elliptical-arc.cpp.
References _ellipse, _final_point, and _initial_point.
|
inlinevirtual |
Reimplemented from Geom::Curve.
|
inlinevirtual |
Reimplemented from Geom::Curve.
|
overridevirtual |
Reimplemented from Geom::Curve.
Definition at line 853 of file elliptical-arc.cpp.
References _ellipse, _final_point, and _initial_point.
|
override |
Definition at line 278 of file elliptical-arc.cpp.
References angleAt(), chord(), duplicate(), isChord(), Geom::BezierCurve::pointAndDerivatives(), pointAtAngle(), result, and sweep().
Evaluate the arc in the curve domain, i.e. \([0, 1]\).
Reimplemented from Geom::Curve.
Definition at line 313 of file elliptical-arc.cpp.
References _ellipse, angleAt(), chord(), finalPoint(), initialPoint(), isChord(), Geom::Ellipse::pointAt(), and Geom::BezierCurve::pointAt().
Referenced by _validateIntersection(), allNearestTimes(), portion(), TEST(), and TEST().
Evaluate the arc at the specified angular coordinate.
t | Angle |
Definition at line 173 of file elliptical-arc.cpp.
References _ellipse, and Geom::Ellipse::pointAt().
Referenced by allNearestTimes(), pointAndDerivatives(), TEST(), and winding().
|
overridevirtual |
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 |
Implements Geom::Curve.
Definition at line 333 of file elliptical-arc.cpp.
References _angles, _final_point, _initial_point, _large_arc, angleAt(), angularExtent(), duplicate(), EllipticalArc(), pointAt(), reverse(), Geom::AngleInterval::setAngles(), Geom::AngleInterval::setSweep(), and sweep().
Get one of the ellipse's rays.
d | Dimension to retrieve |
Definition at line 112 of file elliptical-arc.h.
References _ellipse, and Geom::Ellipse::ray().
Referenced by _updateCenterAndAngles(), allNearestTimes(), feed(), isChord(), nearestTime(), operator<<(), roots(), toSBasis(), and winding().
|
inline |
Get both rays as a point.
Definition at line 116 of file elliptical-arc.h.
References _ellipse, and Geom::Ellipse::rays().
Referenced by _equalTo(), and _updateCenterAndAngles().
|
overridevirtual |
Create a reversed version of this curve.
The result corresponds to portion(1, 0)
, but this method might be faster.
Reimplemented from Geom::Curve.
Definition at line 363 of file elliptical-arc.cpp.
References _angles, _final_point, _initial_point, duplicate(), and Geom::AngleInterval::reverse().
Referenced by portion().
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. |
Implements Geom::Curve.
Definition at line 184 of file elliptical-arc.cpp.
References c, center(), chord(), Geom::GenericInterval< C >::contains(), delta, isChord(), ray(), Geom::BezierCurve::roots(), rotationAngle(), Geom::sincos(), timeAtAngle(), Geom::X, and Geom::Y.
Referenced by allNearestTimes().
|
inline |
Get the defining ellipse's rotation.
Definition at line 120 of file elliptical-arc.h.
References _ellipse, and Geom::Ellipse::rotationAngle().
Referenced by _equalTo(), _updateCenterAndAngles(), allNearestTimes(), feed(), operator<<(), roots(), toSBasis(), and winding().
|
inline |
Change all of the arc's parameters.
Definition at line 141 of file elliptical-arc.h.
References _angles, _ellipse, _final_point, _initial_point, _large_arc, _updateCenterAndAngles(), Geom::Ellipse::setRays(), Geom::Ellipse::setRotationAngle(), Geom::AngleInterval::setSweep(), and sweep().
Referenced by Geom::make_elliptical_arc().
|
inline |
Change all of the arc's parameters.
Definition at line 156 of file elliptical-arc.h.
References _angles, _ellipse, _final_point, _initial_point, _large_arc, _updateCenterAndAngles(), Geom::Ellipse::setRays(), Geom::Ellipse::setRotationAngle(), Geom::AngleInterval::setSweep(), and sweep().
Change the initial and final point in one operation.
This method exists because modifying any of the endpoints causes rather costly recalculations of the center and extreme angles.
ip | New initial point |
fp | New final point |
Definition at line 175 of file elliptical-arc.h.
References _final_point, _initial_point, and _updateCenterAndAngles().
|
inlineoverridevirtual |
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 |
Implements Geom::Curve.
Definition at line 261 of file elliptical-arc.h.
References _final_point, and _updateCenterAndAngles().
|
inlineoverridevirtual |
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 |
Implements Geom::Curve.
Definition at line 257 of file elliptical-arc.h.
References _initial_point, and _updateCenterAndAngles().
|
inline |
Whether the arc turns clockwise.
Definition at line 131 of file elliptical-arc.h.
References _angles, and Geom::AngleInterval::sweep().
Referenced by _equalTo(), _updateCenterAndAngles(), feed(), isNear(), operator*=(), operator<<(), pointAndDerivatives(), portion(), set(), set(), and winding().
|
inline |
Compute the amount by which the angle parameter changes going from start to end.
This has range \((-2\pi, 2\pi)\) and thus cannot be represented as instance of the class Angle. Add this to the initial angle to obtain the final angle.
Definition at line 209 of file elliptical-arc.h.
References _angles, and Geom::AngleInterval::sweepAngle().
Referenced by toSBasis().
Compute the curve time value corresponding to the given angular value.
Definition at line 201 of file elliptical-arc.h.
References _angles, and Geom::AngleInterval::timeAtAngle().
Referenced by _intersectSameEllipse(), _validateIntersection(), allNearestTimes(), and roots().
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.
Implements Geom::Curve.
Definition at line 800 of file elliptical-arc.cpp.
References center(), chord(), Geom::cos(), finalPoint(), initialAngle(), initialPoint(), isChord(), Geom::Angle::radians(), ray(), rotationAngle(), Geom::sin(), Geom::sincos(), sweepAngle(), Geom::BezierCurve::toSBasis(), Geom::X, and Geom::Y.
Referenced by boundsLocal(), and Inkscape::LivePathEffect::path_from_piecewise_fix_cusps().
|
inline |
Compute a transform that maps the unit circle to the arc's ellipse.
Each ellipse can be interpreted as a translated, scaled and rotate unit circle. This function returns the transform that maps the unit circle to the arc's ellipse.
Definition at line 228 of file elliptical-arc.h.
References _ellipse, result, and Geom::Ellipse::unitCircleTransform().
Referenced by Geom::CairoPathSink::arcTo(), boundsExact(), and expandToTransformed().
Evaluate a single coordinate on the arc in the curve domain.
Reimplemented from Geom::Curve.
Definition at line 327 of file elliptical-arc.cpp.
References angleAt(), chord(), isChord(), Geom::BezierCurve::valueAt(), and valueAtAngle().
Evaluate one of the arc's coordinates at the specified angle.
t | Angle |
d | The dimension to retrieve |
Definition at line 179 of file elliptical-arc.cpp.
References _ellipse, and Geom::Ellipse::valueAt().
Referenced by valueAt().
|
overridevirtual |
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 from Geom::Curve.
Definition at line 928 of file elliptical-arc.cpp.
References _angles, _ellipse, _final_point, _initial_point, Geom::AngleInterval::contains(), Geom::Ellipse::contains(), Geom::cross(), finalAngle(), initialAngle(), Geom::AngleInterval::isFull(), largeArc(), Geom::Interval::lowerContains(), pointAtAngle(), ray(), rotationAngle(), Geom::sincos(), sweep(), Geom::X, and Geom::Y.
|
related |
Fit an elliptical arc to an SBasis fragment.
Definition at line 323 of file elliptical-arc-from-sbasis.cpp.
References Geom::arc_from_sbasis(), and Geom::make_elliptical_arc().
|
related |
Debug output for elliptical arcs.
Definition at line 1023 of file elliptical-arc.cpp.
References finalPoint(), Geom::format_coord_nice(), initialPoint(), largeArc(), Geom::operator<<(), ray(), rotationAngle(), sweep(), Geom::X, and Geom::Y.
|
private |
Definition at line 318 of file elliptical-arc.h.
Referenced by _intersectSameEllipse(), _updateCenterAndAngles(), angleAt(), angularExtent(), angularInterval(), boundsExact(), containsAngle(), expandToTransformed(), finalAngle(), initialAngle(), operator*=(), portion(), reverse(), set(), set(), sweep(), sweepAngle(), timeAtAngle(), and winding().
|
private |
Definition at line 317 of file elliptical-arc.h.
Referenced by _intersectSameEllipse(), _updateCenterAndAngles(), _validateIntersection(), boundsExact(), center(), center(), derivative(), intersect(), inverseUnitCircleTransform(), isNear(), operator*=(), operator*=(), operator*=(), operator*=(), operator*=(), pointAt(), pointAtAngle(), ray(), rays(), rotationAngle(), set(), set(), unitCircleTransform(), valueAtAngle(), and winding().
|
private |
Definition at line 316 of file elliptical-arc.h.
Referenced by _equalTo(), boundsExact(), chord(), expandToTransformed(), feed(), finalPoint(), intersect(), isDegenerate(), isNear(), operator*=(), operator*=(), operator*=(), operator*=(), operator*=(), portion(), reverse(), set(), set(), setEndpoints(), setFinal(), and winding().
|
private |
Definition at line 316 of file elliptical-arc.h.
Referenced by _equalTo(), boundsExact(), chord(), feed(), initialPoint(), intersect(), isDegenerate(), isNear(), operator*=(), operator*=(), operator*=(), operator*=(), operator*=(), portion(), reverse(), set(), set(), setEndpoints(), setInitial(), and winding().
|
private |
Definition at line 319 of file elliptical-arc.h.
Referenced by _equalTo(), _updateCenterAndAngles(), feed(), largeArc(), portion(), set(), and set().