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

Description

The Interval3d class corresponds to a bounding box in 3D 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 <Interval3d.h>

Public Member Functions

 Interval3d ()
 
 Interval3d (int)
 
 Interval3d (const Point3d &p)
 
 Interval3d (const Point3d &a, const Point3d &b)
 
 Interval3d (const Point3d &a, const Point3d &b, int)
 
 Interval3d (const Point3d &center, double halfSize)
 
void operator+= (const Point3d &p)
 Extend this interval to cover the given point. More...
 
void operator+= (const Interval3d &interv)
 Union this interval with another interval. More...
 
Interval3d operator+ (const Interval3d &interv) const
 Union two intervals and return the result. More...
 
void operator*= (const Interval3d &interv)
 Intersect this interval with another interval. More...
 
Interval3doperator*= (const Transf3d &t)
 Apply a transformation matrix to the interval. More...
 
Interval3d operator* (const Interval3d &interv) const
 Intersect two intervals and return the result. More...
 
Interval3d operator* (const Transf3d &t) const
 Apply a transformation matrix to the interval and return the result. More...
 
bool operator&& (const Interval3d &interv) const
 Returns true iff the two intervals overlap. More...
 
bool operator&& (const Point3d &p) const
 Returns true iff the interval contains the given point. More...
 
bool operator<= (const Interval3d &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...
 
Point3d mid () const
 Returns the midpoint between the lower and upper bounds of the interval. 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...
 
bool isEqual (const Interval3d &interv, double epsSqrd=WSM_DISTANCE_TOL2) const
 Returns true if the two intervals are equal within the given tolerance. More...
 
bool boundariesTouch (const Interval3d &interv, double dTol=WSM_MACHINE_TOL) const
 Returns true if the boundaries of the two intervals touch, i.e. the boxes share a side plane. More...
 
double length () const
 Returns the length of the interval. More...
 
double lengthSqrd () const
 Returns the length squared of the interval. More...
 
double length (int i) const
 Returns the i-th component of the interval length. More...
 
double volume () const
 Returns the volume of the interval. More...
 
double area () const
 Returns the area of the interval. More...
 
double perimeter () const
 Returns the perimeter of the interval. More...
 
Point3d lowerInDirection (const UnitVector3d &direction) const
 Returns the lower bound with respect to the given direction. More...
 
Point3d upperInDirection (const UnitVector3d &direction) const
 Returns the upper bound with respect to the given direction. More...
 
bool intersectsPlane (const Plane &plane, double dTol=WSM_DISTANCE_TOL) const
 Returns true if the interval intersects the given plane, or is within dTol above or below it. More...
 
bool intersectsRay (const Line3d &Ray, double dRayRadius=WSM_MACHINE_TOL, double dMaxParam=WSM_DISTANCE_BIG) const
 Returns true if the interval and the given ray intersect. More...
 
bool boundsLine (const Line3d &line, double &dMinParam, double &dMaxParam, double dTol=WSM_MACHINE_TOL) const
 Returns true if the interval bounds the given line. More...
 
::pair< bool, 1::array< WSM::Point3d, 8 > > getBoundsPoints ()
 Get the 8 bounding box points. More...
 

Public Attributes

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

Static Public Attributes

static const Interval3d kNull
 

Constructor & Destructor Documentation

WSM::Interval3d::Interval3d ( )
inline
WSM::Interval3d::Interval3d ( int  )
inlineexplicit
WSM::Interval3d::Interval3d ( const Point3d p)
inline
WSM::Interval3d::Interval3d ( const Point3d a,
const Point3d b 
)
inline
WSM::Interval3d::Interval3d ( const Point3d a,
const Point3d b,
int   
)
inline
WSM::Interval3d::Interval3d ( const Point3d center,
double  halfSize 
)
inline

Member Function Documentation

double WSM::Interval3d::area ( ) const
inline

Returns the area of the interval.

bool WSM::Interval3d::boundariesTouch ( const Interval3d interv,
double  dTol = WSM_MACHINE_TOL 
) const
inline

Returns true if the boundaries of the two intervals touch, i.e. the boxes share a side plane.

bool WSM::Interval3d::boundsLine ( const Line3d line,
double &  dMinParam,
double &  dMaxParam,
double  dTol = WSM_MACHINE_TOL 
) const

Returns true if the interval bounds the given line.

If bounded, returns the maximum and minimum parameters of the line that hit the box.

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

Widen the bounds of the interval by the specified distance.

::pair<bool, 1::array<WSM::Point3d, 8> > WSM::Interval3d::getBoundsPoints ( )
inline

Get the 8 bounding box points.

Returns a std::pair- A success flag and the set of BB points.

void WSM::Interval3d::init ( )
inline

Initializes the interval to null.

bool WSM::Interval3d::intersectsPlane ( const Plane plane,
double  dTol = WSM_DISTANCE_TOL 
) const
inline

Returns true if the interval intersects the given plane, or is within dTol above or below it.

bool WSM::Interval3d::intersectsRay ( const Line3d Ray,
double  dRayRadius = WSM_MACHINE_TOL,
double  dMaxParam = WSM_DISTANCE_BIG 
) const

Returns true if the interval and the given ray intersect.

Non-zero thickness of the ray makes the ray into a cylinder for the intersection. The ray is limited to a maximum parameter of dMaxParam if set, so the intersection can be with a segment.

bool WSM::Interval3d::isEqual ( const Interval3d interv,
double  epsSqrd = WSM_DISTANCE_TOL2 
) const
inline

Returns true if the two intervals are equal within the given tolerance.

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

Returns true if the interval is null.

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

Returns the length of the interval.

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

Returns the i-th component of the interval length.

double WSM::Interval3d::lengthSqrd ( ) const
inline

Returns the length squared of the interval.

Point3d WSM::Interval3d::lowerInDirection ( const UnitVector3d direction) const
inline

Returns the lower bound with respect to the given direction.

Point3d WSM::Interval3d::mid ( ) const
inline

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

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

Returns true iff the two intervals overlap.

bool WSM::Interval3d::operator&& ( const Point3d p) const
inline

Returns true iff the interval contains the given point.

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

Intersect two intervals and return the result.

Interval3d WSM::Interval3d::operator* ( const Transf3d t) const

Apply a transformation matrix to the interval and return the result.

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

Intersect this interval with another interval.

Interval3d& WSM::Interval3d::operator*= ( const Transf3d t)
inline

Apply a transformation matrix to the interval.

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

Union two intervals and return the result.

void WSM::Interval3d::operator+= ( const Point3d p)
inline

Extend this interval to cover the given point.

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

Union this interval with another interval.

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

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

double WSM::Interval3d::perimeter ( ) const
inline

Returns the perimeter of the interval.

Point3d WSM::Interval3d::upperInDirection ( const UnitVector3d direction) const
inline

Returns the upper bound with respect to the given direction.

double WSM::Interval3d::volume ( ) const
inline

Returns the volume of the interval.

Member Data Documentation

const Interval3d WSM::Interval3d::kNull
static
Point3d WSM::Interval3d::lower

Lower bound of the interval.

Point3d WSM::Interval3d::upper

Upper bound of the interval.


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