Home

SPAbox Class Reference
[Geometric Atoms]

Represents a bounding box. More...

#include <box.hxx>

Inheritance diagram for SPAbox:

Inheritance graph
[legend]
Collaboration diagram for SPAbox:

Collaboration graph
[legend]

List of all members.

Public Member Functions

logical bounded () const
 Returns TRUE if the coordinate ranges are finite or FALSE otherwise.
logical bounded_above () const
 Returns TRUE if the coordinate ranges are either finite or finite above or FALSE otherwise.
logical bounded_below () const
 Returns TRUE if the coordinate ranges are either finite or finite below or FALSE otherwise.
SPAposition corner (int index) const
 Returns the corners of the box - labeled from 0 to 7 where the corners correspond to writing the index in binary as x * 4 + y * 2 + z and letting zero corresponds to the low values, getting position (x, y, z).
void debug (char const *title, FILE *fp=debug_file_ptr) const
 Outputs a title and information about the box to the debug file or to the specified file.
logical empty () const
 Tests if the box is empty.
logical finite () const
 Returns TRUE if the coordinate ranges are finite or FALSE otherwise.
logical finite_above () const
 Returns TRUE if the coordinate ranges are finite above or FALSE otherwise.
logical finite_below () const
 Returns TRUE if the coordinate ranges are finite below or FALSE otherwise.
SPAposition high () const
 Extracts the high end of the leading diagonal of the box.
logical infinite () const
 Returns TRUE if any of the coordinate ranges is infinite or FALSE otherwise.
SPAposition low () const
 Extracts the low end of the leading diagonal of the box.
SPAposition mid () const
 Extracts the middle of the leading diagonal of the box.
SPAboxoperator &= (SPAbox const &box)
 Limits one box by another - this method forms the intersection of this box with the given box, which results in this box.
SPAboxoperator*= (SPAtransf const &trans)
 Transforms this box by the given transform.
SPAboxoperator*= (SPAmatrix const &mat)
 Transforms this box by the given matrix.
SPAboxoperator*= (double trans)
 Transforms this box by the given transform.
SPAboxoperator+= (SPAvector const &vec)
 Translates this box.
SPAboxoperator-= (SPAvector const &vec)
 Translates this box.
SPAboxoperator/= (double scale)
 Scales this box.
logical operator<< (SPAbox const &b) const
 Determines if the given box encloses this box.
logical operator>> (SPAbox const &box) const
 Determines if this box entirely encloses the given box.
logical operator>> (SPAposition const &pos) const
 Determines if this box entirely encloses the given point.
SPAboxoperator|= (SPAbox const &box)
 Compounds one box into another - this method extends this box until it also encloses the given box.
 SPAbox (SPAbox const &old)
 C++ copy constructor requests memory for this object and populates it with the data from the object supplied as an argument.
 SPAbox (SPAposition const &first_pt, SPAposition const &second_pt)
 C++ initialize constructor requests memory for this object and populates it with the data supplied as arguments.
 SPAbox (SPAposition const &old)
 C++ initialize constructor requests memory for this object and populates it with the data supplied as arguments.
 SPAbox ()
 C++ allocation constructor requests memory for this object but does not populate it.
 SPAbox (SPAinterval const &xdir, SPAinterval const &ydir, SPAinterval const &zdir)
 C++ initialize constructor requests memory for this object and populates it with the data supplied as arguments.
logical unbounded () const
 Returns TRUE if any of the coordinate ranges is infinite or FALSE otherwise.
logical unbounded_above () const
 Returns TRUE if either any of the coordinate ranges is infinite or the coordinate ranges are finite below or FALSE otherwise.
logical unbounded_below () const
 Returns TRUE if either any of the coordinate ranges is infinite or the coordinate ranges are finite above or FALSE otherwise.
SPAinterval x_range () const
 Retrieves the x-coordinate range.
SPAinterval y_range () const
 Retrieves the y-coordinate range.
SPAinterval z_range () const
 Retrieves the z-coordinate range.

Friends

SPAbox enlarge_box (SPAbox const &b, double delta)
 Modifies a SPAbox by increasing it in size by a constant amount in all directions.
SPAbox operator & (SPAbox const &, SPAbox const &)
 Finds the overlap of two boxes - this method finds the intersection.
logical operator && (SPAbox const &, SPAbox const &)
 Determines whether two boxes overlap.
SPAinterval operator% (SPAbox const &, SPAunit_vector const &)
 Finds the extent of the box along the given direction.
SPAinterval operator% (SPAunit_vector const &, SPAbox const &)
 Finds the extent of the box along the given direction.
SPAbox operator* (SPAbox const &, SPAtransf const &)
 Transforms a box by the given transform.
SPAbox operator* (SPAbox const &, SPAmatrix const &)
 Transforms a box by the given matrix.
SPAbox operator* (double, SPAbox const &)
 Scales a box.
SPAbox operator* (SPAbox const &, double)
 Scales a box.
SPAbox operator+ (SPAvector const &, SPAbox const &)
 Translates a box.
SPAbox operator+ (SPAbox const &, SPAvector const &)
 Translates a box.
SPAbox operator- (SPAbox const &, SPAvector const &)
 Translates a box.
SPAbox operator/ (SPAbox const &, double)
 Scales a box.
logical operator<< (SPAposition const &p, SPAbox const &b)
 Determines if a given box encloses a given position.
SPAbox operator| (SPAbox const &, SPAbox const &)
 Creates a box that encloses the two given boxes.


Detailed Description

Represents a bounding box.


Role: This class represents a bounding box. It is implemented as an axis-dependent, axis-aligned rectangular box, given by a triple of real intervals.

ACIS boxes model entities for algorithm efficiency by constructing a simple bounding shape to surround the model entity (as closely as reasonably possible). When two entities are tested for interaction, the boxes can be tested first to filter out obviously disjoint cases.

The major items boxed are body, shell, and face. There is an additional model entity, the subshell, that exists solely to provide more efficient box testing. When sensible, a shell containing many faces is subdivided spatially into n subshells of faces. Each subshell fills approximately 1/n of the space filled by the original shell box. The subshells can in turn be subdivided if they contain a sufficient number of faces. A shell or subshell so subdivided can also contain faces directly, when these faces span the majority of the original box, and do not fit into any subshell box. The present algorithm for this subdivision limits n to 2.

Boxes are axis-aligned rectangular parallelepipeds. Subshell, shell, and body boxes are obtained by determining the overall limits of the boxes of the entities making up the body, shell, or subshell. When two bodies are compared, one must be transformed into the coordinate system of the other in order for the comparison to take place. For preliminary testing, each box is transformed and then boxed in the new coordinate system. This is not optimal, but it is relatively quick.

Boxes are computed only when needed, and changed entities merely require the existing box (if any) to be deleted; however, after a box is computed it is saved for later reuse. Boxes are not logged for roll back purposes, nor are they saved to a disk file. A box pointer in a roll back record is always set to NULL. After a roll back, such boxes must be recomputed.

See also:
SPAinterval

Constructor & Destructor Documentation

SPAbox::SPAbox ( SPAinterval const &  xdir,
SPAinterval const &  ydir,
SPAinterval const &  zdir 
)

C++ initialize constructor requests memory for this object and populates it with the data supplied as arguments.



Parameters:
xdir extent in x-direction.
ydir extent in y-direction.
zdir extent in z-direction.

SPAbox::SPAbox (  ) 

C++ allocation constructor requests memory for this object but does not populate it.

SPAbox::SPAbox ( SPAposition const &  old  ) 

C++ initialize constructor requests memory for this object and populates it with the data supplied as arguments.



Parameters:
old given point.

SPAbox::SPAbox ( SPAposition const &  first_pt,
SPAposition const &  second_pt 
)

C++ initialize constructor requests memory for this object and populates it with the data supplied as arguments.



Parameters:
first_pt first point.
second_pt second point.

SPAbox::SPAbox ( SPAbox const &  old  ) 

C++ copy constructor requests memory for this object and populates it with the data from the object supplied as an argument.



Parameters:
old given box.


Member Function Documentation

logical SPAbox::bounded (  )  const [inline]

Returns TRUE if the coordinate ranges are finite or FALSE otherwise.

logical SPAbox::bounded_above (  )  const [inline]

Returns TRUE if the coordinate ranges are either finite or finite above or FALSE otherwise.

logical SPAbox::bounded_below (  )  const [inline]

Returns TRUE if the coordinate ranges are either finite or finite below or FALSE otherwise.

SPAposition SPAbox::corner ( int  index  )  const

Returns the corners of the box - labeled from 0 to 7 where the corners correspond to writing the index in binary as x * 4 + y * 2 + z and letting zero corresponds to the low values, getting position (x, y, z).



Parameters:
index any value from 0 to 7.

void SPAbox::debug ( char const *  title,
FILE *  fp = debug_file_ptr 
) const

Outputs a title and information about the box to the debug file or to the specified file.



Parameters:
title title.
fp file pointer

logical SPAbox::empty (  )  const

Tests if the box is empty.

logical SPAbox::finite (  )  const [inline]

Returns TRUE if the coordinate ranges are finite or FALSE otherwise.

logical SPAbox::finite_above (  )  const

Returns TRUE if the coordinate ranges are finite above or FALSE otherwise.

logical SPAbox::finite_below (  )  const

Returns TRUE if the coordinate ranges are finite below or FALSE otherwise.

SPAposition SPAbox::high (  )  const

Extracts the high end of the leading diagonal of the box.

logical SPAbox::infinite (  )  const

Returns TRUE if any of the coordinate ranges is infinite or FALSE otherwise.

SPAposition SPAbox::low (  )  const

Extracts the low end of the leading diagonal of the box.

SPAposition SPAbox::mid (  )  const

Extracts the middle of the leading diagonal of the box.

SPAbox& SPAbox::operator &= ( SPAbox const &  box  ) 

Limits one box by another - this method forms the intersection of this box with the given box, which results in this box.



Parameters:
box given box.

SPAbox& SPAbox::operator*= ( SPAtransf const &  trans  ) 

Transforms this box by the given transform.



Role:This results in a box in the new coordinate system that is sufficient to enclose the true transformed box.

Parameters:
trans given transformation.

SPAbox& SPAbox::operator*= ( SPAmatrix const &  mat  ) 

Transforms this box by the given matrix.



Role:This results in a box in the new coordinate system that is sufficient to enclose the true transformed box.

Parameters:
mat given matrix.

SPAbox& SPAbox::operator*= ( double  trans  ) 

Transforms this box by the given transform.



Role: This results in a box in the new coordinate system that is sufficient to enclose the true transformed box.

Parameters:
trans double.

SPAbox& SPAbox::operator+= ( SPAvector const &  vec  ) 

Translates this box.



Parameters:
vec vector.

SPAbox& SPAbox::operator-= ( SPAvector const &  vec  ) 

Translates this box.



Parameters:
vec vector.

SPAbox& SPAbox::operator/= ( double  scale  ) 

Scales this box.



Parameters:
scale double.

logical SPAbox::operator<< ( SPAbox const &  b  )  const [inline]

Determines if the given box encloses this box.



Parameters:
b given box.

logical SPAbox::operator>> ( SPAbox const &  box  )  const

Determines if this box entirely encloses the given box.



Role: This method returns TRUE if this box is NULL or if the given box is strictly within this box or within this box enlarged by SPAresabs in all six directions (+x, -x, +y, -y, +z, -z). Otherwise, or if the given box is NULL, this method returns FALSE.

Parameters:
box given box.

logical SPAbox::operator>> ( SPAposition const &  pos  )  const

Determines if this box entirely encloses the given point.



Role: This method returns TRUE if this box is NULL or if the given point is strictly within this box or within this box enlarged by SPAresabs in all six directions (+x, -x, +y, -y, +z, -z). Otherwise, or if the given point is NULL, this method returns FALSE.

Parameters:
pos given point.

SPAbox& SPAbox::operator|= ( SPAbox const &  box  ) 

Compounds one box into another - this method extends this box until it also encloses the given box.



Parameters:
box given box.

logical SPAbox::unbounded (  )  const [inline]

Returns TRUE if any of the coordinate ranges is infinite or FALSE otherwise.

logical SPAbox::unbounded_above (  )  const [inline]

Returns TRUE if either any of the coordinate ranges is infinite or the coordinate ranges are finite below or FALSE otherwise.

logical SPAbox::unbounded_below (  )  const [inline]

Returns TRUE if either any of the coordinate ranges is infinite or the coordinate ranges are finite above or FALSE otherwise.

SPAinterval SPAbox::x_range (  )  const

Retrieves the x-coordinate range.

SPAinterval SPAbox::y_range (  )  const

Retrieves the y-coordinate range.

SPAinterval SPAbox::z_range (  )  const

Retrieves the z-coordinate range.


Friends And Related Function Documentation

SPAbox enlarge_box ( SPAbox const &  b,
double  delta 
) [friend]

Modifies a SPAbox by increasing it in size by a constant amount in all directions.



Parameters:
b given box.
delta amount to extend.

SPAbox operator & ( SPAbox const &  ,
SPAbox const &   
) [friend]

Finds the overlap of two boxes - this method finds the intersection.



Parameters:
box1 first box.
box2 second box.

logical operator && ( SPAbox const &  ,
SPAbox const &   
) [friend]

Determines whether two boxes overlap.



Role: This method returns TRUE if either box is NULL or if all the intervals of one box overlap the corresponding intervals of the other box.

Parameters:
box1 first box.
box2 second box.

SPAinterval operator% ( SPAbox const &  ,
SPAunit_vector const &   
) [friend]

Finds the extent of the box along the given direction.



Parameters:
box1 given box.
unit_vec direction.

SPAinterval operator% ( SPAunit_vector const &  ,
SPAbox const &   
) [friend]

Finds the extent of the box along the given direction.



Parameters:
unit_vec direction.
box1 given box.

SPAbox operator* ( SPAbox const &  ,
SPAtransf const &   
) [friend]

Transforms a box by the given transform.



Role: This results in a box in the new coordinate system that is sufficient to enclose the true transformed box.

Parameters:
box1 given box.
trans transformation.

SPAbox operator* ( SPAbox const &  ,
SPAmatrix const &   
) [friend]

Transforms a box by the given matrix.



Role: This results in a box in the new coordinate system that is sufficient to enclose the true transformed box.

Parameters:
box1 given box.
mat1 matrix.

SPAbox operator* ( double  ,
SPAbox const &   
) [friend]

Scales a box.



Parameters:
d scale factor.
box1 given box.

SPAbox operator* ( SPAbox const &  ,
double   
) [friend]

Scales a box.



Parameters:
box1 given box.
d scale factor.

SPAbox operator+ ( SPAvector const &  ,
SPAbox const &   
) [friend]

Translates a box.



Parameters:
vec1 vector.
box1 given box.

SPAbox operator+ ( SPAbox const &  ,
SPAvector const &   
) [friend]

Translates a box.



Parameters:
box1 given box.
vec1 vector.

SPAbox operator- ( SPAbox const &  ,
SPAvector const &   
) [friend]

Translates a box.



Parameters:
box1 given box.
vec1 vector.

SPAbox operator/ ( SPAbox const &  ,
double   
) [friend]

Scales a box.



Parameters:
box1 given box.
d scale factor.

logical operator<< ( SPAposition const &  p,
SPAbox const &  b 
) [friend]

Determines if a given box encloses a given position.



Parameters:
p position.
b given box.

SPAbox operator| ( SPAbox const &  ,
SPAbox const &   
) [friend]

Creates a box that encloses the two given boxes.



Parameters:
box1 first box.
box2 second box.