started adding floorplan LINT
new helper methods
This commit is contained in:
@@ -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; }
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user