diff --git a/core/Common/Point.cpp b/core/Common/Point.cpp index c22cd854..15920994 100644 --- a/core/Common/Point.cpp +++ b/core/Common/Point.cpp @@ -1,4 +1,5 @@ #include "..\e2dcommon.h" +#include e2d::Point::Point() @@ -44,6 +45,14 @@ e2d::Point::operator e2d::Size() const return Size(x, y); } +double e2d::Point::distance(const Point &p1, const Point &p2) +{ + return sqrt( + (p1.x - p2.x) * (p1.x - p2.x) + + (p1.y - p2.y) * (p1.y - p2.y) + ); +} + e2d::Point e2d::Point::operator-() const { return Point(-x, -y); diff --git a/core/e2dcommon.h b/core/e2dcommon.h index 900c679f..e5cf4ecc 100644 --- a/core/e2dcommon.h +++ b/core/e2dcommon.h @@ -48,6 +48,9 @@ public: bool operator== (const Point& point) const; operator e2d::Size() const; + + // ÅжÏÁ½µã¼ä¾àÀë + static double distance(const Point&, const Point&); };