HDK
|
Axis-aligned bounding box (AABB). More...
#include <GEO_Detail.h>
Public Types | |
using | this_type = UT_BoundingBoxT< T > |
Public Member Functions | |
UT_BoundingBoxT () | |
UT_BoundingBoxT (T axmin, T aymin, T azmin, T axmax, T aymax, T azmax) | |
UT_BoundingBoxT (const UT_Vector3T< T > &lowerbound, const UT_Vector3T< T > &upperbound) | |
template<typename S > | |
UT_BoundingBoxT (const UT_BoundingBoxT< S > &bbox) | |
template<typename S > | |
UT_BoundingBoxT & | operator= (const UT_BoundingBoxT< S > &bbox) |
T | operator() (unsigned m, unsigned n) const |
T & | operator() (unsigned m, unsigned n) |
bool | operator== (const UT_BoundingBoxT< T > &bbox) const |
bool | operator!= (const UT_BoundingBoxT< T > &bbox) const |
bool | isEqual (const UT_BoundingBoxT< T > &bbox, T tol=SYS_FTOLERANCE_R) const |
T | xmin () const |
T | xmax () const |
T | ymin () const |
T | ymax () const |
T | zmin () const |
T | zmax () const |
UT_Vector3T< T > | minvec () const |
UT_Vector3T< T > | maxvec () const |
int | isInside (const UT_Vector3T< T > &pt) const |
int | isInside (const UT_Vector4T< T > &pt) const |
int | isInside (T x, T y, T z) const |
int | isInside (const UT_BoundingBoxT< T > &bbox) const |
int | isLineInside (const UT_Vector3T< T > &v0, const UT_Vector3T< T > &idir) const |
T | approxLineDist2 (const UT_Vector3T< T > &v0, const UT_Vector3T< T > &dir) const |
SYS_FORCE_INLINE bool | isValid () const |
Check whether the bounding box contains at least one point. More... | |
SYS_FORCE_INLINE void | makeInvalid () |
SYS_FORCE_INLINE bool | isInvalidFast () const |
void | setBounds (T x_min, T y_min, T z_min, T x_max, T y_max, T z_max) |
SYS_FORCE_INLINE bool | hasVolume () const |
void | initMaxBounds () |
Initialize the box to the largest size. More... | |
SYS_FORCE_INLINE void | initBounds () |
void | initBounds (const UT_Vector3T< T > &min, const UT_Vector3T< T > &max) |
SYS_FORCE_INLINE void | initBounds (const UT_Vector3T< T > &pt) |
Initialize zero-sized bounds at the location of the point given by pt. More... | |
void | initBounds (const UT_Vector4T< T > &pt) |
Initialize zero-sized bounds at the location of the point given by pt. More... | |
SYS_FORCE_INLINE void | initBounds (T x, T y, T z) |
void | initBounds (const fpreal32 *v) |
Initialize zero-sized bounds at the location of the point given by v. More... | |
void | initBounds (const fpreal64 *v) |
Initialize zero-sized bounds at the location of the point given by v. More... | |
void | initBounds (const UT_BoundingBoxT< T > &box) |
Initialize the bounds to the same as given by box. More... | |
void | enlargeBounds (const UT_Vector3T< T > &min, const UT_Vector3T< T > &max) |
SYS_FORCE_INLINE void | enlargeBounds (const UT_Vector3T< T > &pt) |
Enlarge the existing bounds to encompass the point given by pt. More... | |
void | enlargeBounds (const UT_Vector4T< T > &pt) |
Enlarge the existing bounds to encompass the point given by pt. More... | |
SYS_FORCE_INLINE void | enlargeBounds (T x, T y, T z) |
void | enlargeBounds (const fpreal32 *v) |
Enlarge the existing bounds to encompass the point given in v. More... | |
void | enlargeBounds (const fpreal64 *v) |
Enlarge the existing bounds to encompass the point given in v. More... | |
SYS_FORCE_INLINE void | enlargeBounds (const UT_BoundingBoxT< T > &box) |
Enlarge the existing bounds to encompass the bounds given by box. More... | |
SYS_FORCE_INLINE void | expandBounds (T relative, T absolute) |
SYS_FORCE_INLINE void | expandBounds (T dltx, T dlty, T dlyz) |
void | enlargeFloats (int bits=1, T min=1e-5) |
void | clipBounds (const UT_BoundingBoxT< T > &box) |
Find the intersections of two bounding boxes. More... | |
void | splitLeft (UT_BoundingBoxT< T > &box, int axis, T split) |
void | splitRight (UT_BoundingBoxT< T > &box, int axis, T split) |
template<typename MATRIX > | |
void | transform (const MATRIX &mat) |
template<typename MATRIX > | |
void | transform (const MATRIX &mat, UT_BoundingBoxT< T > &newbbox) const |
void | translate (const UT_Vector3T< T > &delta) |
Adds the given translate to each component of the bounding box. More... | |
T | xsize () const |
T | ysize () const |
T | zsize () const |
T | sizeX () const |
T | sizeY () const |
T | sizeZ () const |
UT_Vector3T< T > | size () const |
T | sizeAxis (int axis) const |
T | sizeMax () const |
Return the size of the largest dimension. More... | |
T | sizeMax (int &axis) const |
UT_Vector3T< T > | minDistDelta (const UT_Vector3T< T > &p) const |
UT_Vector3T< T > | minDistDelta (const UT_BoundingBoxT< T > &box) const |
UT_Vector3T< T > | maxDistDelta (const UT_Vector3T< T > &p) const |
Returns the maximum delta vector from the bounding box to the point. More... | |
T | minDist2 (const UT_Vector3T< T > &p) const |
T | minDist2 (const UT_BoundingBoxT< T > &box) const |
Minimum disance between two bboxes squared. More... | |
T | maxDist2 (const UT_Vector3T< T > &p) const |
Returns maximum distance between point and bounding box squared. More... | |
UT_Vector3T< T > | minDistToMaxOverlap (const UT_BoundingBoxT< T > &box) const |
T | getRadius () const |
Returns the radius of a sphere that would fully enclose the box. More... | |
int | getOutCode (const UT_Vector3T< T > &pt) const |
Finds the out code of the point relative to this box: More... | |
T | xcenter () const |
T | ycenter () const |
T | zcenter () const |
T | centerX () const |
T | centerY () const |
T | centerZ () const |
T | centerAxis (int axis) const |
UT_Vector3T< T > | center () const |
T | area () const |
T | volume () const |
void | addToMin (const UT_Vector3T< T > &vec) |
void | addToMax (const UT_Vector3T< T > &vec) |
void | scaleOffset (const UT_Vector3T< T > &scale, const UT_Vector3T< T > &offset) |
Scale then offset a bounding box. More... | |
int | maxAxis () const |
int | minAxis () const |
int | intersectRay (const UT_Vector3T< T > &org, const UT_Vector3T< T > &dir, T tmax=1E17F, T *distance=0, UT_Vector3T< T > *nml=0) const |
int | intersectRange (const UT_Vector3T< T > &org, const UT_Vector3T< T > &dir, T &min, T &max) const |
int | intersectTube (const UT_Vector3T< T > &org, const UT_Vector3T< T > &dir, T radius, T tmin=-1E17f, T tmax=1E17f) const |
int | intersects (const UT_BoundingBoxT< T > &box) const |
int | computeIntersection (const UT_BoundingBoxT< T > &box) |
void | getBBoxPoints (UT_Vector3T< T >(&ptarray)[8]) const |
void | getBBoxPoints (UT_Vector4T< T >(&ptarray)[8]) const |
template<typename MATRIX > | |
int | getBBoxPoints (UT_Vector3T< T >(&ptarray)[8], const MATRIX &transform_matrix) const |
UT_API bool | triangleIntersects (const UT_Vector3T< T > &v0, const UT_Vector3T< T > &v1, const UT_Vector3T< T > &v2) const |
UT_API void | dump (const char *msg=0) const |
Dump the bounding box to stderr. The msg is printed before the bounds. More... | |
UT_API void | dumpGeo (FILE *fp) const |
Dump the bounding box geometry to a draw file. More... | |
template<> | |
void | enlargeFloats (int bits, int64 min) |
void | setSerialized (const fpreal32 floats[6]) |
void | setSerialized (const fpreal64 floats[6]) |
const T * | getSerialized () const |
const T * | data () const |
T * | data () |
const T * | begin () const |
const T * | end () const |
T * | begin () |
T * | end () |
UT_API bool | save (UT_JSONWriter &w) const |
UT_API bool | save (UT_JSONValue &v) const |
UT_API bool | load (UT_JSONParser &p) |
Public Attributes | |
union { | |
T vals [3][2] | |
T myFloats [6] | |
}; | |
Here's the data for the bounding box. More... | |
Protected Member Functions | |
UT_API void | outTo (std::ostream &os) const |
Static Protected Member Functions | |
static bool | SYSisEqual (int64 a, int64 b, int64) |
Friends | |
std::ostream & | operator<< (std::ostream &os, const UT_BoundingBoxT< T > &box) |
uint64 | hash () const |
Compute UT_BoundingBox hash. More... | |
std::size_t | hash_value (const this_type &t) |
Compute UT_BoundingBox hash. More... | |
Axis-aligned bounding box (AABB).
Definition at line 41 of file GEO_Detail.h.
using UT_BoundingBoxT< T >::this_type = UT_BoundingBoxT<T> |
Definition at line 31 of file UT_BoundingBox.h.
|
inline |
Definition at line 33 of file UT_BoundingBox.h.
|
inline |
Definition at line 36 of file UT_BoundingBox.h.
|
inline |
Definition at line 42 of file UT_BoundingBox.h.
|
inline |
Definition at line 54 of file UT_BoundingBox.h.
|
inline |
Definition at line 1174 of file UT_BoundingBox.h.
|
inline |
Definition at line 1165 of file UT_BoundingBox.h.
|
inline |
Determine the minimum distance of the box to a line segment, or 0 if the line segment overlaps the box. v0 is one end-point of the line, and dir is the direction vector along the line. This method conservatively underestimates the distance, so the true line/box distance may be greater than the reported value.
Definition at line 702 of file UT_BoundingBox.h.
|
inline |
Definition at line 1155 of file UT_BoundingBox.h.
|
inline |
Iterate over the data serially
Definition at line 199 of file UT_BoundingBox.h.
|
inline |
Iterate over the data serially
Definition at line 201 of file UT_BoundingBox.h.
|
inline |
Definition at line 379 of file UT_BoundingBox.h.
|
inline |
Definition at line 377 of file UT_BoundingBox.h.
|
inline |
Definition at line 374 of file UT_BoundingBox.h.
|
inline |
Definition at line 375 of file UT_BoundingBox.h.
|
inline |
Definition at line 376 of file UT_BoundingBox.h.
|
inline |
Find the intersections of two bounding boxes.
Definition at line 831 of file UT_BoundingBox.h.
|
inline |
Changes the bounds to be those of the intersection of this box and the supplied BBox. Returns 1 if intersects, 0 otherwise.
Definition at line 654 of file UT_BoundingBox.h.
|
inline |
Access to the serialized data
Definition at line 193 of file UT_BoundingBox.h.
|
inline |
Access to the serialized data
Definition at line 194 of file UT_BoundingBox.h.
UT_API void UT_BoundingBoxT< T >::dump | ( | const char * | msg = 0 | ) | const |
Dump the bounding box to stderr. The msg is printed before the bounds.
UT_API void UT_BoundingBoxT< T >::dumpGeo | ( | FILE * | fp | ) | const |
Dump the bounding box geometry to a draw file.
|
inline |
Iterate over the data serially
Definition at line 200 of file UT_BoundingBox.h.
|
inline |
Iterate over the data serially
Definition at line 202 of file UT_BoundingBox.h.
|
inline |
Enlarge the existing bounds to encompass the bounds given by min and max.
Definition at line 756 of file UT_BoundingBox.h.
|
inline |
Enlarge the existing bounds to encompass the point given by pt.
Definition at line 543 of file UT_BoundingBox.h.
|
inline |
Enlarge the existing bounds to encompass the point given by pt.
Definition at line 769 of file UT_BoundingBox.h.
Enlarge the existing bounds to encompass the point defined by x, y, and z.
Definition at line 555 of file UT_BoundingBox.h.
|
inline |
Enlarge the existing bounds to encompass the point given in v.
Definition at line 266 of file UT_BoundingBox.h.
|
inline |
Enlarge the existing bounds to encompass the point given in v.
Definition at line 270 of file UT_BoundingBox.h.
|
inline |
Enlarge the existing bounds to encompass the bounds given by box.
Definition at line 567 of file UT_BoundingBox.h.
|
inline |
Perform a minimal enlargement of the floating point values in this bounding box. This enlargement guarantees that the new floating point values are always different from the prior ones. The number of mantissa bits to be changed can be adjusted using the bits parameter, and a minimum enlargement amount can be specified in min.
Definition at line 804 of file UT_BoundingBox.h.
|
inline |
Definition at line 823 of file UT_BoundingBox.h.
|
inline |
Expand the bounding box on all axes, as a relative fraction of the current bbox dimensions, and/or using an absolute offset.
Definition at line 579 of file UT_BoundingBox.h.
Expand the bounding box on all sides using separate absolute offsets for each axis.
Definition at line 595 of file UT_BoundingBox.h.
|
inline |
Definition at line 1212 of file UT_BoundingBox.h.
|
inline |
Definition at line 1226 of file UT_BoundingBox.h.
|
inline |
Definition at line 1241 of file UT_BoundingBox.h.
|
inline |
Finds the out code of the point relative to this box:
Definition at line 1139 of file UT_BoundingBox.h.
|
inline |
Returns the radius of a sphere that would fully enclose the box.
Definition at line 366 of file UT_BoundingBox.h.
|
inline |
Set/Get bounds in "serialized" fashion. The serialized order is (xmin, xmax, ymin, ymax, zmin, zmax).
Definition at line 188 of file UT_BoundingBox.h.
|
inline |
|
inline |
Definition at line 168 of file UT_BoundingBox.h.
|
inline |
Initialize the box such that
Definition at line 504 of file UT_BoundingBox.h.
|
inline |
Initialize the bounds with the bounds given in min and max. No check is made to ensure that min is smaller than max.
Definition at line 725 of file UT_BoundingBox.h.
|
inline |
Initialize zero-sized bounds at the location of the point given by pt.
Definition at line 519 of file UT_BoundingBox.h.
|
inline |
Initialize zero-sized bounds at the location of the point given by pt.
Definition at line 735 of file UT_BoundingBox.h.
Initialize zero-sized bounds at the location of the point defined by x, y, and z;
Definition at line 531 of file UT_BoundingBox.h.
|
inline |
Initialize zero-sized bounds at the location of the point given by v.
Definition at line 238 of file UT_BoundingBox.h.
|
inline |
Initialize zero-sized bounds at the location of the point given by v.
Definition at line 242 of file UT_BoundingBox.h.
|
inline |
Initialize the bounds to the same as given by box.
Definition at line 744 of file UT_BoundingBox.h.
|
inline |
Initialize the box to the largest size.
Definition at line 717 of file UT_BoundingBox.h.
|
inline |
Definition at line 962 of file UT_BoundingBox.h.
int UT_BoundingBoxT< T >::intersectRay | ( | const UT_Vector3T< T > & | org, |
const UT_Vector3T< T > & | dir, | ||
T | tmax = 1E17F , |
||
T * | distance = 0 , |
||
UT_Vector3T< T > * | nml = 0 |
||
) | const |
Intersect a ray with the box. Returns 0 if no intersection found. distance will be set to the intersection distance (between 0 & tmax) The normal will also be set. The direction of the normal is indeterminant (to fix it, you might want to dot(dir, *nml) to check the orientation.
Definition at line 898 of file UT_BoundingBox.h.
|
inline |
Definition at line 644 of file UT_BoundingBox.h.
|
inline |
This determines if the tube, capped at distances tmin & tmax, intersects this.
Definition at line 986 of file UT_BoundingBox.h.
|
inline |
Definition at line 100 of file UT_BoundingBox.h.
|
inline |
Definition at line 604 of file UT_BoundingBox.h.
|
inline |
Definition at line 614 of file UT_BoundingBox.h.
Definition at line 624 of file UT_BoundingBox.h.
|
inline |
Am I totally enclosed in the bounding box passed in ("intersects" method tests for partially inside)
Definition at line 634 of file UT_BoundingBox.h.
|
inline |
Efficient test for an invalid bounding box (one comparison instead of 3 for a valid bounding box). This only checks X, not Y or Z ranges, so only works if the box is fully invalid.
Definition at line 154 of file UT_BoundingBox.h.
|
inline |
Determine whether a line intersects the box. v0 is one end-point of the line, and idir is the inverse direction vector along the line.
Definition at line 679 of file UT_BoundingBox.h.
|
inline |
Check whether the bounding box contains at least one point.
Definition at line 495 of file UT_BoundingBox.h.
UT_API bool UT_BoundingBoxT< T >::load | ( | UT_JSONParser & | p | ) |
Methods to serialize to a JSON stream. The vector is stored as an array of 6 reals (xmin, xmax, ymin, ymax, zmin, zmax)
|
inline |
Definition at line 148 of file UT_BoundingBox.h.
|
inline |
Definition at line 1196 of file UT_BoundingBox.h.
|
inline |
Returns maximum distance between point and bounding box squared.
Definition at line 358 of file UT_BoundingBox.h.
|
inline |
Returns the maximum delta vector from the bounding box to the point.
Definition at line 1097 of file UT_BoundingBox.h.
|
inline |
Definition at line 120 of file UT_BoundingBox.h.
|
inline |
Definition at line 1204 of file UT_BoundingBox.h.
|
inline |
Returns minimum distance from point to bounding box squared. Returns 0 if point in bouding box.
Definition at line 352 of file UT_BoundingBox.h.
|
inline |
Minimum disance between two bboxes squared.
Definition at line 355 of file UT_BoundingBox.h.
|
inline |
Returns the minimum delta vector from the point to the bounding box or between two bounding boxes.
Definition at line 1047 of file UT_BoundingBox.h.
|
inline |
Definition at line 1071 of file UT_BoundingBox.h.
|
inline |
Returns the smallest absolute translation from this to box that produces the maximum overlap between the two boxes.
Definition at line 1123 of file UT_BoundingBox.h.
|
inline |
Definition at line 118 of file UT_BoundingBox.h.
|
inline |
Definition at line 95 of file UT_BoundingBox.h.
|
inline |
Definition at line 76 of file UT_BoundingBox.h.
|
inline |
Definition at line 81 of file UT_BoundingBox.h.
|
inline |
Definition at line 65 of file UT_BoundingBox.h.
|
inline |
Definition at line 86 of file UT_BoundingBox.h.
|
protected |
UT_API bool UT_BoundingBoxT< T >::save | ( | UT_JSONWriter & | w | ) | const |
Methods to serialize to a JSON stream. The vector is stored as an array of 6 reals (xmin, xmax, ymin, ymax, zmin, zmax)
UT_API bool UT_BoundingBoxT< T >::save | ( | UT_JSONValue & | v | ) | const |
Methods to serialize to a JSON stream. The vector is stored as an array of 6 reals (xmin, xmax, ymin, ymax, zmin, zmax)
|
inline |
Scale then offset a bounding box.
Definition at line 1183 of file UT_BoundingBox.h.
|
inline |
Definition at line 156 of file UT_BoundingBox.h.
|
inline |
Set/Get bounds in "serialized" fashion. The serialized order is (xmin, xmax, ymin, ymax, zmin, zmax).
Definition at line 178 of file UT_BoundingBox.h.
|
inline |
Set/Get bounds in "serialized" fashion. The serialized order is (xmin, xmax, ymin, ymax, zmin, zmax).
Definition at line 183 of file UT_BoundingBox.h.
|
inline |
Definition at line 329 of file UT_BoundingBox.h.
|
inline |
Definition at line 333 of file UT_BoundingBox.h.
|
inline |
Return the size of the largest dimension.
Definition at line 1013 of file UT_BoundingBox.h.
|
inline |
Return the size of the largest dimension, and store the dimension index in "axis"
Definition at line 1026 of file UT_BoundingBox.h.
|
inline |
Definition at line 325 of file UT_BoundingBox.h.
|
inline |
Definition at line 326 of file UT_BoundingBox.h.
|
inline |
Definition at line 327 of file UT_BoundingBox.h.
|
inline |
Splits a box into two disjoint subboxes at the given splitting point. This box is set to the left subbox for splitLeft() and the right subbox for splitRight().
Definition at line 300 of file UT_BoundingBox.h.
|
inline |
Definition at line 306 of file UT_BoundingBox.h.
|
inlinestaticprotected |
Definition at line 463 of file UT_BoundingBox.h.
|
inline |
Definition at line 844 of file UT_BoundingBox.h.
|
inline |
Definition at line 854 of file UT_BoundingBox.h.
|
inline |
Adds the given translate to each component of the bounding box.
Definition at line 869 of file UT_BoundingBox.h.
UT_API bool UT_BoundingBoxT< T >::triangleIntersects | ( | const UT_Vector3T< T > & | v0, |
const UT_Vector3T< T > & | v1, | ||
const UT_Vector3T< T > & | v2 | ||
) | const |
Returns whether the triangle defined by the supplied points intersects the bounding box.
|
inline |
Definition at line 385 of file UT_BoundingBox.h.
|
inline |
Definition at line 371 of file UT_BoundingBox.h.
|
inline |
Definition at line 112 of file UT_BoundingBox.h.
|
inline |
Definition at line 111 of file UT_BoundingBox.h.
|
inline |
Definition at line 322 of file UT_BoundingBox.h.
|
inline |
Definition at line 372 of file UT_BoundingBox.h.
|
inline |
Definition at line 114 of file UT_BoundingBox.h.
|
inline |
Definition at line 113 of file UT_BoundingBox.h.
|
inline |
Definition at line 323 of file UT_BoundingBox.h.
|
inline |
Definition at line 373 of file UT_BoundingBox.h.
|
inline |
Definition at line 116 of file UT_BoundingBox.h.
|
inline |
Definition at line 115 of file UT_BoundingBox.h.
|
inline |
Definition at line 324 of file UT_BoundingBox.h.
|
friend |
|
friend |
Definition at line 455 of file UT_BoundingBox.h.
union { ... } |
Here's the data for the bounding box.
T UT_BoundingBoxT< T >::myFloats[6] |
Definition at line 424 of file UT_BoundingBox.h.
T UT_BoundingBoxT< T >::vals[3][2] |
Definition at line 423 of file UT_BoundingBox.h.