Inkscape
Vector Graphics Editor
|
Wrapper for angular values. More...
#include <angle.h>
Public Member Functions | |
Angle () | |
Angle (Coord v) | |
Angle (Point const &p) | |
Angle (Point const &a, Point const &b) | |
operator Coord () const | |
Angle & | operator+= (Angle o) |
Angle & | operator-= (Angle o) |
Angle & | operator+= (Coord a) |
Angle & | operator-= (Coord a) |
bool | operator== (Angle o) const |
bool | operator== (Coord c) const |
Coord | radians () const |
Get the angle as radians. | |
Coord | radians0 () const |
Get the angle as positive radians. | |
Coord | degrees () const |
Get the angle as degrees in math convention. | |
Coord | degreesClock () const |
Get the angle as degrees in clock convention. | |
Static Public Member Functions | |
static Angle | from_radians (Coord d) |
Create an angle from its measure in radians. | |
static Angle | from_degrees (Coord d) |
Create an angle from its measure in degrees. | |
static Angle | from_degrees_clock (Coord d) |
Create an angle from its measure in degrees in clock convention. | |
Private Member Functions | |
void | _normalize () |
Private Attributes | |
Coord | _angle |
Friends | |
class | AngleInterval |
Related Symbols | |
(Note that these are not member symbols.) | |
constexpr Coord | rad_from_deg (Coord deg) |
Given an angle in degrees, return radians. | |
constexpr Coord | deg_from_rad (Coord rad) |
Given an angle in radians, return degrees. | |
Wrapper for angular values.
This class is a convenience wrapper that implements the behavior generally expected of angles, like addition modulo \(2\pi\). The value returned from the default conversion to double
is in the range \([-\pi, \pi)\) - the convention used by C's math library.
This class holds only a single floating point value, so passing it by value will generally be faster than passing it by const reference.
|
inline |
Definition at line 75 of file angle.h.
Referenced by operator+=(), operator-=(), and operator==().
|
inline |
Definition at line 76 of file angle.h.
References _normalize().
|
inlineexplicit |
Definition at line 77 of file angle.h.
References _normalize().
Definition at line 78 of file angle.h.
References _normalize().
|
inlineprivate |
Definition at line 154 of file angle.h.
References _angle.
Referenced by Angle(), Angle(), Angle(), operator+=(), and operator-=().
|
inline |
Get the angle as degrees in math convention.
Definition at line 118 of file angle.h.
References radians().
Referenced by radians_to_degree_mod360().
|
inline |
Get the angle as degrees in clock convention.
This method converts the angle to the "clock convention": angles start from the +Y axis and grow clockwise. This means that 0 corresponds to \(\pi/2\) radians, 90 to 0 radians, 180 to \(-\pi/2\) radians, and 270 to \(\pi\) radians.
Definition at line 125 of file angle.h.
References _angle.
Create an angle from its measure in degrees.
Definition at line 136 of file angle.h.
Referenced by Inkscape::UI::Widget::OKWheel::_curColorWheelCoords(), degree_to_radians_mod2pi(), Inkscape::LivePathEffect::LPESimplify::generateHelperPathAndSmooth(), SPGenericEllipse::position_set(), Inkscape::UI::Toolbar::Box3DToolbar::set_button_and_adjustment(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and Inkscape::Colors::Space::OkLch::toOkLab().
Create an angle from its measure in degrees in clock convention.
Definition at line 142 of file angle.h.
References _angle.
Create an angle from its measure in radians.
Definition at line 131 of file angle.h.
Referenced by radians_to_degree_mod360().
|
inline |
Definition at line 80 of file angle.h.
References _angle, and _normalize().
Definition at line 85 of file angle.h.
References _angle, and _normalize().
|
inline |
|
inline |
|
inline |
Get the angle as radians.
Definition at line 107 of file angle.h.
References _angle.
Referenced by degree_to_radians_mod2pi(), degrees(), operator Coord(), Geom::Ellipse::operator*=(), and Geom::EllipticalArc::toSBasis().
|
inline |
Get the angle as positive radians.
Definition at line 112 of file angle.h.
References _angle.
Referenced by Inkscape::UI::Widget::OKWheel::_discColor(), Inkscape::UI::Widget::OKWheel::_setColor(), Geom::AngleInterval::angleAt(), Geom::Ellipse::are_near(), Geom::AngleInterval::contains(), Geom::distance(), Inkscape::Colors::Space::OkHsl::fromOkLab(), Inkscape::Colors::Space::OkLch::fromOkLab(), SPGenericEllipse::normalize(), Geom::Point::polar(), SPGenericEllipse::position_set(), Geom::AngleInterval::sweepAngle(), Geom::Ellipse::timeAt(), and Geom::AngleInterval::timeAtAngle().
|
friend |
|
private |
Definition at line 159 of file angle.h.
Referenced by _normalize(), degreesClock(), from_degrees_clock(), operator+=(), operator-=(), operator==(), operator==(), radians(), and radians0().