35 #ifndef NAV_CORE2_BOUNDS_H 36 #define NAV_CORE2_BOUNDS_H 48 template <
typename NumericType>
67 GenericBounds(NumericType x0, NumericType y0, NumericType x1, NumericType y1)
75 min_x_ =
min_y_ = std::numeric_limits<NumericType>::max();
76 max_x_ =
max_y_ = std::numeric_limits<NumericType>::lowest();
82 void touch(NumericType x, NumericType y)
97 void update(NumericType x0, NumericType y0, NumericType x1, NumericType y1)
129 return "(" + std::to_string(
min_x_) +
"," + std::to_string(
min_y_) +
"):(" +
130 std::to_string(
max_x_) +
"," + std::to_string(
max_y_) +
")";
134 return "(empty bounds)";
159 #endif // NAV_CORE2_BOUNDS_H
GenericBounds(NumericType x0, NumericType y0, NumericType x1, NumericType y1)
Constructor for a non-empty initial bounds.
NumericType getMaxX() const
NumericType getMinX() const
GenericBounds()
Constructor for an empty bounds.
NumericType getMinY() const
void reset()
Reset the bounds to be empty.
void touch(NumericType x, NumericType y)
Update the bounds to include the point (x, y)
void update(NumericType x0, NumericType y0, NumericType x1, NumericType y1)
Update the bounds to include points (x0, y0) and (x1, y1)
bool isEmpty() const
Returns true if the range is empty.
void merge(const GenericBounds< NumericType > &other)
Update the bounds to include the entirety of another bounds object.
std::string toString() const
Returns a string representation of the bounds.
Templatized class that represents a two dimensional bounds with ranges [min_x, max_x] [min_y...
unsigned int getHeight() const
unsigned int getWidth() const
NumericType getMaxY() const