HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RBD_SphereTree.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: RBD_SphereTree.h ( RBD Library, C++)
7  *
8  * COMMENTS:
9  * This builds a tree of spheres producing bounding
10  * information for a point cloud.
11  */
12 
13 #ifndef __RBD_SphereTree_H__
14 #define __RBD_SphereTree_H__
15 
16 #include "RBD_API.h"
17 #include <UT/UT_Vector2.h>
18 #include <UT/UT_Vector3Array.h>
19 
20 #include <SIM/SIM_DataUtils.h>
21 #include <SIM/SIM_OptionsUser.h>
22 
23 #include "RBD_Utils.h"
24 
25 /// This is the base class for nodes inside sphere trees.
27 {
28 public:
30  virtual ~RBD_SphereTreeNode();
31 
34 
35  RBD_SphereTreeNode *myChild[2];
36 };
37 
38 /// This is a node in the sphere tree.
40 {
41 public:
43 
44  ~RBD_SpherePointTreeNode() override;
45 
46  int64 getMemoryUsage() const;
47 
49 };
50 
51 /// This class provides a generic way of describing sphere trees
52 /// of points, edges, or higher order things.
54 {
55 public:
56  // Return the untyped root of the tree.
57  virtual const RBD_SphereTreeNode *getRoot() const = 0;
58 
59 protected:
60  explicit RBD_SphereTree(const SIM_DataFactory *factory);
61  ~RBD_SphereTree() override;
62 
65 };
66 
67 /// This class holds a point cloud of samples.
68 /// It has a bounding sphere hierarchy to allow quick rejection
69 /// when dealing with a SDF.
71 {
72 public:
73  /// Get the Tree.
74  const RBD_SphereTreeNode *getRoot() const override;
75 
76 protected:
77  // Determines if we convert to polygons or use raw points.
82 
83  explicit RBD_SpherePointTree(const SIM_DataFactory *factory);
84  ~RBD_SpherePointTree() override;
85 
86  /// Overrides to properly implement this class as a SIM_Data.
87  /// This object is meant to be updated from the object's geometry at
88  /// each frame, so we only implement skeleton save, and load methods.
89  void initializeSubclass() override;
90  int64 getMemorySizeSubclass() const override;
91  bool getIsAlternateRepresentationSubclass() const override;
93  const SIM_Data &) override;
94 
95 private:
96  static const SIM_DopDescription *getSpherePointTreeDopDescription();
97 
98  // This builds the sphere tree from the given set of points.
99  void buildSpherePointTree(const UT_Vector3Array &pts);
100 
102 
106  "Sphere Point Tree",
107  getSpherePointTreeDopDescription());
108 };
109 
110 #endif
DECLARE_STANDARD_GETCASTTOTYPE()
#define DECLARE_STANDARD_GETCASTTOTYPE()
Definition: SIM_DataUtils.h:50
#define DECLARE_CLASSNAME(DataClass, SuperClass)
Definition: SIM_DataUtils.h:20
#define GETSET_DATA_FUNCS_B(DataName, FuncName)
virtual bool getIsAlternateRepresentationSubclass() const
UT_Vector3Array myPoints
virtual int64 getMemorySizeSubclass() const
#define RBD_API
Definition: RBD_API.h:10
This is the base class for nodes inside sphere trees.
#define RBD_NAME_ADDBARYCENTER
Definition: RBD_Utils.h:40
virtual const RBD_SphereTreeNode * getRoot() const =0
#define DECLARE_DATAFACTORY(DataClass, SuperClass, Description, DopParms)
Definition: SIM_DataUtils.h:63
long long int64
Definition: SYS_Types.h:116
This is a node in the sphere tree.
#define RBD_NAME_POLYLOD
Definition: RBD_Utils.h:39
#define GETSET_DATA_FUNCS_V2(DataName, FuncName)
#define RBD_NAME_TRIANGULATE
Definition: RBD_Utils.h:41
#define RBD_NAME_POLYCONVERT
Definition: RBD_Utils.h:38
fpreal64 fpreal
Definition: SYS_Types.h:277
virtual void initAlternateRepresentationSubclass(const SIM_Data &)
myRoot
Definition: UT_RTreeImpl.h:716
virtual void initializeSubclass()