new helper methods
adjusted wall intersection
This commit is contained in:
@@ -44,6 +44,7 @@ struct Point2 {
|
||||
|
||||
bool operator != (const Point2& o) const {return x!=o.x || y!=o.y;}
|
||||
|
||||
bool eq (const Point2& o, const float delta) const { return eq(x,o.x,delta) && eq(y,o.y,delta); }
|
||||
|
||||
Point2 perpendicular() const {return Point2(-y, x);}
|
||||
|
||||
@@ -66,6 +67,11 @@ struct Point2 {
|
||||
return "(" + std::to_string(x) + "," + std::to_string(y) + ")";
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
static inline bool eq(const float a, const float b, const float delta) {return std::abs(a-b) <= delta;}
|
||||
static inline bool ne(const float a, const float b, const float delta) {return std::abs(a-b) > delta;}
|
||||
|
||||
};
|
||||
|
||||
inline float dot(const Point2 p1, const Point2 p2) {
|
||||
|
||||
Reference in New Issue
Block a user