#include <Box.hpp>
Public Member Functions | |
Box () | |
Box (double xmin, double ymin, double zmin, double xmax, double ymax, double zmax) | |
Box (Vec rmin, Vec rmax) | |
void | cellIndices (int &i, int &j, int &k, Vec r, int nx, int ny, int nz) const |
Vec | center () const |
bool | contains (const Box &box) const |
bool | contains (double x, double y, double z) const |
bool | contains (Vec r) const |
double | diagonal () const |
void | extend (const Box &box) |
const Box & | extent () const |
void | extent (double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax) const |
Vec | fracPos (double xfrac, double yfrac, double zfrac) const |
Vec | fracPos (int xd, int yd, int zd, int xn, int yn, int zn) const |
bool | intersects (const Box &box) const |
bool | intersects (Vec r, const Vec k, double &smin, double &smax) const |
bool | intersects (Vec rc, double r) const |
Vec | rmax () const |
Vec | rmin () const |
double | volume () const |
Vec | widths () const |
double | xmax () const |
double | xmin () const |
double | xwidth () const |
double | ymax () const |
double | ymin () const |
double | ywidth () const |
double | zmax () const |
double | zmin () const |
double | zwidth () const |
Protected Member Functions | |
void | setExtent (const Box &extent) |
void | setExtent (double xmin, double ymin, double zmin, double xmax, double ymax, double zmax) |
Private Attributes | |
double | _xmax |
double | _xmin |
double | _ymax |
double | _ymin |
double | _zmax |
double | _zmin |
Box is a low-level class for working with three-dimensional "boxes": each instance represents a cuboid that is lined up with the cartesian coordinate axes. A box is represented by means of its six cartesian coordinates
The Box class is largely implemented inline (in this header file). Most compilers optimize away all overhead so that using this class is just as efficient as directly writing the code in terms of the box components.
|
inline |
The default constructor creates an empty box at the origin, i.e. it initializes all box coordinates to zero.
|
inline |
This constructor initializes the box coordinates to the values provided as arguments.
This constructor initializes the box coordinates to the components of the provided Vec objects, respectively specifying the minimum and maximum position.
|
inline |
This function calculates the cell indices for a given position, assuming that the box would be partitioned in a given number of cells in each spatial direction.
|
inline |
This function returns the position corresponding to the center of the box
|
inline |
This function returns true if the given box is inside this box, false otherwise.
|
inline |
This function returns true if the position
|
inline |
This function returns true if the position
|
inline |
This function returns the length of the diagonal of the box, i.e.
|
inline |
This function extends the receiving box so that it contains both the specified and the original box.
|
inline |
This function returns a reference to the receiving box object. It is useful for explicitly retrieving the box object from instances of classes based on Box.
|
inline |
This function stores the
|
inline |
This function returns a position in the box determined by a given fraction in each spatial direction
The specified fractions must be between zero and one; this is not checked by the function.
|
inline |
This function returns a position in the box determined by a given fraction in each spatial direction.
Each of the fractions is specified as the quotient of two integers; the integers are converted to floating point before the division is made. The quotients must be between zero and one; this is not checked by the function.
|
inline |
This function returns true if the given box and this box have a non-zero intersection, false otherwise.
This function intersects the receiving axis-aligned bounding box with a ray (half-line) defined by the specified starting position
If the ray does not intersect the box, the function returns false and the values of
The function employs the slab method originated by Kay and Kajiya (1986) and adapted by Haines (1989) as described in "Geometric Tools for Computer Graphics" by Scheider and Eberly (2003, Elsevier).
bool Box::intersects | ( | Vec | rc, |
double | r | ||
) | const |
This function intersects the receiving axis-aligned bounding box with a sphere defined by the specified center position
The function employs the algorithm due to Jim Arvo described in "Graphics Gems" (1990).
|
inline |
This function returns the maximum position
|
inline |
This function returns the minimum position
|
inlineprotected |
This function replaces the extent of the box with the newly specified values. This function is intended for use in derived classes only.
|
inlineprotected |
This function replaces the extent of the box with the newly specified values. This function is intended for use in derived classes only.
|
inline |
This function returns the volume
|
inline |
This function returns the
|
inline |
This function returns the
|
inline |
This function returns the width
|
inline |
This function returns the
|
inline |
This function returns the
|
inline |
This function returns the width
|
inline |
This function returns the
|
inline |
This function returns the
|
inline |
This function returns the width
|
private |
These data members represent the cartesian vector components