HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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:
30 
31  bool isInside(const UT_Vector3R &pt) const;
32 
33  fpreal getRadius() const { return myRadius; }
34  const UT_Vector3R &getCenter() const { return myCenter; }
35 
36  void initialize(bool requires_update = false);
37  void computeBound();
38  fpreal computeRadius(const UT_Vector3R &center) const;
39 
40  void addPoint(const UT_Vector3R &pt);
41  void addBox(const UT_BoundingBox &box);
42  void addSphere(const UT_BoundingSphere &bsphere);
43 
44  void transform(const UT_Matrix4R &xform);
45 
46 private:
47  UT_Vector3R myCenter;
48  fpreal myRadius;
49  fpreal myRadiusSquared;
50  UT_Vector3R myMins[3];
51  UT_Vector3R myMaxs[3];
52  bool myDoDynamic;
53  UT_Vector3RArray myPointArray;
54 };
55 #endif
56 
const UT_Vector3R & getCenter() const
#define UT_API
Definition: UT_API.h:14
fpreal getRadius() const
OPENVDB_API void initialize()
Global registration of native Grid, Transform, Metadata and Point attribute types. Also initializes blosc (if enabled).
Definition: logging.h:294
GA_API const UT_StringHolder transform
fpreal64 fpreal
Definition: SYS_Types.h:277