24 #ifndef GNASH_POINT2DH
25 #define GNASH_POINT2DH
29 #include <boost/cstdint.hpp>
56 Point2d(boost::int32_t cx, boost::int32_t cy)
70 x( p0.
x + (boost::int32_t)((p1.
x - p0.
x) * t)),
71 y( p0.
y + (boost::int32_t)((p1.
y - p0.
y) * t))
96 x = p0.
x + (boost::int32_t)((p1.
x - p0.
x) *
t);
97 y = p0.
y + (boost::int32_t)((p1.
y - p0.
y) *
t);
105 boost::int64_t hside = p1.
x - p0.
x;
106 boost::int64_t vside = p1.
y - p0.
y;
108 return hside*hside + vside*vside;
120 return (boost::int32_t)( std::sqrt( static_cast<double>(
squareDistance(p)) ) );
125 return (
x == p.
x) && (
y == p.
y);
130 return ! (*
this ==
p);
138 return os <<
"Point2d(" << p.
x <<
"," << p.
y <<
")";
147 #endif // GNASH_POINT2DH
geometry::Point2d point
Definition: Point2d.h:143
boost::int32_t x
The x coordinate.
Definition: Point2d.h:43
bool operator!=(const Point2d &p) const
Definition: Point2d.h:128
Point2d(const Point2d &p0, const Point2d &p1, float t)
Construct a Point2d as an interpolation of the given input points.
Definition: Point2d.h:68
2D Point class
Definition: Point2d.h:38
Point2d(boost::int32_t cx, boost::int32_t cy)
Construct a Point2d with given x and y ordinates.
Definition: Point2d.h:56
std::ostream & operator<<(std::ostream &os, const Point2d &p)
Output operator.
Definition: Point2d.h:136
Definition: GnashKey.h:166
boost::int64_t squareDistance(const Point2d &p) const
Return square distance between this and the given point.
Definition: Point2d.h:112
Point2d()
Construct a Point2d with default x and y coordinates.
Definition: Point2d.h:49
bool operator==(const Point2d &p) const
Definition: Point2d.h:123
boost::int32_t distance(const Point2d &p) const
Return distance between this and the given point.
Definition: Point2d.h:118
Definition: GnashKey.h:162
Point2d & setTo(const Point2d &p0, const Point2d &p1, float t)
Set coordinates to the ones of the interpolation between the given input points.
Definition: Point2d.h:94
Point2d & setTo(const boost::int32_t cx, const boost::int32_t cy)
Set coordinates to given values.
Definition: Point2d.h:79
static boost::int64_t squareDistance(const Point2d &p0, const Point2d &p1)
Return square distance between two given points.
Definition: Point2d.h:103
boost::int32_t y
The y coordinate.
Definition: Point2d.h:46