HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_BoundingBox.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  */
7 
8 #ifndef __UT_BoundingBox_h__
9 #define __UT_BoundingBox_h__
10 
11 #include "UT_API.h"
12 #include "UT_Assert.h"
13 #include "UT_Vector3.h"
14 #include "UT_VectorTypes.h"
15 #include <iosfwd>
16 
17 /// Axis-aligned bounding box (AABB).
18 template <typename T>
20 {
21 public:
23 
25  // Default copy constructor is fine.
26  // UT_BoundingBoxT(const UT_BoundingBoxT &);
27  UT_BoundingBoxT(T axmin, T aymin, T azmin,
28  T axmax, T aymax, T azmax)
29  {
30  setBounds(axmin, aymin, azmin, axmax, aymax, azmax);
31  }
32 
33  UT_BoundingBoxT(const UT_Vector3T<T> &lowerbound,
34  const UT_Vector3T<T> &upperbound)
35  {
36  vals[0][0] = lowerbound[0];
37  vals[0][1] = upperbound[0];
38  vals[1][0] = lowerbound[1];
39  vals[1][1] = upperbound[1];
40  vals[2][0] = lowerbound[2];
41  vals[2][1] = upperbound[2];
42  }
43 
44  template <typename S>
46  {
47  vals[0][0] = bbox.vals[0][0];
48  vals[0][1] = bbox.vals[0][1];
49  vals[1][0] = bbox.vals[1][0];
50  vals[1][1] = bbox.vals[1][1];
51  vals[2][0] = bbox.vals[2][0];
52  vals[2][1] = bbox.vals[2][1];
53  }
54 
55  template <typename S>
57  {
58  vals[0][0] = bbox.vals[0][0];
59  vals[0][1] = bbox.vals[0][1];
60  vals[1][0] = bbox.vals[1][0];
61  vals[1][1] = bbox.vals[1][1];
62  vals[2][0] = bbox.vals[2][0];
63  vals[2][1] = bbox.vals[2][1];
64  return *this;
65  }
66 
67  T operator()(unsigned m, unsigned n) const
68  {
69  UT_ASSERT_P( m < 3 && n < 2 );
70  return vals[m][n];
71  }
72  T &operator()(unsigned m, unsigned n)
73  {
74  UT_ASSERT_P( m < 3 && n < 2 );
75  return vals[m][n];
76  }
77  bool operator==(const UT_BoundingBoxT<T> &bbox) const
78  {
79  return vals[0][0] == bbox.vals[0][0] &&
80  vals[0][1] == bbox.vals[0][1] &&
81  vals[1][0] == bbox.vals[1][0] &&
82  vals[1][1] == bbox.vals[1][1] &&
83  vals[2][0] == bbox.vals[2][0] &&
84  vals[2][1] == bbox.vals[2][1];
85  }
86  bool operator!=(const UT_BoundingBoxT<T> &bbox) const
87  {
88  return !(*this == bbox);
89  }
90 
91  bool isEqual(const UT_BoundingBoxT<T> &bbox,
92  T tol = SYS_FTOLERANCE_R) const
93  {
94  return SYSisEqual(vals[0][0], bbox.vals[0][0], tol) &&
95  SYSisEqual(vals[0][1], bbox.vals[0][1], tol) &&
96  SYSisEqual(vals[1][0], bbox.vals[1][0], tol) &&
97  SYSisEqual(vals[1][1], bbox.vals[1][1], tol) &&
98  SYSisEqual(vals[2][0], bbox.vals[2][0], tol) &&
99  SYSisEqual(vals[2][1], bbox.vals[2][1], tol);
100  }
101 
102  T xmin() const { return vals[0][0]; }
103  T xmax() const { return vals[0][1]; }
104  T ymin() const { return vals[1][0]; }
105  T ymax() const { return vals[1][1]; }
106  T zmin() const { return vals[2][0]; }
107  T zmax() const { return vals[2][1]; }
108 
110  { return UT_Vector3T<T>(vals[0][0], vals[1][0], vals[2][0]); }
112  { return UT_Vector3T<T>(vals[0][1], vals[1][1], vals[2][1]); }
113 
114  int isInside(const UT_Vector3T<T> &pt) const;
115  int isInside(const UT_Vector4T<T> &pt) const;
116  int isInside(T x, T y, T z) const;
117 
118  /// Am I totally enclosed in the bounding box passed in
119  /// ("intersects" method tests for partially inside)
120  int isInside(const UT_BoundingBoxT<T> &bbox) const;
121 
122  /// Determine whether a line intersects the box. v0 is one end-point of
123  /// the line, and idir is the inverse direction vector along the line.
124  int isLineInside(const UT_Vector3T<T> &v0,
125  const UT_Vector3T<T> &idir) const;
126 
127  /// Determine the minimum distance of the box to a line segment, or 0
128  /// if the line segment overlaps the box. v0 is one end-point of the
129  /// line, and dir is the direction vector along the line. This method
130  /// conservatively underestimates the distance, so the true line/box
131  /// distance may be greater than the reported value.
132  T approxLineDist2(const UT_Vector3T<T> &v0,
133  const UT_Vector3T<T> &dir) const;
134 
135  /// Check whether the bounding box contains at least one point.
137  bool isValid() const;
139  void makeInvalid() { initBounds(); }
140 
141  /// Efficient test for an invalid bounding box (one comparison instead of
142  /// 3 for a valid bounding box). This only checks X, not Y or Z ranges, so
143  /// only works if the box is fully invalid.
145  bool isInvalidFast() const { return vals[0][0] > vals[0][1]; }
146 
147  void setBounds(T x_min, T y_min, T z_min,
148  T x_max, T y_max, T z_max)
149  {
150  vals[0][0] = x_min;
151  vals[1][0] = y_min;
152  vals[2][0] = z_min;
153  vals[0][1] = x_max;
154  vals[1][1] = y_max;
155  vals[2][1] = z_max;
156  }
157 
158  /// @{
159  /// Set/Get bounds in "serialized" fashion. The serialized order is
160  /// (xmin, xmax, ymin, ymax, zmin, zmax).
161  void setSerialized(const fpreal32 floats[6])
162  {
163  for (int i = 0; i < 6; ++i)
164  myFloats[i] = floats[i];
165  }
166  void setSerialized(const fpreal64 floats[6])
167  {
168  for (int i = 0; i < 6; ++i)
169  myFloats[i] = floats[i];
170  }
171  const T *getSerialized() const { return myFloats; }
172  /// @}
173 
174  /// @{
175  /// Access to the serialized data
176  const T *data() const { return myFloats; }
177  T *data() { return myFloats; }
178  /// @}
179 
180  /// @{
181  /// Iterate over the data serially
182  const T *begin() const { return &myFloats[0]; }
183  const T *end() const { return &myFloats[6]; }
184  T *begin() { return &myFloats[0]; }
185  T *end() { return &myFloats[6]; }
186  /// @}
187 
188  /// @{
189  /// Compute a hash
190  uint64 hash() const;
191  friend std::size_t hash_value(const this_type &t) { return t.hash(); }
192  /// @}
193 
194  /// Initialize the box to the largest size
195  void initMaxBounds();
196 
197  /// Initialize the box such that
198  /// - No points are contained in the box
199  /// - The box occupies no position in space
201  void initBounds();
202 
203  /// Initialize the bounds with the bounds given in min and max. No check
204  /// is made to ensure that min is smaller than max.
205  void initBounds(const UT_Vector3T<T> &min,
206  const UT_Vector3T<T> &max);
207 
208  /// Initialize zero-sized bounds at the location of the point given by pt.
210  void initBounds(const UT_Vector3T<T> &pt);
211 
212  /// Initialize zero-sized bounds at the location of the point given by pt.
213  void initBounds(const UT_Vector4T<T> &pt);
214 
215  /// Initialize zero-sized bounds at the location of the point defined by
216  /// x, y, and z;
218  void initBounds(T x, T y, T z);
219 
220  /// Initialize zero-sized bounds at the location of the point given by v.
221  void initBounds(const fpreal32 *v)
222  { initBounds(v[0], v[1], v[2]); }
223 
224  /// Initialize zero-sized bounds at the location of the point given by v.
225  void initBounds(const fpreal64 *v)
226  { initBounds(v[0], v[1], v[2]); }
227 
228  /// Initialize the bounds to the same as given by box.
229  void initBounds(const UT_BoundingBoxT<T> &box);
230 
231  /// Enlarge the existing bounds to encompass the bounds given by min and
232  /// max.
233  void enlargeBounds(const UT_Vector3T<T> &min,
234  const UT_Vector3T<T> &max);
235 
236  /// Enlarge the existing bounds to encompass the point given by pt.
238  void enlargeBounds(const UT_Vector3T<T> &pt);
239 
240  /// Enlarge the existing bounds to encompass the point given by pt.
241  void enlargeBounds(const UT_Vector4T<T> &pt);
242 
243  /// Enlarge the existing bounds to encompass the point defined by
244  /// x, y, and z.
246  void enlargeBounds(T x, T y, T z);
247 
248  /// Enlarge the existing bounds to encompass the point given in v.
249  void enlargeBounds(const fpreal32 *v)
250  { enlargeBounds(v[0], v[1], v[2]); }
251 
252  /// Enlarge the existing bounds to encompass the point given in v.
253  void enlargeBounds(const fpreal64 *v)
254  { enlargeBounds(v[0], v[1], v[2]); }
255 
256  /// Enlarge the existing bounds to encompass the bounds given by box.
258  void enlargeBounds(const UT_BoundingBoxT<T> &box);
259 
260  /// Expand the bounding box on all axes, as a relative fraction of the
261  /// current bbox dimensions, and/or using an absolute offset.
263  void expandBounds(T relative, T absolute);
264 
265  /// Expand the bounding box on all sides using separate absolute offsets
266  /// for each axis.
268  void expandBounds(T dltx, T dlty, T dlyz);
269 
270  /// Perform a minimal enlargement of the floating point values in this
271  /// bounding box. This enlargement guarantees that the new floating
272  /// point values are always different from the prior ones. The number
273  /// of mantissa bits to be changed can be adjusted using the bits
274  /// parameter, and a minimum enlargement amount can be specified in min.
275  void enlargeFloats(int bits = 1, T min = 1e-5);
276 
277  /// Find the intersections of two bounding boxes
278  void clipBounds(const UT_BoundingBoxT<T> &box);
279 
280  /// Splits a box into two disjoint subboxes at the given splitting
281  /// point. This box is set to the left subbox for splitLeft() and the
282  /// right subbox for splitRight().
283  void splitLeft(UT_BoundingBoxT<T> &box, int axis, T split)
284  {
285  box = *this;
286  box.vals[axis][0] = split;
287  vals[axis][1] = split;
288  }
289  void splitRight(UT_BoundingBoxT<T> &box, int axis, T split)
290  {
291  box = *this;
292  box.vals[axis][1] = split;
293  vals[axis][0] = split;
294  }
295 
296  template <typename MATRIX>
297  void transform(const MATRIX &mat);
298  template <typename MATRIX>
299  void transform(const MATRIX &mat,
300  UT_BoundingBoxT<T> &newbbox) const;
301 
302  /// Adds the given translate to each component of the bounding box.
303  void translate(const UT_Vector3T<T> &delta);
304 
305  T xsize() const { return sizeX(); }
306  T ysize() const { return sizeY(); }
307  T zsize() const { return sizeZ(); }
308  T sizeX() const { return vals[0][1] - vals[0][0]; }
309  T sizeY() const { return vals[1][1] - vals[1][0]; }
310  T sizeZ() const { return vals[2][1] - vals[2][0]; }
311 
313  { return UT_Vector3T<T>(vals[0][1] - vals[0][0],
314  vals[1][1] - vals[1][0],
315  vals[2][1] - vals[2][0]); }
316  T sizeAxis(int axis) const
317  {
318  UT_ASSERT(axis >= 0 && axis < 3);
319  return vals[axis][1] - vals[axis][0];
320  }
321 
322  /// Return the size of the largest dimension
323  T sizeMax() const;
324  /// Return the size of the largest dimension, and store the dimension
325  /// index in "axis"
326  T sizeMax(int &axis) const;
327  /// Returns the minimum delta vector from the point to the bounding
328  /// box or between two bounding boxes.
329  UT_Vector3T<T> minDistDelta(const UT_Vector3T<T> &p) const;
330  UT_Vector3T<T> minDistDelta(const UT_BoundingBoxT<T> &box) const;
331  /// Returns minimum distance from point to bounding box squared.
332  /// Returns 0 if point in bouding box.
333  T minDist2(const UT_Vector3T<T> &p) const
334  { return minDistDelta(p).length2(); }
335  /// Minimum disance between two bboxes squared.
336  T minDist2(const UT_BoundingBoxT<T> &box) const
337  { return minDistDelta(box).length2(); }
338 
339  /// Returns the smallest absolute translation from this to box that
340  /// produces the maximum overlap between the two boxes.
341  UT_Vector3T<T> minDistToMaxOverlap(const UT_BoundingBoxT<T> &box) const;
342 
343  /// Returns the radius of a sphere that would fully enclose the box.
344  T getRadius() const { return 0.5*size().length(); }
345 
346  /// Finds the out code of the point relative to this box:
347  int getOutCode(const UT_Vector3T<T> &pt) const;
348 
349  T xcenter() const { return centerX(); }
350  T ycenter() const { return centerY(); }
351  T zcenter() const { return centerZ(); }
352  T centerX() const { return (vals[0][0] + vals[0][1])*0.5; }
353  T centerY() const { return (vals[1][0] + vals[1][1])*0.5; }
354  T centerZ() const { return (vals[2][0] + vals[2][1])*0.5; }
355  T centerAxis(int axis) const
356  { return (vals[axis][0] + vals[axis][1])*0.5; }
358  { return UT_Vector3T<T>((vals[0][0] + vals[0][1])*0.5,
359  (vals[1][0] + vals[1][1])*0.5,
360  (vals[2][0] + vals[2][1])*0.5); }
361 
362  T area() const;
363  T volume() const { return xsize()*ysize()*zsize(); }
364  void addToMin(const UT_Vector3T<T> &vec);
365  void addToMax(const UT_Vector3T<T> &vec);
366 
367  /// Scale then offset a bounding box.
368  void scaleOffset(const UT_Vector3T<T> &scale,
369  const UT_Vector3T<T> &offset);
370  int maxAxis() const;
371  int minAxis() const;
372 
373  /// Intersect a ray with the box. Returns 0 if no intersection found.
374  /// distance will be set to the intersection distance (between 0 & tmax)
375  /// The normal will also be set. The direction of the normal is
376  /// indeterminant (to fix it, you might want to dot(dir, *nml) to check
377  /// the orientation.
378  int intersectRay(const UT_Vector3T<T> &org,
379  const UT_Vector3T<T> &dir,
380  T tmax=1E17F,
381  T *distance=0, UT_Vector3T<T> *nml=0) const;
382  int intersectRange(const UT_Vector3T<T> &org,
383  const UT_Vector3T<T> &dir,
384  T &min, T &max) const;
385 
386  /// This determines if the tube, capped at distances tmin & tmax,
387  /// intersects this.
388  int intersectTube(const UT_Vector3T<T> &org,
389  const UT_Vector3T<T> &dir,
390  T radius,
391  T tmin=-1E17f, T tmax=1E17f) const;
392 
393  int intersects(const UT_BoundingBoxT<T> &box) const;
394 
395  /// Changes the bounds to be those of the intersection of this box
396  /// and the supplied BBox. Returns 1 if intersects, 0 otherwise.
397  int computeIntersection(const UT_BoundingBoxT<T> &box);
398 
399  /// Here's the data for the bounding box
400  union {
401  T vals[3][2];
402  T myFloats[6];
403  };
404 
405  void getBBoxPoints(UT_Vector3T<T> (&ptarray)[8]) const;
406  void getBBoxPoints(UT_Vector4T<T> (&ptarray)[8]) const;
407  template <typename MATRIX>
408  int getBBoxPoints(UT_Vector3T<T> (&ptarray)[8],
409  const MATRIX &transform_matrix) const;
410 
411  /// Dump the bounding box to stderr. The msg is printed before the bounds
412  void dump(const char *msg=0) const;
413  /// Dump the bounding box geometry to a draw file
414  void dumpGeo(FILE *fp) const;
415 
416  /// @{
417  /// Methods to serialize to a JSON stream. The vector is stored as an
418  /// array of 6 reals (xmin, xmax, ymin, ymax, zmin, zmax)
419  bool save(UT_JSONWriter &w) const;
420  bool save(UT_JSONValue &v) const;
421  bool load(UT_JSONParser &p);
422  /// @}
423 
424 
425 protected:
426  friend
427  std::ostream &operator<<(std::ostream &os, const UT_BoundingBoxT<T> &box)
428  {
429  box.outTo(os);
430  return os;
431  }
432 
433  void outTo(std::ostream &os) const;
434  // Ugly helper function to allow instantation with int64.
435  static bool SYSisEqual(int64 a, int64 b, int64) { return a==b; }
436 };
437 
438 template <typename T>
439 UT_API size_t format(char *buf, size_t bufsize, const UT_BoundingBoxT<T> &v);
440 
441 template <typename T>
442 bool
444 {
445  return vals[0][0] <= vals[0][1] &&
446  vals[1][0] <= vals[1][1] &&
447  vals[2][0] <= vals[2][1];
448 }
449 
450 template <typename T>
451 void
453 {
454  // Initialize with min and max reversed, so that it's empty
455  const T maxv = 0.5*std::numeric_limits<T>::max();
456  const T minv = -maxv;
457  vals[0][0] = maxv;
458  vals[0][1] = minv;
459  vals[1][0] = maxv;
460  vals[1][1] = minv;
461  vals[2][0] = maxv;
462  vals[2][1] = minv;
463 }
464 
465 template <typename T>
466 void
468 {
469  vals[0][0] = pt.x();
470  vals[0][1] = pt.x();
471  vals[1][0] = pt.y();
472  vals[1][1] = pt.y();
473  vals[2][0] = pt.z();
474  vals[2][1] = pt.z();
475 }
476 
477 template <typename T>
478 void
480 {
481  vals[0][0] = x;
482  vals[0][1] = x;
483  vals[1][0] = y;
484  vals[1][1] = y;
485  vals[2][0] = z;
486  vals[2][1] = z;
487 }
488 
489 template <typename T>
490 void
492 {
493  vals[0][0] = SYSmin(vals[0][0], pt.x());
494  vals[0][1] = SYSmax(vals[0][1], pt.x());
495  vals[1][0] = SYSmin(vals[1][0], pt.y());
496  vals[1][1] = SYSmax(vals[1][1], pt.y());
497  vals[2][0] = SYSmin(vals[2][0], pt.z());
498  vals[2][1] = SYSmax(vals[2][1], pt.z());
499 }
500 
501 template <typename T>
502 void
504 {
505  vals[0][0] = SYSmin(vals[0][0], x);
506  vals[0][1] = SYSmax(vals[0][1], x);
507  vals[1][0] = SYSmin(vals[1][0], y);
508  vals[1][1] = SYSmax(vals[1][1], y);
509  vals[2][0] = SYSmin(vals[2][0], z);
510  vals[2][1] = SYSmax(vals[2][1], z);
511 }
512 
513 template <typename T>
514 void
516 {
517  vals[0][0] = SYSmin(vals[0][0], box(0, 0));
518  vals[0][1] = SYSmax(vals[0][1], box(0, 1));
519  vals[1][0] = SYSmin(vals[1][0], box(1, 0));
520  vals[1][1] = SYSmax(vals[1][1], box(1, 1));
521  vals[2][0] = SYSmin(vals[2][0], box(2, 0));
522  vals[2][1] = SYSmax(vals[2][1], box(2, 1));
523 }
524 
525 template <typename T>
526 void
527 UT_BoundingBoxT<T>::expandBounds(T relative, T absolute)
528 {
529  T d;
530 
531  // Don't factor out percent for improved numerical stability when
532  // dealing with large boxes.
533  d = absolute + vals[0][1]*relative - vals[0][0]*relative;
534  vals[0][0] -= d; vals[0][1] += d;
535  d = absolute + vals[1][1]*relative - vals[1][0]*relative;
536  vals[1][0] -= d; vals[1][1] += d;
537  d = absolute + vals[2][1]*relative - vals[2][0]*relative;
538  vals[2][0] -= d; vals[2][1] += d;
539 }
540 
541 template <typename T>
542 void
543 UT_BoundingBoxT<T>::expandBounds(T dltx, T dlty, T dltz)
544 {
545  vals[0][0] -= dltx; vals[0][1] += dltx;
546  vals[1][0] -= dlty; vals[1][1] += dlty;
547  vals[2][0] -= dltz; vals[2][1] += dltz;
548 }
549 
555 
556 #endif
#define SYSmax(a, b)
Definition: SYS_Math.h:1367
bool operator==(const UT_BoundingBoxT< T > &bbox) const
GLenum GLuint GLsizei bufsize
Definition: glcorearb.h:1817
T zsize() const
T centerZ() const
T minDist2(const UT_Vector3T< T > &p) const
SYS_FORCE_INLINE void makeInvalid()
Axis-aligned bounding box (AABB).
Definition: GEO_Detail.h:43
const GLdouble * v
Definition: glcorearb.h:836
const T * end() const
T centerY() const
GLdouble GLdouble GLdouble z
Definition: glcorearb.h:847
UT_Vector3T< T > maxvec() const
GLboolean GLboolean GLboolean GLboolean a
Definition: glcorearb.h:1221
JSON reader class which handles parsing of JSON or bJSON files.
Definition: UT_JSONParser.h:75
#define UT_API
Definition: UT_API.h:13
void setBounds(T x_min, T y_min, T z_min, T x_max, T y_max, T z_max)
T ycenter() const
GLint y
Definition: glcorearb.h:102
Class which writes ASCII or binary JSON streams.
Definition: UT_JSONWriter.h:32
T ysize() const
SYS_FORCE_INLINE T & x(void)
Definition: UT_Vector3.h:498
3D Vector class.
4D Vector class.
Definition: UT_Vector4.h:155
SYS_FORCE_INLINE bool isInvalidFast() const
T sizeAxis(int axis) const
png_uint_32 i
Definition: png.h:2877
GLsizeiptr size
Definition: glcorearb.h:663
T sizeY() const
void initBounds(const fpreal64 *v)
Initialize zero-sized bounds at the location of the point given by v.
UT_BoundingBoxT & operator=(const UT_BoundingBoxT< S > &bbox)
SYS_FORCE_INLINE void expandBounds(T relative, T absolute)
SYS_FORCE_INLINE T & z(void)
Definition: UT_Vector3.h:502
long long int64
Definition: SYS_Types.h:107
GA_API const UT_StringHolder scale
T & operator()(unsigned m, unsigned n)
png_FILE_p fp
Definition: png.h:2028
GLdouble n
Definition: glcorearb.h:2007
void setSerialized(const fpreal64 floats[6])
const T * data() const
unsigned long long uint64
Definition: SYS_Types.h:108
bool operator!=(const UT_BoundingBoxT< T > &bbox) const
UT_Vector3T< T > center() const
UT_BoundingBoxT(const UT_Vector3T< T > &lowerbound, const UT_Vector3T< T > &upperbound)
T distance(const UT_Vector4T< T > &v1, const UT_Vector4T< T > &v2)
Definition: UT_Vector4.h:698
const std::enable_if<!VecTraits< T >::IsVec, T >::type & max(const T &a, const T &b)
Definition: Composite.h:133
#define UT_ASSERT_P(ZZ)
Definition: UT_Assert.h:125
double fpreal64
Definition: SYS_Types.h:192
#define SYS_FORCE_INLINE
Definition: SYS_Inline.h:45
GLintptr offset
Definition: glcorearb.h:664
void enlargeBounds(const fpreal32 *v)
Enlarge the existing bounds to encompass the point given in v.
UT_API size_t format(char *buf, size_t bufsize, const UT_BoundingBoxT< T > &v)
T minDist2(const UT_BoundingBoxT< T > &box) const
Minimum disance between two bboxes squared.
GLboolean GLboolean GLboolean b
Definition: glcorearb.h:1221
void enlargeBounds(const UT_Vector3T< T > &min, const UT_Vector3T< T > &max)
GA_API const UT_StringHolder transform
T xsize() const
uint64 hash() const
Compute UT_BoundingBox hash.
UT_Vector3T< T > size() const
const T * getSerialized() const
GLfloat v0
Definition: glcorearb.h:815
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glcorearb.h:2539
void setSerialized(const fpreal32 floats[6])
T volume() const
T zcenter() const
SYS_FORCE_INLINE T & y(void)
Definition: UT_Vector3.h:500
T getRadius() const
Returns the radius of a sphere that would fully enclose the box.
void enlargeBounds(const fpreal64 *v)
Enlarge the existing bounds to encompass the point given in v.
T operator()(unsigned m, unsigned n) const
SYS_FORCE_INLINE bool isValid() const
Check whether the bounding box contains at least one point.
UT_Vector3T< T > minvec() const
#define SYS_FTOLERANCE_R
Definition: SYS_Types.h:276
T sizeZ() const
bool intersects(const Box< Vec3< T > > &b, const Line3< T > &r, Vec3< T > &ip)
Definition: ImathBoxAlgo.h:728
void splitRight(UT_BoundingBoxT< T > &box, int axis, T split)
GLint GLenum GLint x
Definition: glcorearb.h:408
SYS_FORCE_INLINE void initBounds()
T centerX() const
Class to store JSON objects as C++ objects.
Definition: UT_JSONValue.h:75
void splitLeft(UT_BoundingBoxT< T > &box, int axis, T split)
UT_BoundingBoxT(T axmin, T aymin, T azmin, T axmax, T aymax, T azmax)
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:856
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:126
T xcenter() const
friend std::size_t hash_value(const this_type &t)
Compute UT_BoundingBox hash.
UT_BoundingBoxT(const UT_BoundingBoxT< S > &bbox)
#define SYSmin(a, b)
Definition: SYS_Math.h:1368
const std::enable_if<!VecTraits< T >::IsVec, T >::type & min(const T &a, const T &b)
Definition: Composite.h:129
void initBounds(const fpreal32 *v)
Initialize zero-sized bounds at the location of the point given by v.
static bool SYSisEqual(int64 a, int64 b, int64)
float fpreal32
Definition: SYS_Types.h:191
T centerAxis(int axis) const
const T * begin() const
T sizeX() const
GA_API const UT_StringHolder area
bool isEqual(const UT_BoundingBoxT< T > &bbox, T tol=SYS_FTOLERANCE_R) const