Geom Software - C++ Programming and Geometry Libraries
Fade2D Documentation pages v1.63
GEOM_FADE2D::Bbox2 Class Reference

Bbox2 is an axis aligned bounding box. More...

#include <Bbox2.h>

Public Member Functions

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

Protected Member Functions

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

Protected Attributes

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

Friends

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

Detailed Description

Constructor & Destructor Documentation

◆ Bbox2() [1/2]

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

◆ Bbox2() [2/2]

GEOM_FADE2D::Bbox2::Bbox2 ( std::vector< Point2 >::const_iterator  start_it,
std::vector< Point2 >::const_iterator  end_it,
GeomTest *  pGeomTest_ = NULL 
)
inline

Bounds initialized to the minimal bounding box of the iterator range of points.

Member Function Documentation

◆ add() [1/4]

bool GEOM_FADE2D::Bbox2::add ( std::vector< Point2 *>::const_iterator  start_it,
std::vector< Point2 *>::const_iterator  end_it 
)
inline

Extends the bounding box if required.

Returns
true if the bounding box changes, false otherwise

◆ add() [2/4]

bool GEOM_FADE2D::Bbox2::add ( std::vector< Point2 >::const_iterator  start_it,
std::vector< Point2 >::const_iterator  end_it 
)
inline

Extends the bounding box if required.

Returns
true if the bounding box changes, false otherwise

◆ add() [3/4]

bool GEOM_FADE2D::Bbox2::add ( size_t  numPoints,
double *  coordinates 
)
inline

Extends the bounding box if required.

Returns
true if the bounding box changes, false otherwise

◆ add() [4/4]

bool GEOM_FADE2D::Bbox2::add ( const Point2 p)
inline

Extends the bounding box if required.

Returns
true if the bounding box changes, false otherwise

◆ computeCenter()

Point2 GEOM_FADE2D::Bbox2::computeCenter ( ) const

◆ doIntersect()

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

Two valid bounding boxes intersect if they share at least one point

◆ get_maxX()

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

◆ get_maxY()

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

◆ get_minX()

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

◆ get_minY()

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

◆ getBounds()

void GEOM_FADE2D::Bbox2::getBounds ( double &  minX_,
double &  maxX_,
double &  minY_,
double &  maxY_ 
) const

◆ getCorners()

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

Convenience function: Returns the 4 corners of the bounding box

◆ getMaxCoord()

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

◆ getMaxPoint()

Point2 GEOM_FADE2D::Bbox2::getMaxPoint ( ) const
inline
Returns
the corner point with the maximum coordinates

◆ getMaxRange()

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

◆ getMinCoord()

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

◆ getMinPoint()

Point2 GEOM_FADE2D::Bbox2::getMinPoint ( ) const
inline
Returns
the corner point with the minimum coordinates

◆ getOffsetCorners()

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

◆ getRangeY()

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

◆ inflateIfDegenerate()

void GEOM_FADE2D::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_FADE2D::Bbox2::isInBox ( const Point2 p) const

◆ isValid()

bool GEOM_FADE2D::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_FADE2D::Bbox2::operator+ ( const Bbox2 b)

Extends the bounding box if required.

Returns
the resulting bounding box

◆ setMinX()

void GEOM_FADE2D::Bbox2::setMinX ( double  val)
inline

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


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