HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_OBBox.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  * NAME: UT_OBBox.h ( UT Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __UT_OBBox_h__
12 #define __UT_OBBox_h__
13 
14 #include "UT_API.h"
15 #include "UT_Matrix3.h"
16 #include "UT_Vector3.h"
17 #include "UT_BoundingBox.h"
18 
19 template<typename T>
20 class UT_Array;
21 
22 /// Arbitrarily Oriented Bounding (OBB)
23 template <typename T>
24 class UT_API UT_OBBoxT
25 {
26 public:
27  UT_OBBoxT();
28  /// Construct the OBB from a transform and radii.
29  UT_OBBoxT(const UT_Matrix4T<T> &transform, const UT_Vector3T<T> &radii);
30  /// Construct the OBB from a set of points.
31  UT_OBBoxT(const UT_Array<UT_Vector3T<T> > &points, int refinement = 6);
32  /// Construct the OBB using the instancing parameters. Note that size is the
33  /// full size in this case--not radii or half-sizes!
35  const UT_QuaternionT<T> &orientation,
36  const UT_Vector3T<T> &pivot = UT_Vector3T<T>((T) 0));
37 
38  bool operator==(const UT_OBBoxT<T> &other) const;
39 
40  /// Return whether the bbox is valid (contains any points).
41  bool isValid() const;
42 
43  /// Calculate the OBB for the set of points
44  void calcOBB(const UT_Array<UT_Vector3T<T> > &points, int refinement = 6);
45 
46  /// Return the basis that defines the orientation of the OBB
47  /// Note: this is the transpose of what you probably expect.
48  SYS_DEPRECATED_REPLACE(19.5, "getRotationMatrix")
49  UT_Matrix3T<T> getBasis() const;
50 
51  /// Return the rotation matrix of the OBB.
52  const UT_Matrix3T<T> &getRotationMatrix() const { return myBasis; }
53 
54  /// Return the half radii(side length) of the OBB
55  UT_Vector3T<T> getRadii() const {return myRadii;}
56  /// Return the euler rotation angles (in radians).
57  UT_Vector3T<T> getRotation() const;
58  /// Return the center of the OBB
59  UT_Vector3T<T> getCenter() const {return myCenter;}
60  /// Return the tranform matrix of the OBB
61  UT_Matrix4T<T> getTransform() const;
62  /// Return the untransformed bounding box.
63  UT_BoundingBoxT<T> getBBox() const;
64  /// Return the given axis direction
65  UT_Vector3T<T> getAxis(int axis) const;
66  /// Return the minimum axis direction
67  UT_Vector3T<T> getMinAxis() const;
68  /// Return the maximum axis direction
69  UT_Vector3T<T> getMaxAxis() const;
70 
71  /// Checks whether this oriented bouding box intersects other.
72  bool intersects(const UT_OBBoxT<T>& other) const;
73 
74  /// Test whether the point is contained inside the box.
75  bool isInside(const UT_Vector3T<T> &pt) const;
76 
77 private:
79  UT_Vector3T<T> myCenter;
80  UT_Vector3T<T> myRadii;
81 };
82 
86 typedef UT_OBBoxT<float> UT_OBBox; // deprecated
87 
88 #endif
GLdouble GLdouble GLint GLint const GLdouble * points
Definition: glad.h:2676
Axis-aligned bounding box (AABB).
Definition: GEO_Detail.h:41
__hostdev__ bool isValid(GridType gridType, GridClass gridClass)
return true if the combination of GridType and GridClass is valid.
Definition: NanoVDB.h:860
UT_OBBoxT< float > UT_OBBox
Definition: UT_OBBox.h:86
Arbitrarily Oriented Bounding (OBB)
Definition: GU_Detail.h:58
#define UT_API
Definition: UT_API.h:14
3D Vector class.
#define SYS_DEPRECATED_REPLACE(__V__, __R__)
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
UT_OBBoxT< fpreal > UT_OBBoxR
Definition: UT_OBBox.h:83
UT_OBBoxT< fpreal64 > UT_OBBoxD
Definition: UT_OBBox.h:85
UT_Vector3T< T > getRadii() const
Return the half radii(side length) of the OBB.
Definition: UT_OBBox.h:55
GA_API const UT_StringHolder transform
GLsizeiptr size
Definition: glcorearb.h:664
Quaternion class.
Definition: GEO_Detail.h:48
GT_Basis myBasis
Definition: GT_CurveEval.h:262
SIM_API const UT_StringHolder position
GA_API const UT_StringHolder pivot
UT_Vector3T< T > getCenter() const
Return the center of the OBB.
Definition: UT_OBBox.h:59
UT_OBBoxT< fpreal32 > UT_OBBoxF
Definition: UT_OBBox.h:84
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool intersects(const Box< Vec3< T >> &b, const Line3< T > &r, Vec3< T > &ip) IMATH_NOEXCEPT
Definition: ImathBoxAlgo.h:642