Hot Door CORE  0.7.0
Adobe® Illustrator® Plug-in Library
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 
13 namespace 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 
44  Angle();
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 
395  virtual Angle constrainPiOver2To3PiOver2() const;
396 
407  virtual Angle constrainPiTo2Pi() const;
408 
419  virtual Angle constrainNegPiOver2ToPiOver2() const;
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::auto_ptr<Angle> AngleAP;
628 
629  extern geo::Angle* __accessImpl(const Angle&);
630  extern Angle __accessCtor(const geo::Angle&);
631  }
632 }
633 
643 hdi::core::Angle operator*(const double lhs_, const hdi::core::Angle& rhs_);
644 
645 #endif
646 // __HDI_CORE_ANGLE__
static Angle TwoPi()
Convenience method to construct an Angle object for 2*pi radians.
Units
Units supported for angle calculations.
Definition: hdicoreAngle.h:31
virtual Angle rangeNegPiToPi() const
Changes the range of the angle value to be in [-pi,pi].
virtual Angle delta(const Angle &angle2_) const
Gets the delta between the target Angle and a provided Angle object.
virtual double asTurns() const
Gets the value of the target object in turns.
virtual bool operator<(const Angle &rhs_) const
Checks if the target angle's value is less than the provided angle's.
virtual Angle range0To2Pi() const
Changes the range of the angle value to be in [0,2pi].
virtual double tan(const double tol_=10000.0 *maxDoublePrecision) const
"Safely" computes the tangent of an angle
virtual Angle constrainNegPiOver2ToPiOver2() const
Constrains the target Angle object's value to the range [-pi/2,pi/2].
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 bool operator!=(const Angle &rhs_) const
Compares two angles for inequality.
static Angle asin(const double val_, const double tol_=10000.0 *maxDoublePrecision)
"Safely" computes the angle for a given sine value
virtual Angle operator+(const Angle &rhs_) const
Allows two Angle objects to be added together with the + operator.
virtual ~Angle()
Angle destructor.
virtual void setValueInUnits(const double value_, const Units units_=Radians)
Sets the value of the target object in the given units.
virtual double asDegrees() const
Gets the value of the target object in degrees.
virtual bool operator>(const Angle &rhs_) const
Checks if the target angle's value is greater than the provided angle's.
virtual bool equalWithinTol(const Angle &compare_, const Angle &tol_) const
Checks for two angles being within a given tolerance of one another.
virtual double valueInUnits(const Units units_=Radians) const
Gets the value of the target object in the given units.
virtual double sin(const double tol_=10000.0 *maxDoublePrecision) const
"Safely" computes the sine of an angle
Angle()
Default Angle constructor; sets the angle to 0.0 radians.
virtual Angle constrainPiTo2Pi() const
Constrains the target Angle object's value to the range [pi,2pi].
virtual Angle operator-() const
Flips the sign of the target angle.
Header file for a wide variety of necessary typedefs, enums, and forwards declarations.
static Angle Pi()
Convenience method to construct an Angle object for pi radians.
virtual Angle constrainPiOver2To3PiOver2() const
Constrains the target Angle object's value to the range [pi/2,3pi/2].
virtual double asGradians() const
Gets the value of the target object in gradians.
Definition: hdicoreaiArray.h:12
virtual bool operator==(const Angle &rhs_) const
Compares two angles for equality.
Header file for defining various Illustrator plugin constants.
virtual Angle & operator*=(const Angle &rhs_)
Allows two Angle objects to be multipled together with the * operator, assigning the lefthand object...
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 two Angle objects to be added together with the + operator, assigning the lefthand object...
virtual bool secondQuadrant() const
Tests if the target Angle lies in the second quadrant, were it from point (0,0)
virtual Angle & operator=(const Angle &rhs_)
Allows one Angle object to be assigned from another.
virtual double asRadians() const
Gets the value of the target object in radians.
virtual Angle & operator/=(const Angle &rhs_)
Allows one Angle object to be divided by another with the / operator, assigning the lefthand object...
static Angle acos(const double val_, const double tol_=10000.0 *maxDoublePrecision)
"Safely" computes the angle for a given cosine value
hdi::core::Angle operator*(const double lhs_, const hdi::core::Angle &rhs_)
Allows a constant to be multipled by an Angle object.
virtual int16_t quadrantNumber() const
Gets the quadrant number for the target Angle, were it from point (0,0)
virtual Angle operator*(const Angle &rhs_) const
Allows two Angle objects to be multipled together with the * operator.
virtual double cos(const double tol_=10000.0 *maxDoublePrecision) const
"Safely" computes the cosine of an angle
virtual Angle operator/(const Angle &rhs_) const
Allows one Angle object to be divided by another with the / operator.
static Angle atan(const double val_, const double tol_=10000.0 *maxDoublePrecision)
"Safely" computes the angle for a given tangent value
virtual Angle nearest45() const
Constrains an angle to the nearest 45-degree (pi/4) interval.
virtual bool firstQuadrant() const
Tests if the target Angle lies in the first quadrant, were it from point (0,0)
Describes an angle, and allows for easy conversion between various units.
Definition: hdicoreAngle.h:25
virtual bool fourthQuadrant() const
Tests if the target Angle lies in the fourth quadrant, were it from point (0,0)
virtual Angle constrain0ToPi() const
Constrains the target Angle object's value to the range [0,pi].
virtual Angle bisect(const Angle &angle2_) const
Gets the bisection of the target Angle with a provided Angle on their most acute "side".
virtual bool operator>=(const Angle &rhs_) const
Checks if the target angle's value is greater than or equal to the provided angle's.
virtual Angle & operator-=(const Angle &rhs_)
Allows one Angle object to be substracted from another with the - operator, assigning the lefthand ob...
static Angle Zero()
Convenience method to construct an Angle object for zero radians, degrees, etc.