Hot Door CORE 0.8.3
Adobe® Illustrator® Plug-in Library
Loading...
Searching...
No Matches
hdicorePoint.h
Go to the documentation of this file.
1
7#ifndef __HDI_CORE_POINT__
8#define __HDI_CORE_POINT__
9
10#include <memory>
11#include <vector>
12
13#include "hdicoreAngle.h"
14
15namespace hdi
16{
17 #if defined(HDI_CORE_AIP_MODE)
18 namespace aip
19 {
20 class Point;
21 }
22 #elif defined(HDI_CORE_PSP_MODE)
23 namespace psp
24 {
25 class Point;
26 }
27 #endif
28
29 namespace core
30 {
31 class TransformMatrix;
32
37 class Point
38 {
39 public:
40 typedef std::vector<Point> PointVector;
41
45 double x;
46
50 double y;
51
58
67 Point(const double x_, const double y_);
68
76 Point(const Point& pt_);
77
83 virtual ~Point();
84
94 static Point LengthAngle(const double length_, const Angle& angle_);
95
104 virtual Point& operator=(const Point& rhs_);
105
114 virtual bool operator==(const Point& rhs_) const;
115
124 virtual bool operator!=(const Point& rhs_) const;
125
134 virtual Point operator+(const Point& rhs_) const;
135
144 virtual Point& operator+=(const Point& rhs_);
145
154 virtual Point operator-(const Point& rhs_) const;
155
164 virtual Point& operator-=(const Point& rhs_);
165
174 virtual Angle operator^(const Point& rhs_) const;
175
184 virtual double operator|(const Point& rhs_) const;
185
195 virtual bool closeTo(const Point& compare_, const double tol_) const;
196
205 virtual double dotProduct(const Point& p2_) const;
206
219 virtual Point offset(const double tx_, const double ty_) const;
220
230 virtual Point rotate(const Point& origin_, const Angle& angle_) const;
231
241 virtual Point move(const double length_, const Angle& angle_) const;
242
251 virtual Point transform(const TransformMatrix& m_) const;
252
261 virtual bool insidePolygon(const PointVector& points_) const;
262
263
264 private:
265 #if defined(HDI_CORE_AIP_MODE)
266 friend aip::Point* __accessImpl(const Point&);
267 friend Point __accessCtor(const aip::Point&);
268
272 aip::Point* __impl;
273
279 Point(const aip::Point&);
280 #elif defined(HDI_CORE_PSP_MODE)
281 friend psp::Point* __accessImpl(const Point&);
282 friend Point __accessCtor(const psp::Point&);
283
287 psp::Point* __impl;
288
294 Point(const psp::Point&);
295 #endif
296 };
297
298 typedef std::unique_ptr<Point> PointUP;
299 typedef std::shared_ptr<Point> PointSP;
300 typedef std::weak_ptr<Point> PointWP;
301
302 #if defined(HDI_CORE_AIP_MODE)
303 extern aip::Point* __accessImpl(const Point&);
304 extern Point __accessCtor(const aip::Point&);
305 #elif defined(HDI_CORE_PSP_MODE)
306 extern psp::Point* __accessImpl(const Point&);
307 extern Point __accessCtor(const psp::Point&);
308 #endif
309 }
310}
311
312#endif
313// __HDI_CORE_POINT__
Describes an angle, and allows for easy conversion between various units.
Definition: hdicoreAngle.h:26
Describes a point in the 2-dimensional (x,y) coordinate system, typically in an Illustrator document ...
Definition: hdicorePoint.h:38
virtual Point rotate(const Point &origin_, const Angle &angle_) const
Rotates the point about a given "origin" point by a certain angle.
virtual Point & operator+=(const Point &rhs_)
Allows two points to have their x and y values added and assigned using the += operator.
virtual Point & operator=(const Point &rhs_)
Sets a Point object from another Point object.
static Point LengthAngle(const double length_, const Angle &angle_)
"Named constructor" for a point that is a given length and angle away from the origin
virtual bool operator==(const Point &rhs_) const
Tests whether a given Point object is the same as another.
virtual ~Point()
Point destructor.
virtual double dotProduct(const Point &p2_) const
Gets the dot product of two Point objects.
virtual double operator|(const Point &rhs_) const
Gets the distance between this and rhs_.
virtual Point operator+(const Point &rhs_) const
Allows two points to have their x and y values added using the + operator.
Point(const double x_, const double y_)
Point constructor, taking x and y arguments.
virtual Point offset(const double tx_, const double ty_) const
Offsets a point along the x- and y-axes by given amounts.
Point()
Default Point constructor; sets x and y to 0.0.
virtual Point & operator-=(const Point &rhs_)
Allows two points to have their x and y values subtracted and assigned using the -= operator.
virtual Point transform(const TransformMatrix &m_) const
Transforms a point via a 2-dimensional transformation matrix.
virtual bool closeTo(const Point &compare_, const double tol_) const
Gets whether a given point is within a certain tolerance ("close to") the target point.
virtual bool insidePolygon(const PointVector &points_) const
Checks if the point is within the provided polygon.
virtual Angle operator^(const Point &rhs_) const
Gets the angle of the vector (this, rhs_), if this were moved to the origin.
virtual bool operator!=(const Point &rhs_) const
Tests whether a given Point object is not the same as another.
virtual Point operator-(const Point &rhs_) const
Allows two points to have their x and y values subtracted using the - operator.
double x
Position on the x-axis.
Definition: hdicorePoint.h:45
Point(const Point &pt_)
Point copy constructor.
double y
Position on the y-axis.
Definition: hdicorePoint.h:50
virtual Point move(const double length_, const Angle &angle_) const
"Moves" a point by a given length and angle away from its current position
Allows for 2-dimensional transformations in a single application via matrix math.
Definition: hdicoreTransformMatrix.h:34
Header file for describing angles.