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 
159  bool hasVolume() const
160  {
161  return vals[0][1] > vals[0][0] &&
162  vals[1][1] > vals[1][0] &&
163  vals[2][1] > vals[2][0];
164  }
165 
166  /// @{
167  /// Set/Get bounds in "serialized" fashion. The serialized order is
168  /// (xmin, xmax, ymin, ymax, zmin, zmax).
169  void setSerialized(const fpreal32 floats[6])
170  {
171  for (int i = 0; i < 6; ++i)
172  myFloats[i] = floats[i];
173  }
174  void setSerialized(const fpreal64 floats[6])
175  {
176  for (int i = 0; i < 6; ++i)
177  myFloats[i] = floats[i];
178  }
179  const T *getSerialized() const { return myFloats; }
180  /// @}
181 
182  /// @{
183  /// Access to the serialized data
184  const T *data() const { return myFloats; }
185  T *data() { return myFloats; }
186  /// @}
187 
188  /// @{
189  /// Iterate over the data serially
190  const T *begin() const { return &myFloats[0]; }
191  const T *end() const { return &myFloats[6]; }
192  T *begin() { return &myFloats[0]; }
193  T *end() { return &myFloats[6]; }
194  /// @}
195 
196  /// @{
197  /// Compute a hash
198  uint64 hash() const;
199  friend std::size_t hash_value(const this_type &t) { return t.hash(); }
200  /// @}
201 
202  /// Initialize the box to the largest size
203  void initMaxBounds();
204 
205  /// Initialize the box such that
206  /// - No points are contained in the box
207  /// - The box occupies no position in space
209  void initBounds();
210 
211  /// Initialize the bounds with the bounds given in min and max. No check
212  /// is made to ensure that min is smaller than max.
213  void initBounds(const UT_Vector3T<T> &min,
214  const UT_Vector3T<T> &max);
215 
216  /// Initialize zero-sized bounds at the location of the point given by pt.
218  void initBounds(const UT_Vector3T<T> &pt);
219 
220  /// Initialize zero-sized bounds at the location of the point given by pt.
221  void initBounds(const UT_Vector4T<T> &pt);
222 
223  /// Initialize zero-sized bounds at the location of the point defined by
224  /// x, y, and z;
226  void initBounds(T x, T y, T z);
227 
228  /// Initialize zero-sized bounds at the location of the point given by v.
229  void initBounds(const fpreal32 *v)
230  { initBounds(v[0], v[1], v[2]); }
231 
232  /// Initialize zero-sized bounds at the location of the point given by v.
233  void initBounds(const fpreal64 *v)
234  { initBounds(v[0], v[1], v[2]); }
235 
236  /// Initialize the bounds to the same as given by box.
237  void initBounds(const UT_BoundingBoxT<T> &box);
238 
239  /// Enlarge the existing bounds to encompass the bounds given by min and
240  /// max.
241  void enlargeBounds(const UT_Vector3T<T> &min,
242  const UT_Vector3T<T> &max);
243 
244  /// Enlarge the existing bounds to encompass the point given by pt.
246  void enlargeBounds(const UT_Vector3T<T> &pt);
247 
248  /// Enlarge the existing bounds to encompass the point given by pt.
249  void enlargeBounds(const UT_Vector4T<T> &pt);
250 
251  /// Enlarge the existing bounds to encompass the point defined by
252  /// x, y, and z.
254  void enlargeBounds(T x, T y, T z);
255 
256  /// Enlarge the existing bounds to encompass the point given in v.
257  void enlargeBounds(const fpreal32 *v)
258  { enlargeBounds(v[0], v[1], v[2]); }
259 
260  /// Enlarge the existing bounds to encompass the point given in v.
261  void enlargeBounds(const fpreal64 *v)
262  { enlargeBounds(v[0], v[1], v[2]); }
263 
264  /// Enlarge the existing bounds to encompass the bounds given by box.
266  void enlargeBounds(const UT_BoundingBoxT<T> &box);
267 
268  /// Expand the bounding box on all axes, as a relative fraction of the
269  /// current bbox dimensions, and/or using an absolute offset.
271  void expandBounds(T relative, T absolute);
272 
273  /// Expand the bounding box on all sides using separate absolute offsets
274  /// for each axis.
276  void expandBounds(T dltx, T dlty, T dlyz);
277 
278  /// Perform a minimal enlargement of the floating point values in this
279  /// bounding box. This enlargement guarantees that the new floating
280  /// point values are always different from the prior ones. The number
281  /// of mantissa bits to be changed can be adjusted using the bits
282  /// parameter, and a minimum enlargement amount can be specified in min.
283  void enlargeFloats(int bits = 1, T min = 1e-5);
284 
285  /// Find the intersections of two bounding boxes
286  void clipBounds(const UT_BoundingBoxT<T> &box);
287 
288  /// Splits a box into two disjoint subboxes at the given splitting
289  /// point. This box is set to the left subbox for splitLeft() and the
290  /// right subbox for splitRight().
291  void splitLeft(UT_BoundingBoxT<T> &box, int axis, T split)
292  {
293  box = *this;
294  box.vals[axis][0] = split;
295  vals[axis][1] = split;
296  }
297  void splitRight(UT_BoundingBoxT<T> &box, int axis, T split)
298  {
299  box = *this;
300  box.vals[axis][1] = split;
301  vals[axis][0] = split;
302  }
303 
304  template <typename MATRIX>
305  void transform(const MATRIX &mat);
306  template <typename MATRIX>
307  void transform(const MATRIX &mat,
308  UT_BoundingBoxT<T> &newbbox) const;
309 
310  /// Adds the given translate to each component of the bounding box.
311  void translate(const UT_Vector3T<T> &delta);
312 
313  T xsize() const { return sizeX(); }
314  T ysize() const { return sizeY(); }
315  T zsize() const { return sizeZ(); }
316  T sizeX() const { return vals[0][1] - vals[0][0]; }
317  T sizeY() const { return vals[1][1] - vals[1][0]; }
318  T sizeZ() const { return vals[2][1] - vals[2][0]; }
319 
321  { return UT_Vector3T<T>(vals[0][1] - vals[0][0],
322  vals[1][1] - vals[1][0],
323  vals[2][1] - vals[2][0]); }
324  T sizeAxis(int axis) const
325  {
326  UT_ASSERT(axis >= 0 && axis < 3);
327  return vals[axis][1] - vals[axis][0];
328  }
329 
330  /// Return the size of the largest dimension
331  T sizeMax() const;
332  /// Return the size of the largest dimension, and store the dimension
333  /// index in "axis"
334  T sizeMax(int &axis) const;
335  /// Returns the minimum delta vector from the point to the bounding
336  /// box or between two bounding boxes.
337  UT_Vector3T<T> minDistDelta(const UT_Vector3T<T> &p) const;
338  UT_Vector3T<T> minDistDelta(const UT_BoundingBoxT<T> &box) const;
339  /// Returns minimum distance from point to bounding box squared.
340  /// Returns 0 if point in bouding box.
341  T minDist2(const UT_Vector3T<T> &p) const
342  { return minDistDelta(p).length2(); }
343  /// Minimum disance between two bboxes squared.
344  T minDist2(const UT_BoundingBoxT<T> &box) const
345  { return minDistDelta(box).length2(); }
346 
347  /// Returns the smallest absolute translation from this to box that
348  /// produces the maximum overlap between the two boxes.
349  UT_Vector3T<T> minDistToMaxOverlap(const UT_BoundingBoxT<T> &box) const;
350 
351  /// Returns the radius of a sphere that would fully enclose the box.
352  T getRadius() const { return 0.5*size().length(); }
353 
354  /// Finds the out code of the point relative to this box:
355  int getOutCode(const UT_Vector3T<T> &pt) const;
356 
357  T xcenter() const { return centerX(); }
358  T ycenter() const { return centerY(); }
359  T zcenter() const { return centerZ(); }
360  T centerX() const { return (vals[0][0] + vals[0][1])*0.5; }
361  T centerY() const { return (vals[1][0] + vals[1][1])*0.5; }
362  T centerZ() const { return (vals[2][0] + vals[2][1])*0.5; }
363  T centerAxis(int axis) const
364  { return (vals[axis][0] + vals[axis][1])*0.5; }
366  { return UT_Vector3T<T>((vals[0][0] + vals[0][1])*0.5,
367  (vals[1][0] + vals[1][1])*0.5,
368  (vals[2][0] + vals[2][1])*0.5); }
369 
370  T area() const;
371  T volume() const { return xsize()*ysize()*zsize(); }
372  void addToMin(const UT_Vector3T<T> &vec);
373  void addToMax(const UT_Vector3T<T> &vec);
374 
375  /// Scale then offset a bounding box.
376  void scaleOffset(const UT_Vector3T<T> &scale,
377  const UT_Vector3T<T> &offset);
378  int maxAxis() const;
379  int minAxis() const;
380 
381  /// Intersect a ray with the box. Returns 0 if no intersection found.
382  /// distance will be set to the intersection distance (between 0 & tmax)
383  /// The normal will also be set. The direction of the normal is
384  /// indeterminant (to fix it, you might want to dot(dir, *nml) to check
385  /// the orientation.
386  int intersectRay(const UT_Vector3T<T> &org,
387  const UT_Vector3T<T> &dir,
388  T tmax=1E17F,
389  T *distance=0, UT_Vector3T<T> *nml=0) const;
390  int intersectRange(const UT_Vector3T<T> &org,
391  const UT_Vector3T<T> &dir,
392  T &min, T &max) const;
393 
394  /// This determines if the tube, capped at distances tmin & tmax,
395  /// intersects this.
396  int intersectTube(const UT_Vector3T<T> &org,
397  const UT_Vector3T<T> &dir,
398  T radius,
399  T tmin=-1E17f, T tmax=1E17f) const;
400 
401  int intersects(const UT_BoundingBoxT<T> &box) const;
402 
403  /// Changes the bounds to be those of the intersection of this box
404  /// and the supplied BBox. Returns 1 if intersects, 0 otherwise.
405  int computeIntersection(const UT_BoundingBoxT<T> &box);
406 
407  /// Here's the data for the bounding box
408  union {
409  T vals[3][2];
410  T myFloats[6];
411  };
412 
413  void getBBoxPoints(UT_Vector3T<T> (&ptarray)[8]) const;
414  void getBBoxPoints(UT_Vector4T<T> (&ptarray)[8]) const;
415  template <typename MATRIX>
416  int getBBoxPoints(UT_Vector3T<T> (&ptarray)[8],
417  const MATRIX &transform_matrix) const;
418 
419  /// Dump the bounding box to stderr. The msg is printed before the bounds
420  void dump(const char *msg=0) const;
421  /// Dump the bounding box geometry to a draw file
422  void dumpGeo(FILE *fp) const;
423 
424  /// @{
425  /// Methods to serialize to a JSON stream. The vector is stored as an
426  /// array of 6 reals (xmin, xmax, ymin, ymax, zmin, zmax)
427  bool save(UT_JSONWriter &w) const;
428  bool save(UT_JSONValue &v) const;
429  bool load(UT_JSONParser &p);
430  /// @}
431 
432 
433 protected:
434  friend
435  std::ostream &operator<<(std::ostream &os, const UT_BoundingBoxT<T> &box)
436  {
437  box.outTo(os);
438  return os;
439  }
440 
441  void outTo(std::ostream &os) const;
442  // Ugly helper function to allow instantation with int64.
443  static bool SYSisEqual(int64 a, int64 b, int64) { return a==b; }
444 };
445 
446 template <typename T>
447 UT_API size_t format(char *buf, size_t bufsize, const UT_BoundingBoxT<T> &v);
448 
449 template <typename T>
450 bool
452 {
453  return vals[0][0] <= vals[0][1] &&
454  vals[1][0] <= vals[1][1] &&
455  vals[2][0] <= vals[2][1];
456 }
457 
458 template <typename T>
459 void
461 {
462  // Initialize with min and max reversed, so that it's empty
463  const T maxv = 0.5*std::numeric_limits<T>::max();
464  const T minv = -maxv;
465  vals[0][0] = maxv;
466  vals[0][1] = minv;
467  vals[1][0] = maxv;
468  vals[1][1] = minv;
469  vals[2][0] = maxv;
470  vals[2][1] = minv;
471 }
472 
473 template <typename T>
474 void
476 {
477  vals[0][0] = pt.x();
478  vals[0][1] = pt.x();
479  vals[1][0] = pt.y();
480  vals[1][1] = pt.y();
481  vals[2][0] = pt.z();
482  vals[2][1] = pt.z();
483 }
484 
485 template <typename T>
486 void
488 {
489  vals[0][0] = x;
490  vals[0][1] = x;
491  vals[1][0] = y;
492  vals[1][1] = y;
493  vals[2][0] = z;
494  vals[2][1] = z;
495 }
496 
497 template <typename T>
498 void
500 {
501  vals[0][0] = SYSmin(vals[0][0], pt.x());
502  vals[0][1] = SYSmax(vals[0][1], pt.x());
503  vals[1][0] = SYSmin(vals[1][0], pt.y());
504  vals[1][1] = SYSmax(vals[1][1], pt.y());
505  vals[2][0] = SYSmin(vals[2][0], pt.z());
506  vals[2][1] = SYSmax(vals[2][1], pt.z());
507 }
508 
509 template <typename T>
510 void
512 {
513  vals[0][0] = SYSmin(vals[0][0], x);
514  vals[0][1] = SYSmax(vals[0][1], x);
515  vals[1][0] = SYSmin(vals[1][0], y);
516  vals[1][1] = SYSmax(vals[1][1], y);
517  vals[2][0] = SYSmin(vals[2][0], z);
518  vals[2][1] = SYSmax(vals[2][1], z);
519 }
520 
521 template <typename T>
522 void
524 {
525  vals[0][0] = SYSmin(vals[0][0], box(0, 0));
526  vals[0][1] = SYSmax(vals[0][1], box(0, 1));
527  vals[1][0] = SYSmin(vals[1][0], box(1, 0));
528  vals[1][1] = SYSmax(vals[1][1], box(1, 1));
529  vals[2][0] = SYSmin(vals[2][0], box(2, 0));
530  vals[2][1] = SYSmax(vals[2][1], box(2, 1));
531 }
532 
533 template <typename T>
534 void
535 UT_BoundingBoxT<T>::expandBounds(T relative, T absolute)
536 {
537  T d;
538 
539  // Don't factor out percent for improved numerical stability when
540  // dealing with large boxes.
541  d = absolute + vals[0][1]*relative - vals[0][0]*relative;
542  vals[0][0] -= d; vals[0][1] += d;
543  d = absolute + vals[1][1]*relative - vals[1][0]*relative;
544  vals[1][0] -= d; vals[1][1] += d;
545  d = absolute + vals[2][1]*relative - vals[2][0]*relative;
546  vals[2][0] -= d; vals[2][1] += d;
547 }
548 
549 template <typename T>
550 void
551 UT_BoundingBoxT<T>::expandBounds(T dltx, T dlty, T dltz)
552 {
553  vals[0][0] -= dltx; vals[0][1] += dltx;
554  vals[1][0] -= dlty; vals[1][1] += dlty;
555  vals[2][0] -= dltz; vals[2][1] += dltz;
556 }
557 
563 
564 #endif
#define SYSmax(a, b)
Definition: SYS_Math.h:1447
vint4 max(const vint4 &a, const vint4 &b)
Definition: simd.h:4703
bool operator==(const UT_BoundingBoxT< T > &bbox) const
SYS_FORCE_INLINE bool hasVolume() const
T zsize() const
GLsizeiptr size
Definition: glew.h:1681
T centerZ() const
GLsizei bufsize
Definition: glew.h:2581
T minDist2(const UT_Vector3T< T > &p) const
SYS_FORCE_INLINE void makeInvalid()
Axis-aligned bounding box (AABB).
Definition: GEO_Detail.h:43
GLuint GLenum GLenum transform
Definition: glew.h:14742
const T * end() const
GLenum GLenum GLenum GLenum GLenum scale
Definition: glew.h:13880
GLboolean GLboolean GLboolean GLboolean a
Definition: glew.h:9477
T centerY() const
UT_Vector3T< T > maxvec() const
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
const GLdouble * m
Definition: glew.h:9124
Class which writes ASCII or binary JSON streams.
Definition: UT_JSONWriter.h:32
T ysize() const
const GLdouble * v
Definition: glew.h:1391
SYS_FORCE_INLINE T & x(void)
Definition: UT_Vector3.h:507
3D Vector class.
4D Vector class.
Definition: UT_Vector4.h:163
SYS_FORCE_INLINE bool isInvalidFast() const
T sizeAxis(int axis) const
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)
GLdouble GLdouble z
Definition: glew.h:1559
SYS_FORCE_INLINE void expandBounds(T relative, T absolute)
SYS_FORCE_INLINE T & z(void)
Definition: UT_Vector3.h:511
long long int64
Definition: SYS_Types.h:111
T & operator()(unsigned m, unsigned n)
void OIIO_API split(string_view str, std::vector< string_view > &result, string_view sep=string_view(), int maxsplit=-1)
void setSerialized(const fpreal64 floats[6])
const T * data() const
unsigned long long uint64
Definition: SYS_Types.h:112
bool operator!=(const UT_BoundingBoxT< T > &bbox) const
GLint GLint GLint GLint GLint x
Definition: glew.h:1252
UT_Vector3T< T > center() const
GLint GLint GLint GLint GLint GLint y
Definition: glew.h:1252
UT_BoundingBoxT(const UT_Vector3T< T > &lowerbound, const UT_Vector3T< T > &upperbound)
#define UT_ASSERT_P(ZZ)
Definition: UT_Assert.h:134
double fpreal64
Definition: SYS_Types.h:196
#define SYS_FORCE_INLINE
Definition: SYS_Inline.h:45
GLubyte GLubyte GLubyte GLubyte w
Definition: glew.h:1890
GLsizei n
Definition: glew.h:4040
GLsizei GLsizei GLfloat distance
Definition: glew.h:13640
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.
void enlargeBounds(const UT_Vector3T< T > &min, const UT_Vector3T< T > &max)
T xsize() const
uint64 hash() const
Compute UT_BoundingBox hash.
UT_Vector3T< T > size() const
const T * getSerialized() const
void setSerialized(const fpreal32 floats[6])
GLdouble GLdouble GLdouble b
Definition: glew.h:9122
T volume() const
GLfloat GLfloat p
Definition: glew.h:16321
T zcenter() const
SYS_FORCE_INLINE T & y(void)
Definition: UT_Vector3.h:509
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:282
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)
SYS_FORCE_INLINE void initBounds()
T centerX() const
GLfloat v0
Definition: glew.h:1848
Class to store JSON objects as C++ objects.
Definition: UT_JSONValue.h:76
void splitLeft(UT_BoundingBoxT< T > &box, int axis, T split)
UT_BoundingBoxT(T axmin, T aymin, T azmin, T axmax, T aymax, T azmax)
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:135
T xcenter() const
PUGI__FN char_t * translate(char_t *buffer, const char_t *from, const char_t *to, size_t to_length)
Definition: pugixml.cpp:8352
friend std::size_t hash_value(const this_type &t)
Compute UT_BoundingBox hash.
vint4 min(const vint4 &a, const vint4 &b)
Definition: simd.h:4694
UT_BoundingBoxT(const UT_BoundingBoxT< S > &bbox)
GLenum GLuint GLsizei const GLchar * buf
Definition: glew.h:2580
#define SYSmin(a, b)
Definition: SYS_Math.h:1448
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:195
T centerAxis(int axis) const
GLdouble GLdouble t
Definition: glew.h:1398
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
GLintptr offset
Definition: glew.h:1682