FormIt C++ API  v23.0.0 (2023.0.0)
WSM::Interval2d Class Reference

Description

The Interval2d class corresponds to a bounding box in 2D space.

Interval2d and Interval3d are similar classes that keep an interval of values in 2D or 3D space, respectively. The classes were made to look uniform across 2 and 3 dimensions.

The bounds of the interval are accessed via public data members, lower and upper.

The interval classes contain operators and methods for extending or intersecting, as well as evaluating intervals.

#include <Interval2d.h>

Public Member Functions

 Interval2d ()
 
 Interval2d (int)
 
 Interval2d (const Point2d &p)
 
 Interval2d (const Point2d &a, const Point2d &b)
 
 Interval2d (const Point2d &center, double halfSize)
 
 Interval2d (const Point2d &a, const Point2d &b, int)
 
void operator+= (const Point2d &p)
 Extend this interval to cover the given point. More...
 
void operator+= (const Interval2d &interv)
 Union this interval with another interval. More...
 
void operator*= (const Interval2d &interv)
 Intersect this interval with another interval. More...
 
Interval2d operator* (const Interval2d &interv) const
 Intersect two intervals and return the result. More...
 
Interval2d operator+ (const Interval2d &interv) const
 Union two intervals and return the result. More...
 
bool operator&& (const Interval2d &interv) const
 Returns true iff the two intervals overlap. More...
 
bool operator&& (const Point2d &p) const
 Returns true iff the interval contains the given point. More...
 
bool operator<= (const Interval2d &interv) const
 Given a <= b, returns true if a is subinterval of b. More...
 
bool isNull () const
 Returns true if the interval is null. More...
 
Point2d mid () const
 Returns the midpoint between the lower and upper bounds of the interval. More...
 
double length () const
 Returns the length of the interval. More...
 
double length (int i) const
 Returns the i-th component of the interval length. More...
 
void init ()
 Initializes the interval to null. More...
 
void enlarge (double howMuch=10 *WSM_DISTANCE_TOL)
 Widen the bounds of the interval by the specified distance. More...
 

Public Attributes

Point2d lower
 Lower bound of the interval. More...
 
Point2d upper
 Upper bound of the interval. More...
 

Static Public Attributes

static const Interval2d kNull
 

Constructor & Destructor Documentation

WSM::Interval2d::Interval2d ( )
inline
WSM::Interval2d::Interval2d ( int  )
inline
WSM::Interval2d::Interval2d ( const Point2d p)
inline
WSM::Interval2d::Interval2d ( const Point2d a,
const Point2d b 
)
inline
WSM::Interval2d::Interval2d ( const Point2d center,
double  halfSize 
)
inline
WSM::Interval2d::Interval2d ( const Point2d a,
const Point2d b,
int   
)
inline

Member Function Documentation

void WSM::Interval2d::enlarge ( double  howMuch = 10 *WSM_DISTANCE_TOL)

Widen the bounds of the interval by the specified distance.

void WSM::Interval2d::init ( )
inline

Initializes the interval to null.

bool WSM::Interval2d::isNull ( ) const
inline

Returns true if the interval is null.

double WSM::Interval2d::length ( ) const
inline

Returns the length of the interval.

double WSM::Interval2d::length ( int  i) const
inline

Returns the i-th component of the interval length.

Point2d WSM::Interval2d::mid ( ) const
inline

Returns the midpoint between the lower and upper bounds of the interval.

bool WSM::Interval2d::operator&& ( const Interval2d interv) const
inline

Returns true iff the two intervals overlap.

bool WSM::Interval2d::operator&& ( const Point2d p) const
inline

Returns true iff the interval contains the given point.

Interval2d WSM::Interval2d::operator* ( const Interval2d interv) const
inline

Intersect two intervals and return the result.

void WSM::Interval2d::operator*= ( const Interval2d interv)
inline

Intersect this interval with another interval.

Interval2d WSM::Interval2d::operator+ ( const Interval2d interv) const
inline

Union two intervals and return the result.

void WSM::Interval2d::operator+= ( const Point2d p)
inline

Extend this interval to cover the given point.

void WSM::Interval2d::operator+= ( const Interval2d interv)
inline

Union this interval with another interval.

bool WSM::Interval2d::operator<= ( const Interval2d interv) const
inline

Given a <= b, returns true if a is subinterval of b.

Member Data Documentation

const Interval2d WSM::Interval2d::kNull
static
Point2d WSM::Interval2d::lower

Lower bound of the interval.

Point2d WSM::Interval2d::upper

Upper bound of the interval.


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