HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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 #include "UT_QuickHull.h"
19 
20 template<typename T>
21 class UT_Array;
22 
23 /// Arbitrarily Oriented Bounding (OBB)
24 template <typename T>
26 {
27 public:
28  UT_OBBoxT();
30  int refinement = 6)
31  {
32  init = false;
33  myCenter = 0;
34  myRotation = 0;
35  myRadii = 0;
36  myBasis.identity();
37  calcOBB(points, refinement);
38  }
39 
40  /// Calculate the OBB for the set of points
41  void calcOBB(const UT_Array<UT_Vector3T<T> > &points,
42  int refinement = 6);
43  /// Return the basis that defines the orientation of the OBB
44  UT_Matrix3T<T> getBasis() const {return myBasis;}
45  /// Return the half radii(side length) of the OBB
46  UT_Vector3T<T> getRadii() const {return myRadii;}
47  /// Return the rotation i radians
48  UT_Vector3T<T> getRotation() const {return myRotation;}
49  /// Return the center of the OBB
50  UT_Vector3T<T> getCenter() const {return myCenter;}
51  /// Return the tranform matrix of the OBB
52  UT_Matrix4T<T> getTransform() const;
53  /// Return the non-oriented bounding box.
54  UT_BoundingBoxT<T> getBBox() const {return myBB;}
55  /// Return the minimum axis direction
57  {
58  int imin = SYSargmin(myRadii.x(), myRadii.y(), myRadii.z());
60  myBasis(0,imin),
61  myBasis(1,imin),
62  myBasis(2,imin)
63  );
64  return dir;
65  }
66 
67 protected:
73  bool init;
74 };
75 
79 typedef UT_OBBoxT<float> UT_OBBox; // deprecated
80 
81 #endif
UT_Matrix3T< T > myBasis
Definition: UT_OBBox.h:69
UT_Vector3T< T > getMinAxis() const
Return the minimum axis direction.
Definition: UT_OBBox.h:56
Axis-aligned bounding box (AABB).
Definition: GEO_Detail.h:43
UT_OBBoxT< float > UT_OBBox
Definition: UT_OBBox.h:79
Arbitrarily Oriented Bounding (OBB)
Definition: UT_OBBox.h:25
UT_Matrix3T< T > getBasis() const
Return the basis that defines the orientation of the OBB.
Definition: UT_OBBox.h:44
#define UT_API
Definition: UT_API.h:12
3D Vector class.
UT_OBBoxT< fpreal > UT_OBBoxR
Definition: UT_OBBox.h:76
UT_OBBoxT(const UT_Array< UT_Vector3T< T > > &points, int refinement=6)
Definition: UT_OBBox.h:29
UT_OBBoxT< fpreal64 > UT_OBBoxD
Definition: UT_OBBox.h:78
UT_Vector3T< T > getRadii() const
Return the half radii(side length) of the OBB.
Definition: UT_OBBox.h:46
UT_Vector3T< T > getRotation() const
Return the rotation i radians.
Definition: UT_OBBox.h:48
UT_BoundingBoxT< T > getBBox() const
Return the non-oriented bounding box.
Definition: UT_OBBox.h:54
GT_Basis myBasis
Definition: GT_CurveEval.h:262
UT_Vector3T< T > getCenter() const
Return the center of the OBB.
Definition: UT_OBBox.h:50
UT_OBBoxT< fpreal32 > UT_OBBoxF
Definition: UT_OBBox.h:77
bool init
Definition: UT_OBBox.h:73
UT_Vector3T< T > myRotation
Definition: UT_OBBox.h:71
UT_Vector3T< T > myRadii
Definition: UT_OBBox.h:72
UT_BoundingBoxT< T > myBB
Definition: UT_OBBox.h:68
UT_Vector3T< T > myCenter
Definition: UT_OBBox.h:70