Inkscape
Vector Graphics Editor
|
Directed angular interval. More...
#include <angle.h>
Public Member Functions | |
AngleInterval () | |
AngleInterval (Angle s, Angle e, bool cw=false) | |
Create an angular interval from two angles and direction. | |
AngleInterval (double s, double e, bool cw=false) | |
AngleInterval (Angle s, Angle inner, Angle e) | |
Create an angular interval from three angles. | |
Angle | initialAngle () const |
Get the start angle. | |
Angle | finalAngle () const |
Get the end angle. | |
bool | sweep () const |
Check whether the interval goes in the direction of increasing angles. | |
bool | isDegenerate () const |
Check whether the interval contains only a single angle. | |
bool | isFull () const |
Check whether the interval contains all angles. | |
void | setInitial (Angle a, bool prefer_full=false) |
Set the initial angle. | |
void | setFinal (Angle a, bool prefer_full=false) |
Set the final angle. | |
void | setAngles (Angle s, Angle e, bool prefer_full=false) |
Set both angles at once. | |
void | setSweep (bool s) |
Set whether the interval goes in the direction of increasing angles. | |
void | reverse () |
Reverse the direction of the interval while keeping contained values the same. | |
AngleInterval | reversed () const |
Get a new interval with reversed direction. | |
Angle | angleAt (Coord t) const |
Get an angle corresponding to the specified time value. | |
Angle | operator() (Coord t) const |
Coord | timeAtAngle (Angle a) const |
Compute a time value that would evaluate to the given angle. | |
bool | contains (Angle a) const |
Check whether the interval includes the given angle. | |
Coord | extent () const |
Extent of the angle interval. | |
Coord | sweepAngle () const |
Get the sweep angle of the interval. | |
bool | operator== (AngleInterval const &other) const |
Check another interval for equality. | |
Static Public Member Functions | |
static AngleInterval | create_full (Angle start, bool sweep=true) |
Private Attributes | |
Angle | _start_angle |
Angle | _end_angle |
bool | _sweep |
bool | _full |
Directed angular interval.
Wrapper for directed angles with defined start and end values. Useful e.g. for representing the portion of an ellipse in an elliptical arc. Both extreme angles are contained in the interval (it is a closed interval). Angular intervals can also be interptered as functions \(f: [0, 1] \to [-\pi, \pi)\), which return the start angle for 0, the end angle for 1, and interpolate linearly for other values. Note that such functions are not continuous if the interval crosses the angle \(\pi\).
This class can represent all directed angular intervals, including empty ones. However, not all possible intervals can be created with the constructors. For full control, use the setInitial(), setFinal() and setAngles() methods.
Create an angular interval from two angles and direction.
If the initial and final angle are the same, a degenerate interval (containing only one angle) will be created.
s | Starting angle |
e | Ending angle |
cw | Which direction the interval goes. True means that it goes in the direction of increasing angles, while false means in the direction of decreasing angles. |
|
inline |
Create an angular interval from three angles.
If the inner angle is exactly equal to initial or final angle, the sweep flag will be set to true, i.e. the interval will go in the direction of increasing angles.
If the initial and final angle are the same, but the inner angle is different, a full angle in the direction of increasing angles will be created.
s | Initial angle |
inner | Angle contained in the interval |
e | Final angle |
Get an angle corresponding to the specified time value.
Definition at line 288 of file angle.h.
References _start_angle, _sweep, extent(), and Geom::Angle::radians0().
Referenced by Geom::EllipticalArc::angleAt(), Geom::make_angle_bisector_line(), operator()(), and TEST().
|
inline |
Check whether the interval includes the given angle.
Definition at line 326 of file angle.h.
References _end_angle, _full, _start_angle, _sweep, and Geom::Angle::radians0().
Referenced by Geom::EllipticalArc::_intersectSameEllipse(), Geom::xAx::arc_contains(), Geom::EllipticalArc::boundsExact(), Geom::EllipticalArc::containsAngle(), Geom::EllipticalArc::expandToTransformed(), TEST(), TEST(), and Geom::EllipticalArc::winding().
|
inlinestatic |
|
inline |
Extent of the angle interval.
Equivalent to the absolute value of the sweep angle.
Definition at line 342 of file angle.h.
References _end_angle, _full, _start_angle, and _sweep.
Referenced by SPGenericEllipse::_isSlice(), angleAt(), Geom::EllipticalArc::angularExtent(), TEST(), TEST(), TEST(), TEST(), and timeAtAngle().
|
inline |
Get the end angle.
Definition at line 231 of file angle.h.
References _end_angle.
Referenced by Geom::EllipticalArc::_intersectSameEllipse(), Geom::EllipticalArc::finalAngle(), and SPGenericEllipse::normalize().
|
inline |
Get the start angle.
Definition at line 229 of file angle.h.
References _start_angle.
Referenced by Geom::EllipticalArc::_intersectSameEllipse(), Geom::EllipticalArc::initialAngle(), and SPGenericEllipse::normalize().
|
inline |
Check whether the interval contains only a single angle.
Definition at line 235 of file angle.h.
References _end_angle, _full, and _start_angle.
|
inline |
Check whether the interval contains all angles.
Definition at line 239 of file angle.h.
References _end_angle, _full, and _start_angle.
Referenced by Geom::EllipticalArc::boundsExact(), Geom::EllipticalArc::expandToTransformed(), and Geom::EllipticalArc::winding().
|
inline |
Check another interval for equality.
Definition at line 361 of file angle.h.
References _end_angle, _full, _start_angle, and _sweep.
|
inline |
Reverse the direction of the interval while keeping contained values the same.
Definition at line 275 of file angle.h.
References _end_angle, _start_angle, and _sweep.
Referenced by Geom::EllipticalArc::reverse().
|
inline |
Set both angles at once.
The direction (sweep flag) is left unchanged.
s | Initial angle |
e | Final angle |
prefer_full | Whether to set a full interval when the passed initial and final angle are the same |
Definition at line 266 of file angle.h.
References _end_angle, _full, and _start_angle.
Referenced by Geom::EllipticalArc::_updateCenterAndAngles(), and Geom::EllipticalArc::portion().
|
inline |
Set the final angle.
a | Angle to set |
prefer_full | Whether to set a full angular interval when the initial angle is set to the final angle |
Definition at line 256 of file angle.h.
References _end_angle, _full, and _start_angle.
Referenced by Geom::EllipticalArc::_updateCenterAndAngles(), and Geom::EllipticalArc::operator*=().
|
inline |
Set the initial angle.
a | Angle to set |
prefer_full | Whether to set a full angular interval when the initial angle is set to the final angle |
Definition at line 247 of file angle.h.
References _end_angle, _full, and _start_angle.
Referenced by Geom::EllipticalArc::_updateCenterAndAngles(), and Geom::EllipticalArc::operator*=().
|
inline |
Set whether the interval goes in the direction of increasing angles.
Definition at line 272 of file angle.h.
References _sweep.
Referenced by Geom::EllipticalArc::_updateCenterAndAngles(), Geom::EllipticalArc::operator*=(), Geom::EllipticalArc::portion(), Geom::EllipticalArc::set(), and Geom::EllipticalArc::set().
|
inline |
Check whether the interval goes in the direction of increasing angles.
Definition at line 233 of file angle.h.
References _sweep.
Referenced by create_full(), and Geom::EllipticalArc::sweep().
|
inline |
Get the sweep angle of the interval.
This is the value you need to add to the initial angle to get the final angle. It is positive when sweep is true. Denoted as \(\Delta\theta\) in the SVG elliptical arc implementation notes.
Definition at line 352 of file angle.h.
References _end_angle, _full, _start_angle, _sweep, and Geom::Angle::radians0().
Referenced by Geom::EllipticalArc::sweepAngle(), and TEST().
Compute a time value that would evaluate to the given angle.
If the start and end angle are exactly the same, NaN will be returned. Negative values will be returned for angles between the initial angle and the angle exactly opposite the midpoint of the interval.
Definition at line 299 of file angle.h.
References _full, _start_angle, _sweep, extent(), and Geom::Angle::radians0().
Referenced by TEST(), and Geom::EllipticalArc::timeAtAngle().
|
private |
Definition at line 379 of file angle.h.
Referenced by contains(), extent(), finalAngle(), isDegenerate(), isFull(), operator==(), reverse(), setAngles(), setFinal(), setInitial(), and sweepAngle().
|
private |
Definition at line 381 of file angle.h.
Referenced by AngleInterval(), contains(), extent(), isDegenerate(), isFull(), operator==(), setAngles(), setFinal(), setInitial(), sweepAngle(), and timeAtAngle().
|
private |
Definition at line 378 of file angle.h.
Referenced by angleAt(), contains(), create_full(), extent(), initialAngle(), isDegenerate(), isFull(), operator==(), reverse(), setAngles(), setFinal(), setInitial(), sweepAngle(), and timeAtAngle().
|
private |
Definition at line 380 of file angle.h.
Referenced by angleAt(), AngleInterval(), contains(), extent(), operator==(), reverse(), setSweep(), sweep(), sweepAngle(), and timeAtAngle().