Bbox2 is an axis aligned 2D bounding box.
More...
#include <Bbox2.h>
|
void | treatPointForInvalidBox (const Point2 &p) |
|
void | treatPointForValidBox (const Point2 &p) |
|
|
bool | bValid |
|
double | maxX |
|
double | maxY |
|
double | minX |
|
double | minY |
|
GeomTest * | pGeomTest |
|
|
std::ostream & | operator<< (std::ostream &stream, Bbox2 &pC) |
|
◆ Bbox2()
Bbox2::Bbox2 |
( |
GeomTest * |
pGeomTest_ = NULL | ) |
|
|
inlineexplicit |
Minimum bounds are initialized to DBL_MAX. Maximum bounds are initialized to -DBL_MAX. Box is not valid yet
◆ add() [1/4]
bool Bbox2::add |
( |
const Point2 & |
p | ) |
|
|
inline |
Extends the 2D bounding box if required.
- Returns
- true if the bounding box changes, false otherwise
◆ add() [2/4]
bool Bbox2::add |
( |
size_t |
numPoints, |
|
|
double * |
coordinates |
|
) |
| |
|
inline |
Extends the 2D bounding box if required.
- Returns
- true if the bounding box changes, false otherwise
◆ add() [3/4]
bool Bbox2::add |
( |
std::vector< Point2 * >::const_iterator |
start_it, |
|
|
std::vector< Point2 * >::const_iterator |
end_it |
|
) |
| |
|
inline |
Extends the 2D bounding box if required.
- Returns
- true if the bounding box changes, false otherwise
◆ add() [4/4]
bool Bbox2::add |
( |
std::vector< Point2 >::const_iterator |
start_it, |
|
|
std::vector< Point2 >::const_iterator |
end_it |
|
) |
| |
|
inline |
Extends the 2D bounding box if required.
- Returns
- true if the bounding box changes, false otherwise
◆ computeCenter()
Point2 Bbox2::computeCenter |
( |
| ) |
const |
◆ doIntersect()
bool Bbox2::doIntersect |
( |
const Bbox2 & |
other | ) |
const |
Two valid bounding boxes intersect if they share at least one point in the XY plane.
◆ doubleTheBox()
void Bbox2::doubleTheBox |
( |
| ) |
|
Changes the bounds such that the box grows in each direction by half the previous range
◆ get_maxX()
double Bbox2::get_maxX |
( |
| ) |
const |
|
inline |
◆ get_maxY()
double Bbox2::get_maxY |
( |
| ) |
const |
|
inline |
◆ get_minX()
double Bbox2::get_minX |
( |
| ) |
const |
|
inline |
◆ get_minY()
double Bbox2::get_minY |
( |
| ) |
const |
|
inline |
◆ getBounds()
void Bbox2::getBounds |
( |
double & |
minX_, |
|
|
double & |
maxX_, |
|
|
double & |
minY_, |
|
|
double & |
maxY_ |
|
) |
| const |
◆ getCorners()
void Bbox2::getCorners |
( |
std::vector< Point2 > & |
vBoxCorners | ) |
const |
Convenience function: Returns the 4 corners of the bounding box
◆ getMaxCoord()
double Bbox2::getMaxCoord |
( |
| ) |
const |
|
inline |
- Returns
- the largest coordinate value, i.e. max(maxX,maxY)
◆ getMaxPoint()
Point2 Bbox2::getMaxPoint |
( |
| ) |
const |
|
inline |
- Returns
- the 2D corner point with the maximum coordinates
◆ getMaxRange()
double Bbox2::getMaxRange |
( |
| ) |
const |
|
inline |
◆ getMinCoord()
double Bbox2::getMinCoord |
( |
| ) |
const |
|
inline |
- Returns
- the smallest coordinate value, i.e. min(minX,minY)
◆ getMinPoint()
Point2 Bbox2::getMinPoint |
( |
| ) |
const |
|
inline |
- Returns
- the 2D corner point with the minimum coordinates
◆ getOffsetCorners()
void Bbox2::getOffsetCorners |
( |
double |
offset, |
|
|
std::vector< Point2 > & |
vBoxCorners |
|
) |
| const |
Convenience function: Returns the 4 corners of an enlarged box. The box es enlarged by offset
in each direction
◆ getRangeX()
double Bbox2::getRangeX |
( |
| ) |
const |
|
inline |
◆ getRangeY()
double Bbox2::getRangeY |
( |
| ) |
const |
|
inline |
◆ inflateIfDegenerate()
void Bbox2::inflateIfDegenerate |
( |
double |
val | ) |
|
|
inline |
When only one point has been added to Bbox2 or when all points have the same x- and/or y- coordinates then Bbox2 is degenerate. This is a valid state but sometimes undesireable. The present method inflates the Bbox2 by adding /p val to maxX and/or maxY.
◆ isInBox()
bool Bbox2::isInBox |
( |
const Point2 & |
p | ) |
const |
- Returns
- true if minX <= p.x() <=maxX and minY <= p.y() <=maxY or false otherwise.
◆ isValid()
bool Bbox2::isValid |
( |
| ) |
const |
|
inline |
The bounds are valid when at least one point has been added or when set-methods have been used to set minX<=maxX and minY<=maxY
◆ operator+()
Extends the 2D bounding box if required.
- Returns
- the resulting bounding box
The documentation for this class was generated from the following file: