24 #ifndef GNASH_POINT2DH 25 #define GNASH_POINT2DH 56 constexpr
Point2d(std::int32_t cx, std::int32_t cy)
70 x( p0.x + (
std::int32_t)((p1.x - p0.x) * t)),
71 y( p0.y + (
std::int32_t)((p1.y - p0.y) * t))
96 x = p0.
x + (std::int32_t)((p1.
x - p0.
x) *
t);
97 y = p0.
y + (std::int32_t)((p1.
y - p0.
y) *
t);
105 std::int64_t hside = p1.
x - p0.
x;
106 std::int64_t vside = p1.
y - p0.
y;
108 return hside*hside + vside*vside;
120 return (std::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 constexpr Point2d()
Construct a Point2d with default x and y coordinates.
Definition: Point2d.h:49
geometry::Point2d point
Definition: Point2d.h:143
Point2d(const Point2d &p0, const Point2d &p1, float t)
Construct a Point2d as an interpolation of the given input points.
Definition: Point2d.h:68
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:40
Point2d & setTo(const std::int32_t cx, const std::int32_t cy)
Set coordinates to given values.
Definition: Point2d.h:79
bool operator==(const Point2d &p) const
Definition: Point2d.h:123
2D Point class
Definition: Point2d.h:38
std::int64_t squareDistance(const Point2d &p) const
Return square distance between this and the given point.
Definition: Point2d.h:112
std::ostream & operator<<(std::ostream &os, const Point2d &p)
Output operator.
Definition: Point2d.h:136
Definition: GnashKey.h:166
bool operator!=(const Point2d &p) const
Definition: Point2d.h:128
std::int32_t distance(const Point2d &p) const
Return distance between this and the given point.
Definition: Point2d.h:118
std::int32_t y
The y coordinate.
Definition: Point2d.h:46
std::int32_t x
The x coordinate.
Definition: Point2d.h:43
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
constexpr Point2d(std::int32_t cx, std::int32_t cy)
Construct a Point2d with given x and y ordinates.
Definition: Point2d.h:56
static std::int64_t squareDistance(const Point2d &p0, const Point2d &p1)
Return square distance between two given points.
Definition: Point2d.h:103