Hot Door CORE 0.8.2
Adobe® Illustrator® Plug-in Library
Loading...
Searching...
No Matches
hdicoreAngle.h
Go to the documentation of this file.
1
7#ifndef __HDI_CORE_ANGLE__
8#define __HDI_CORE_ANGLE__
9
10#include "hdicoreConstants.h"
11#include "hdicoreTypes.h"
12
13namespace hdi
14{
15 namespace geo
16 {
17 class Angle;
18 }
19
20 namespace core
21 {
25 class Angle
26 {
27 public:
31 enum Units
32 {
33 Radians = 1,
34 Degrees = 2,
35 Gradians = 3,
36 Turns = 4
37 };
38
45
54 Angle(const double value_, const Units units_ = Radians);
55
63 Angle(const Angle& angle_);
64
70 virtual ~Angle();
71
81 virtual bool equalWithinTol(const Angle& compare_, const Angle& tol_) const;
82
91 virtual bool operator==(const Angle& rhs_) const;
92
101 virtual bool operator!=(const Angle& rhs_) const;
102
112 virtual bool operator<(const Angle& rhs_) const;
113
123 virtual bool operator<=(const Angle& rhs_) const;
124
134 virtual bool operator>(const Angle& rhs_) const;
135
145 virtual bool operator>=(const Angle& rhs_) const;
146
154 virtual Angle operator-() const;
155
164 virtual Angle operator+(const Angle& rhs_) const;
165
174 virtual Angle operator-(const Angle& rhs_) const;
175
184 virtual Angle operator*(const Angle& rhs_) const;
185
194 virtual Angle operator/(const Angle& rhs_) const;
195
204 virtual Angle& operator=(const Angle& rhs_);
205
215 virtual Angle& operator+=(const Angle& rhs_);
216
226 virtual Angle& operator-=(const Angle& rhs_);
227
237 virtual Angle& operator*=(const Angle& rhs_);
238
248 virtual Angle& operator/=(const Angle& rhs_);
249
258 virtual Angle operator*(const double rhs_) const;
259
268 virtual Angle operator/(const double rhs_) const;
269
278 virtual Angle& operator*=(const double rhs_);
279
288 virtual Angle& operator/=(const double rhs_);
289
297 virtual double asRadians() const;
298
306 virtual double asDegrees() const;
307
315 virtual double asGradians() const;
316
324 virtual double asTurns() const;
325
334 virtual double valueInUnits(const Units units_ = Radians) const;
335
344 virtual void setValueInUnits(const double value_, const Units units_ = Radians);
345
353 virtual Angle range0To2Pi() const;
354
362 virtual Angle rangeNegPiToPi() const;
363
371 virtual Angle nearest45() const;
372
383 virtual Angle constrain0ToPi() const;
384
396
407 virtual Angle constrainPiTo2Pi() const;
408
420
429 virtual Angle bisect(const Angle& angle2_) const;
430
442 virtual Angle delta(const Angle& angle2_) const;
443
451 virtual bool firstQuadrant() const;
452
460 virtual bool secondQuadrant() const;
461
469 virtual bool thirdQuadrant() const;
470
478 virtual bool fourthQuadrant() const;
479
487 virtual int16_t quadrantNumber() const;
488
502 virtual double sin(const double tol_ = 10000.0 * maxDoublePrecision) const;
503
517 virtual double cos(const double tol_ = 10000.0 * maxDoublePrecision) const;
518
532 virtual double tan(const double tol_ = 10000.0 * maxDoublePrecision) const;
533
548 static Angle asin(const double val_, const double tol_ = 10000.0 * maxDoublePrecision);
549
564 static Angle acos(const double val_, const double tol_ = 10000.0 * maxDoublePrecision);
565
580 static Angle atan(const double val_, const double tol_ = 10000.0 * maxDoublePrecision);
581
589 static Angle Zero();
590
598 static Angle Pi();
599
607 static Angle TwoPi();
608
609
610 private:
611 friend geo::Angle* __accessImpl(const Angle&);
612 friend Angle __accessCtor(const geo::Angle&);
613
617 geo::Angle* __impl;
618
624 Angle(const geo::Angle&);
625 };
626
627 typedef std::unique_ptr<Angle> AngleUP;
628 typedef std::shared_ptr<Angle> AngleSP;
629 typedef std::weak_ptr<Angle> AngleWP;
630
631 extern geo::Angle* __accessImpl(const Angle&);
632 extern Angle __accessCtor(const geo::Angle&);
633 }
634}
635
645hdi::core::Angle operator*(const double lhs_, const hdi::core::Angle& rhs_);
646
647#endif
648// __HDI_CORE_ANGLE__
Describes an angle, and allows for easy conversion between various units.
Definition: hdicoreAngle.h:26
virtual double tan(const double tol_=10000.0 *maxDoublePrecision) const
"Safely" computes the tangent of an angle
virtual Angle operator/(const Angle &rhs_) const
Allows one Angle object to be divided by another with the / operator.
static Angle TwoPi()
Convenience method to construct an Angle object for 2*pi radians.
virtual void setValueInUnits(const double value_, const Units units_=Radians)
Sets the value of the target object in the given units.
virtual Angle operator+(const Angle &rhs_) const
Allows two Angle objects to be added together with the + operator.
virtual double sin(const double tol_=10000.0 *maxDoublePrecision) const
"Safely" computes the sine of an angle
static Angle acos(const double val_, const double tol_=10000.0 *maxDoublePrecision)
"Safely" computes the angle for a given cosine value
virtual Angle & operator*=(const double rhs_)
Allows an Angle object to be multipled by a constant, assigning the lefthand object.
virtual Angle operator-(const Angle &rhs_) const
Allows one Angle object to be substracted from another with the - operator.
virtual Angle constrainPiTo2Pi() const
Constrains the target Angle object's value to the range [pi,2pi].
static Angle atan(const double val_, const double tol_=10000.0 *maxDoublePrecision)
"Safely" computes the angle for a given tangent value
virtual ~Angle()
Angle destructor.
virtual bool operator>(const Angle &rhs_) const
Checks if the target angle's value is greater than the provided angle's.
virtual double asTurns() const
Gets the value of the target object in turns.
virtual Angle operator*(const double rhs_) const
Allows an Angle object to be multipled by a constant.
Units
Units supported for angle calculations.
Definition: hdicoreAngle.h:32
virtual Angle bisect(const Angle &angle2_) const
Gets the bisection of the target Angle with a provided Angle on their most acute "side".
Angle(const Angle &angle_)
Angle copy constructor.
virtual bool operator<=(const Angle &rhs_) const
Checks if the target angle's value is less than or equal to the provided angle's.
virtual Angle constrainNegPiOver2ToPiOver2() const
Constrains the target Angle object's value to the range [-pi/2,pi/2].
Angle(const double value_, const Units units_=Radians)
Angle constructor; sets the angle to the provided value.
virtual Angle constrain0ToPi() const
Constrains the target Angle object's value to the range [0,pi].
virtual Angle range0To2Pi() const
Changes the range of the angle value to be in [0,2pi].
virtual bool firstQuadrant() const
Tests if the target Angle lies in the first quadrant, were it from point (0,0)
virtual Angle & operator*=(const Angle &rhs_)
Allows two Angle objects to be multipled together with the * operator, assigning the lefthand object.
virtual Angle operator/(const double rhs_) const
Allows an Angle object to be divided by a constant.
virtual Angle & operator/=(const Angle &rhs_)
Allows one Angle object to be divided by another with the / operator, assigning the lefthand object.
virtual bool operator>=(const Angle &rhs_) const
Checks if the target angle's value is greater than or equal to the provided angle's.
static Angle asin(const double val_, const double tol_=10000.0 *maxDoublePrecision)
"Safely" computes the angle for a given sine value
virtual bool operator!=(const Angle &rhs_) const
Compares two angles for inequality.
virtual bool thirdQuadrant() const
Tests if the target Angle lies in the third quadrant, were it from point (0,0)
virtual Angle & operator=(const Angle &rhs_)
Allows one Angle object to be assigned from another.
virtual Angle nearest45() const
Constrains an angle to the nearest 45-degree (pi/4) interval.
Angle()
Default Angle constructor; sets the angle to 0.0 radians.
virtual Angle & operator/=(const double rhs_)
Allows an Angle object to be divided by a constant, assigning the lefthand object.
virtual int16_t quadrantNumber() const
Gets the quadrant number for the target Angle, were it from point (0,0)
virtual Angle delta(const Angle &angle2_) const
Gets the delta between the target Angle and a provided Angle object.
virtual Angle & operator+=(const Angle &rhs_)
Allows two Angle objects to be added together with the + operator, assigning the lefthand object.
virtual Angle operator-() const
Flips the sign of the target angle.
virtual bool equalWithinTol(const Angle &compare_, const Angle &tol_) const
Checks for two angles being within a given tolerance of one another.
virtual Angle constrainPiOver2To3PiOver2() const
Constrains the target Angle object's value to the range [pi/2,3pi/2].
virtual Angle & operator-=(const Angle &rhs_)
Allows one Angle object to be substracted from another with the - operator, assigning the lefthand ob...
virtual double valueInUnits(const Units units_=Radians) const
Gets the value of the target object in the given units.
static Angle Pi()
Convenience method to construct an Angle object for pi radians.
virtual Angle rangeNegPiToPi() const
Changes the range of the angle value to be in [-pi,pi].
virtual double asRadians() const
Gets the value of the target object in radians.
virtual double asDegrees() const
Gets the value of the target object in degrees.
virtual double cos(const double tol_=10000.0 *maxDoublePrecision) const
"Safely" computes the cosine of an angle
static Angle Zero()
Convenience method to construct an Angle object for zero radians, degrees, etc.
virtual Angle operator*(const Angle &rhs_) const
Allows two Angle objects to be multipled together with the * operator.
virtual double asGradians() const
Gets the value of the target object in gradians.
virtual bool operator<(const Angle &rhs_) const
Checks if the target angle's value is less than the provided angle's.
virtual bool operator==(const Angle &rhs_) const
Compares two angles for equality.
virtual bool fourthQuadrant() const
Tests if the target Angle lies in the fourth quadrant, were it from point (0,0)
virtual bool secondQuadrant() const
Tests if the target Angle lies in the second quadrant, were it from point (0,0)
hdi::core::Angle operator*(const double lhs_, const hdi::core::Angle &rhs_)
Allows a constant to be multipled by an Angle object.
Header file for defining various plugin constants.
Header file for a wide variety of necessary typedefs, enums, and forwards declarations.