VR-Link API Documentation for HLA 1516
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
Dt3dExtent Class Reference

The Dt3dExtent represents an axis-aligned 3d bounding box. More...

+ Collaboration diagram for Dt3dExtent:

Public Member Functions

 Dt3dExtent ()
 Constructs an empty or undefined instance. More...
 
 Dt3dExtent (const Dt3dExtent &orig)
 Copy Ctor. More...
 
 Dt3dExtent (const double minX, const double maxX, const double minY, const double maxY, const double minZ, const double maxZ)
 Set the extent explicitly. More...
 
 Dt3dExtent (const Dt3dPoint &p0, const Dt3dPoint &p1)
 Construct the minimal extent that includes both p0 and p1. More...
 
 Dt3dExtent (const Dt3dChord &lineSeg)
 Construct the minimal extent that includes the chord. More...
 
virtual ~Dt3dExtent ()
 
Dt3dExtentoperator= (const Dt3dExtent &orig)
 
virtual bool operator== (const Dt3dExtent &rhs) const
 
virtual bool operator!= (const Dt3dExtent &rhs) const
 
virtual const Dt3dPoint center () const
 Compute the center point. More...
 
virtual void setCenter (const Dt3dPoint &p)
 Move the origin, while retaining the dimensions of the box. More...
 
virtual void setFromCenter (const Dt3dPoint &p, const double &xDist, const double &yDist, const double &zDist)
 Set the extents with the dimensions listed, centered around the point. More...
 
virtual Dt3dPoint maxPoint () const
 Return the maximum xyz coordinate of the bounding box. More...
 
virtual Dt3dPoint minPoint () const
 Return the minimum xyz coordinate of the bounding box. More...
 
bool empty () const
 Returns true if the extent is undefined. More...
 
virtual void expandToInclude (const Dt3dExtent &otherExtent)
 Expand extent, if necessary, to include input extent. More...
 
virtual void expandToInclude (const Dt3dPoint &point)
 Expand extent, if necessary, to include input point. More...
 
virtual void expandToInclude (const Dt3dChord &chord)
 Expand extent, if necessary, to include input chord. More...
 
virtual bool contains (const Dt3dExtent &otherExtent) const
 Determine if another extents box is entirely contained by this one. More...
 
virtual bool contains (const Dt3dPoint &point) const
 Determine if a point is contained in the extent. More...
 
virtual bool contains (const Dt3dChord &chord) const
 Determine if a chord is contained in the extent. More...
 
bool intersects (const Dt3dExtent &otherExtent) const
 Determine if the two extents overlap (either partially or fully). More...
 
bool doesNotIntersect (const Dt3dExtent &otherExtent) const
 Determine if the two extents are entirely disjoint. More...
 
bool intersects (const Dt3dChord &chord) const
 Determine if the finite segment, represented by the chord endpoints, intersects the extent. More...
 
double minX () const
 Access and/or mutate individual values. More...
 
double minY () const
 Access and/or mutate individual values. More...
 
double minZ () const
 Access and/or mutate individual values. More...
 
double maxX () const
 Access and/or mutate individual values. More...
 
double maxY () const
 Access and/or mutate individual values. More...
 
double maxZ () const
 Access and/or mutate individual values. More...
 
void setMinX (double x)
 Access and/or mutate individual values. More...
 
void setMinY (double y)
 Access and/or mutate individual values. More...
 
void setMinZ (double z)
 Access and/or mutate individual values. More...
 
void setMaxX (double x)
 Access and/or mutate individual values. More...
 
void setMaxY (double y)
 Access and/or mutate individual values. More...
 
void setMaxZ (double z)
 Access and/or mutate individual values. More...
 
double xSize () const
 Return the size of the bounding box along the axis. More...
 
double ySize () const
 Return the size of the bounding box along the axis. More...
 
double zSize () const
 Return the size of the bounding box along the axis. More...
 

Static Public Member Functions

static Dt3dExtentnullExtent ()
 Return an invalid or empty extent, using the default constructor. More...
 

Protected Member Functions

bool intersectsLineOfChord (const Dt3dChord &chord, double &distInChordLengthsFirst, double &distInChordLengthsLast) const
 Determines if the infinite line of which chord is a part intersects the extent. More...
 
bool intersectsSoFar (const double pointVal, const double rayVal, const double side0, const double side1, double &firstTime, double &lastTime) const
 The following is an ancillary routine to update the intersection times for a chord. More...
 
void guaranteeValidConstruction ()
 Non-virtual since called from constructors Will flip values to ensure left < right etc. More...
 

Protected Attributes

double myMinX
 
double myMaxX
 
double myMinY
 
double myMaxY
 
double myMinZ
 
double myMaxZ
 

Detailed Description

The Dt3dExtent represents an axis-aligned 3d bounding box.

Extents are often used to identify terrain. They are very similar to bounding volumes (just a box offset from an origin), but they are used differently, hence the separate class with a different internal representation.

Extents are not guaranteed to be consistent (xMin <= xMax etc.), for historical reasons. The main reason is to use this inconsistent state to indicate that the extent is undefined. There are several ways to create an inconsistent, or empty extent:

  1. Call the default constructor
  2. Call the constructor which takes 6 doubles.
  3. Set an individual value erroneously.

Note, degenerate extents (where min == max) are not considered empty. Note, constructors that take pairs of points or a chord etc. will ensure that the extent is valid.

Constructor & Destructor Documentation

Dt3dExtent::Dt3dExtent ( )

Constructs an empty or undefined instance.

Min > Max, predominantly for historical reasons. empty() will return true when the extent is in this state.

Dt3dExtent::Dt3dExtent ( const Dt3dExtent orig)

Copy Ctor.

Dt3dExtent::Dt3dExtent ( const double  minX,
const double  maxX,
const double  minY,
const double  maxY,
const double  minZ,
const double  maxZ 
)

Set the extent explicitly.

The extent may be valid or inconsistent depending on the argument values.

Dt3dExtent::Dt3dExtent ( const Dt3dPoint p0,
const Dt3dPoint p1 
)

Construct the minimal extent that includes both p0 and p1.

When the line segment (p0,p1) is parallel to any of the axes, a degenerate extent results.

Dt3dExtent::Dt3dExtent ( const Dt3dChord lineSeg)

Construct the minimal extent that includes the chord.

If the chord is parallel to any of the axes, a degenerate extent results.

virtual Dt3dExtent::~Dt3dExtent ( )
virtual

Member Function Documentation

virtual const Dt3dPoint Dt3dExtent::center ( ) const
virtual

Compute the center point.

virtual bool Dt3dExtent::contains ( const Dt3dExtent otherExtent) const
virtual

Determine if another extents box is entirely contained by this one.

On the border counts as "contained".

virtual bool Dt3dExtent::contains ( const Dt3dPoint point) const
virtual

Determine if a point is contained in the extent.

On the border counts as "contained".

virtual bool Dt3dExtent::contains ( const Dt3dChord chord) const
virtual

Determine if a chord is contained in the extent.

On the border counts as "contained".

bool Dt3dExtent::doesNotIntersect ( const Dt3dExtent otherExtent) const

Determine if the two extents are entirely disjoint.

i.e. they do not intersect at all.

bool Dt3dExtent::empty ( ) const

Returns true if the extent is undefined.

This can happen if the default constructor was called, or if min/max values were explicitly set inconsistently.

virtual void Dt3dExtent::expandToInclude ( const Dt3dExtent otherExtent)
virtual

Expand extent, if necessary, to include input extent.

virtual void Dt3dExtent::expandToInclude ( const Dt3dPoint point)
virtual

Expand extent, if necessary, to include input point.

virtual void Dt3dExtent::expandToInclude ( const Dt3dChord chord)
virtual

Expand extent, if necessary, to include input chord.

void Dt3dExtent::guaranteeValidConstruction ( )
protected

Non-virtual since called from constructors Will flip values to ensure left < right etc.

bool Dt3dExtent::intersects ( const Dt3dExtent otherExtent) const

Determine if the two extents overlap (either partially or fully).

A shared "wall" counts as intersecting.

bool Dt3dExtent::intersects ( const Dt3dChord chord) const

Determine if the finite segment, represented by the chord endpoints, intersects the extent.

i.e. the segment may pass through an extent wall, or be entirely contained within the extent.

bool Dt3dExtent::intersectsLineOfChord ( const Dt3dChord chord,
double distInChordLengthsFirst,
double distInChordLengthsLast 
) const
protected

Determines if the infinite line of which chord is a part intersects the extent.

Returns the t-values corresponding to the intersection points in distInChordLengthsFirst, and distInChordLengthsLast, such that distInChordLengthsFirst <= distInChordLengthsLast.

bool Dt3dExtent::intersectsSoFar ( const double  pointVal,
const double  rayVal,
const double  side0,
const double  side1,
double firstTime,
double lastTime 
) const
protected

The following is an ancillary routine to update the intersection times for a chord.

What is passed in are single-axis coordinates of a point and a ray (x, y, or z coordinates), and the corresponding values for opposite faces of the extent–side0 and side1. Must have side1>side0, always. The distance in chord lengths to the first and last encounter with the bounding volume so far are passed in as scalars firstTime and lastTime. If there is no intersection, the routine returns false. Otherwise (there is an intersection), the routine returns true and returns the updated distance in chord lengths to the first and last encounter with the bounding volume so far.

virtual Dt3dPoint Dt3dExtent::maxPoint ( ) const
virtual

Return the maximum xyz coordinate of the bounding box.

double Dt3dExtent::maxX ( ) const

Access and/or mutate individual values.

double Dt3dExtent::maxY ( ) const

Access and/or mutate individual values.

double Dt3dExtent::maxZ ( ) const

Access and/or mutate individual values.

virtual Dt3dPoint Dt3dExtent::minPoint ( ) const
virtual

Return the minimum xyz coordinate of the bounding box.

double Dt3dExtent::minX ( ) const

Access and/or mutate individual values.

double Dt3dExtent::minY ( ) const

Access and/or mutate individual values.

double Dt3dExtent::minZ ( ) const

Access and/or mutate individual values.

static Dt3dExtent& Dt3dExtent::nullExtent ( )
static

Return an invalid or empty extent, using the default constructor.

virtual bool Dt3dExtent::operator!= ( const Dt3dExtent rhs) const
virtual
Dt3dExtent& Dt3dExtent::operator= ( const Dt3dExtent orig)
virtual bool Dt3dExtent::operator== ( const Dt3dExtent rhs) const
virtual
virtual void Dt3dExtent::setCenter ( const Dt3dPoint p)
virtual

Move the origin, while retaining the dimensions of the box.

virtual void Dt3dExtent::setFromCenter ( const Dt3dPoint p,
const double xDist,
const double yDist,
const double zDist 
)
virtual

Set the extents with the dimensions listed, centered around the point.

void Dt3dExtent::setMaxX ( double  x)

Access and/or mutate individual values.

void Dt3dExtent::setMaxY ( double  y)

Access and/or mutate individual values.

void Dt3dExtent::setMaxZ ( double  z)

Access and/or mutate individual values.

void Dt3dExtent::setMinX ( double  x)

Access and/or mutate individual values.

void Dt3dExtent::setMinY ( double  y)

Access and/or mutate individual values.

void Dt3dExtent::setMinZ ( double  z)

Access and/or mutate individual values.

double Dt3dExtent::xSize ( ) const

Return the size of the bounding box along the axis.

double Dt3dExtent::ySize ( ) const

Return the size of the bounding box along the axis.

double Dt3dExtent::zSize ( ) const

Return the size of the bounding box along the axis.

Member Data Documentation

double Dt3dExtent::myMaxX
protected
double Dt3dExtent::myMaxY
protected
double Dt3dExtent::myMaxZ
protected
double Dt3dExtent::myMinX
protected
double Dt3dExtent::myMinY
protected
double Dt3dExtent::myMinZ
protected

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

Document ID: Generated on Tue Aug 10 00:12:31 EDT 2021 from SVN revision 232765
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)