Fade2.5D Documentation pages v1.90
Delaunay Features
GEOM_FADE25D::Bbox2 Class Reference

Bbox2 is an axis aligned 2D bounding box.

#include <Bbox2.h>

Public Member Functions

 Bbox2 (GeomTest *pGeomTest_=NULL)
 Constructor. More...
 
bool add (const Point2 &p)
 Add a point. More...
 
bool add (size_t numPoints, double *coordinates)
 Add points. More...
 
bool add (std::vector< Point2 * >::const_iterator start_it, std::vector< Point2 * >::const_iterator end_it)
 Add points. More...
 
bool add (std::vector< Point2 >::const_iterator start_it, std::vector< Point2 >::const_iterator end_it)
 Add points. More...
 
Point2 computeCenter () const
 Compute the 2D midpoint.
 
bool doIntersect (const Bbox2 &other) const
 Check intersection. More...
 
void doubleTheBox ()
 Double the box. More...
 
void enlargeRanges (double factor)
 
double get_maxX () const
 Get maxX. More...
 
double get_maxY () const
 Get maxY. More...
 
double get_minX () const
 Get minX. More...
 
double get_minY () const
 Get minY. More...
 
void getBoundary (std::vector< Segment2 > &vBoundary) const
 Get boundary. More...
 
void getBounds (double &minX_, double &maxX_, double &minY_, double &maxY_) const
 Get bounds.
 
void getCorners (std::vector< Point2 > &vBoxCorners) const
 Get corners. More...
 
double getMaxCoord () const
 Get maximum coordinate. More...
 
Point2 getMaxPoint () const
 Get the max point. More...
 
double getMaxRange () const
 Get max range. More...
 
double getMinCoord () const
 Get minimum coordinate. More...
 
Point2 getMinPoint () const
 Get the min point. More...
 
void getOffsetCorners (double offset, std::vector< Point2 > &vBoxCorners) const
 Get offset corners. More...
 
double getRangeX () const
 Get x-range. More...
 
double getRangeY () const
 Get y-range. More...
 
void inflateIfDegenerate (double val)
 Inflate if Degenerate. More...
 
bool isInBox (const Point2 &p) const
 Point-in-Box Test. More...
 
bool isValid () const
 Check if the bounds are valid. More...
 
Bbox2 operator+ (const Bbox2 &b)
 Add a bounding box. More...
 
void setMaxX (double val)
 Set maxX.
 
void setMaxY (double val)
 Set maxY.
 
void setMinX (double val)
 Set minX.
 
void setMinY (double val)
 Set minY.
 

Protected Member Functions

void treatPointForInvalidBox (const Point2 &p)
 
void treatPointForValidBox (const Point2 &p)
 

Protected Attributes

bool bValid
 
double maxX
 
double maxY
 
double minX
 
double minY
 
GeomTest * pGeomTest
 

Friends

std::ostream & operator<< (std::ostream &stream, const Bbox2 &pC)
 Print the box. More...
 

Constructor & Destructor Documentation

◆ Bbox2()

GEOM_FADE25D::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

Member Function Documentation

◆ add() [1/4]

bool GEOM_FADE25D::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 GEOM_FADE25D::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 GEOM_FADE25D::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 GEOM_FADE25D::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

◆ doIntersect()

bool GEOM_FADE25D::Bbox2::doIntersect ( const Bbox2 other) const

Two valid bounding boxes intersect if they share at least one point in the XY plane.

◆ doubleTheBox()

void GEOM_FADE25D::Bbox2::doubleTheBox ( )

Changes the bounds such that the box grows in each direction by half the previous range

◆ get_maxX()

double GEOM_FADE25D::Bbox2::get_maxX ( ) const
inline
Returns
maxX

◆ get_maxY()

double GEOM_FADE25D::Bbox2::get_maxY ( ) const
inline
Returns
maxY

◆ get_minX()

double GEOM_FADE25D::Bbox2::get_minX ( ) const
inline
Returns
minX

◆ get_minY()

double GEOM_FADE25D::Bbox2::get_minY ( ) const
inline
Returns
minY

◆ getBoundary()

void GEOM_FADE25D::Bbox2::getBoundary ( std::vector< Segment2 > &  vBoundary) const

Convenience function: Returns 4 border segments

◆ getCorners()

void GEOM_FADE25D::Bbox2::getCorners ( std::vector< Point2 > &  vBoxCorners) const

Convenience function: Returns the 4 corners of the box

◆ getMaxCoord()

double GEOM_FADE25D::Bbox2::getMaxCoord ( ) const
inline
Returns
the largest coordinate value, i.e. max(maxX,maxY)

◆ getMaxPoint()

Point2 GEOM_FADE25D::Bbox2::getMaxPoint ( ) const
inline
Returns
the 2D corner point with the maximum coordinates, the z-coordinate is set to 0

◆ getMaxRange()

double GEOM_FADE25D::Bbox2::getMaxRange ( ) const
inline
Returns
the largest range, i.e. max(getRangeX(),getRangeY())

◆ getMinCoord()

double GEOM_FADE25D::Bbox2::getMinCoord ( ) const
inline
Returns
the smallest coordinate value, i.e. min(minX,minY)

◆ getMinPoint()

Point2 GEOM_FADE25D::Bbox2::getMinPoint ( ) const
inline
Returns
the corner point with the minimum coordinates, the z-coordinate is set to 0

◆ getOffsetCorners()

void GEOM_FADE25D::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 GEOM_FADE25D::Bbox2::getRangeX ( ) const
inline
Returns
maxX-minX

◆ getRangeY()

double GEOM_FADE25D::Bbox2::getRangeY ( ) const
inline
Returns
maxY-minY

◆ inflateIfDegenerate()

void GEOM_FADE25D::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 GEOM_FADE25D::Bbox2::isInBox ( const Point2 p) const
Returns
true if minX <= p.x() <=maxX and minY <= p.y() <=maxY or false otherwise.

◆ isValid()

bool GEOM_FADE25D::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+()

Bbox2 GEOM_FADE25D::Bbox2::operator+ ( const Bbox2 b)

Extends the 2D bounding box if required.

Returns
the resulting bounding box

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  stream,
const Bbox2 pC 
)
friend

Prints the box coordinates to stream


The documentation for this class was generated from the following file: