HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
UT_BoundingSphere.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_BoundingSphere.h ( Utility Library, C++)
7  *
8  * COMMENTS:
9  * This class implements a bounding sphere (with unity scale).
10  * It's not very precise. It's mainly meant for a one time
11  * calculation of a bounding sphere. If you try combining bounding
12  * spheres, you get rather gross results compared to your initial
13  * points.
14  */
15 
16 #ifndef __UT_BoundingSphere__
17 #define __UT_BoundingSphere__
18 
19 #include "UT_API.h"
20 #include "UT_Vector3.h"
21 #include "UT_Vector4.h"
22 #include "UT_Vector3Array.h"
23 #include "UT_BoundingBox.h"
24 
25 
27 {
28 public:
31 
32  bool isInside(const UT_Vector3R &pt) const;
33 
34  fpreal getRadius() const { return myRadius; }
35  const UT_Vector3R &getCenter() const { return myCenter; }
36 
37  void initialize(bool requires_update = false);
38  void computeBound();
39  fpreal computeRadius(const UT_Vector3R &center) const;
40 
41  void addPoint(const UT_Vector3R &pt);
42  void addBox(const UT_BoundingBox &box);
43  void addSphere(const UT_BoundingSphere &bsphere);
44 
45  void transform(const UT_Matrix4R &xform);
46 
47 private:
48  // NOTE: Currently, the default copy constructor and assignment operators
49  // are sufficient.
50  UT_Vector3R myCenter;
51  fpreal myRadius;
52  fpreal myRadiusSquared;
53  UT_Vector3R myMins[3];
54  UT_Vector3R myMaxs[3];
55  bool myDoDynamic;
56  UT_Vector3RArray myPointArray;
57 };
58 #endif
59 
const UT_Vector3R & getCenter() const
#define UT_API
Definition: UT_API.h:12
fpreal getRadius() const
OPENVDB_API void initialize()
Global registration of basic types.
Definition: logging.h:316
GA_API const UT_StringHolder transform
double fpreal
Definition: SYS_Types.h:269