started adding floorplan LINT

new helper methods
This commit is contained in:
2017-03-20 12:10:34 +01:00
parent 06e0e0a5aa
commit 3868e42937
4 changed files with 90 additions and 4 deletions

View File

@@ -37,7 +37,7 @@ public:
}
/** returns true if the bbox is not yet configured */
const bool isInvalid() const {
bool isInvalid() const {
return p1.x == MAX || p1.y == MAX || p2.x == MIN || p2.y == MIN;
}
@@ -47,6 +47,9 @@ public:
/** get the bbox's maximum */
const Point2& getMax() const {return p2;}
/** get the bbox's size [max-min] */
const Point2 getSize() const {return p2-p1;}
/** get the bbox's center point */
Point2 getCenter() const { return (p1+p2) / 2; }

View File

@@ -61,6 +61,10 @@ struct Point2 {
return std::sqrt(dx*dx + dy*dy);
}
std::string asString() const {
return "(" + std::to_string(x) + "," + std::to_string(y) + ")";
}
};
inline void swap(Point2& p1, Point2& p2) {