DP3
Public Member Functions | List of all members
dp3::parmdb::Box Class Reference

Class representing a 2-dim box. More...

#include <Box.h>

Public Member Functions

 Box ()
 Default constructor creates an empty box. More...
 
 Box (const Point &start, const Point &end)
 
 Box (const std::vector< double > &)
 
 Box (double x1, double x2, double y1, double y2, bool asStartEnd=false)
 Create from start/end or center/width. More...
 
bool contains (const Box &other) const
 
bool empty () const
 Check if the box is empty. More...
 
bool intersects (const Box &other) const
 
Box operator& (const Box &that) const
 
Box operator| (const Box &that) const
 
void print () const
 Output the start and end point coordinates of the Box. More...
 
bool operator== (const Box &that) const
 
bool operator!= (const Box &that) const
 
const Pointlower () const
 
const Pointupper () const
 
double lowerX () const
 
double lowerY () const
 
double upperX () const
 
double upperY () const
 
double widthX () const
 
double widthY () const
 
bool operator< (const Box &that) const
 
bool operator> (const Box &that) const
 

Detailed Description

Class representing a 2-dim box.

A Box is a rectangular region defined by two Point objects defining the bottom-left and top-rigth corner of the box. The bounding box of a Grid is a Box object.

Constructor & Destructor Documentation

◆ Box() [1/4]

dp3::parmdb::Box::Box ( )
inline

Default constructor creates an empty box.

◆ Box() [2/4]

dp3::parmdb::Box::Box ( const Point start,
const Point end 
)
inline

Create a box from the bottom-left and top-right corner. both coordinates in start must be <= end.

◆ Box() [3/4]

dp3::parmdb::Box::Box ( const std::vector< double > &  )

Create a box from a vector which must be ordered as stx,sty,endx,endy. Trailing values may be omitted and default to -1e30 or 1e30.

◆ Box() [4/4]

dp3::parmdb::Box::Box ( double  x1,
double  x2,
double  y1,
double  y2,
bool  asStartEnd = false 
)

Create from start/end or center/width.

Member Function Documentation

◆ contains()

bool dp3::parmdb::Box::contains ( const Box other) const
inline

A box A contains a box B if all points within or on the border of B fall within or on the border of A.

◆ empty()

bool dp3::parmdb::Box::empty ( ) const
inline

Check if the box is empty.

◆ intersects()

bool dp3::parmdb::Box::intersects ( const Box other) const
inline

Box A only intersects box B if there is at least one point within or on the border of A that falls within B (excluding its border).

◆ lower()

const Point& dp3::parmdb::Box::lower ( ) const
inline

Get start and end values.

◆ lowerX()

double dp3::parmdb::Box::lowerX ( ) const
inline

◆ lowerY()

double dp3::parmdb::Box::lowerY ( ) const
inline

◆ operator!=()

bool dp3::parmdb::Box::operator!= ( const Box that) const
inline

◆ operator&()

Box dp3::parmdb::Box::operator& ( const Box that) const
inline

Return the intersection of this and that box. An empty box is returned if the boxes are disjoint. Note that the operator has a low precedence, so it is advised to enclose the expression in parentheses.

◆ operator<()

bool dp3::parmdb::Box::operator< ( const Box that) const
inline

Define an ordering functions to be able to sort boxes. The ordering is on startY,startX.

◆ operator==()

bool dp3::parmdb::Box::operator== ( const Box that) const
inline

Test if boxes are exactly the same.

◆ operator>()

bool dp3::parmdb::Box::operator> ( const Box that) const
inline

◆ operator|()

Box dp3::parmdb::Box::operator| ( const Box that) const
inline

Return the union of this and that box. The union also contains the points between disjoint boxes. Note that the operator has a low precedence, so it is advised to enclose the expression in parentheses.

◆ print()

void dp3::parmdb::Box::print ( ) const

Output the start and end point coordinates of the Box.

◆ upper()

const Point& dp3::parmdb::Box::upper ( ) const
inline

◆ upperX()

double dp3::parmdb::Box::upperX ( ) const
inline

◆ upperY()

double dp3::parmdb::Box::upperY ( ) const
inline

◆ widthX()

double dp3::parmdb::Box::widthX ( ) const
inline

Get widths.

◆ widthY()

double dp3::parmdb::Box::widthY ( ) const
inline

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