Go to the documentation of this file.
35 #ifndef NAV_CORE2_BOUNDS_H
36 #define NAV_CORE2_BOUNDS_H
51 template <
typename NumericType>
52 inline bool inRange(
const NumericType value,
const NumericType min_value,
const NumericType max_value)
54 return min_value <= value && value <= max_value;
61 template <
typename NumericType>
80 GenericBounds(NumericType x0, NumericType y0, NumericType x1, NumericType y1)
88 min_x_ =
min_y_ = std::numeric_limits<NumericType>::max();
89 max_x_ =
max_y_ = std::numeric_limits<NumericType>::lowest();
95 void touch(NumericType x, NumericType y)
110 void update(NumericType x0, NumericType y0, NumericType x1, NumericType y1)
174 return "(" + std::to_string(
min_x_) +
"," + std::to_string(
min_y_) +
"):(" +
175 std::to_string(
max_x_) +
"," + std::to_string(
max_y_) +
")";
179 return "(empty bounds)";
194 inline unsigned int getDimension(
unsigned int min_v,
unsigned int max_v)
196 return (min_v > max_v) ? 0 : max_v - min_v + 1;
209 #endif // NAV_CORE2_BOUNDS_H
NumericType getMinY() const
bool isEmpty() const
Returns true if the range is empty.
unsigned int getWidth() const
bool inRange(const NumericType value, const NumericType min_value, const NumericType max_value)
Templatized method for checking if a value falls inside a one-dimensional range.
Templatized class that represents a two dimensional bounds with ranges [min_x, max_x] [min_y,...
void reset()
Reset the bounds to be empty.
bool overlaps(const GenericBounds< NumericType > &other) const
returns true if the two bounds overlap each other
unsigned int getDimension(unsigned int min_v, unsigned int max_v)
unsigned int getHeight() const
std::string toString() const
Returns a string representation of the bounds.
bool contains(NumericType x, NumericType y) const
Returns true if the point is inside this range.
NumericType getMinX() const
bool operator!=(const GenericBounds< NumericType > &other) const
bool operator==(const GenericBounds< NumericType > &other) const
comparison operator that requires all fields are equal
NumericType getMaxX() const
NumericType getMaxY() const
void touch(NumericType x, NumericType y)
Update the bounds to include the point (x, y)
GenericBounds(NumericType x0, NumericType y0, NumericType x1, NumericType y1)
Constructor for a non-empty initial bounds.
GenericBounds()
Constructor for an empty bounds.
void merge(const GenericBounds< NumericType > &other)
Update the bounds to include the entirety of another bounds object.
void update(NumericType x0, NumericType y0, NumericType x1, NumericType y1)
Update the bounds to include points (x0, y0) and (x1, y1)
nav_core2
Author(s):
autogenerated on Sun May 18 2025 02:47:17