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  virtual ~RBD_SpherePointTreeNode();
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  virtual ~RBD_SphereTree();
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  virtual const RBD_SphereTreeNode *getRoot() const;
75 
76 protected:
77  // Determines if we convert to polygons or use raw points.
82 
83  explicit RBD_SpherePointTree(const SIM_DataFactory *factory);
84  virtual ~RBD_SpherePointTree();
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  virtual void initializeSubclass();
90  virtual int64 getMemorySizeSubclass() const;
91  virtual bool getIsAlternateRepresentationSubclass() const;
92  virtual void initAlternateRepresentationSubclass(const SIM_Data &);
93 
94 private:
95  static const SIM_DopDescription *getSpherePointTreeDopDescription();
96 
97  // This builds the sphere tree from the given set of points.
98  void buildSpherePointTree(const UT_Vector3Array &pts);
99 
100  RBD_SpherePointTreeNode *myRoot;
101 
105  "Sphere Point Tree",
106  getSpherePointTreeDopDescription());
107 };
108 
109 #endif
DECLARE_STANDARD_GETCASTTOTYPE()
#define DECLARE_STANDARD_GETCASTTOTYPE()
Definition: SIM_DataUtils.h:45
#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:58
long long int64
Definition: SYS_Types.h:107
This is a node in the sphere tree.
#define RBD_NAME_POLYLOD
Definition: RBD_Utils.h:39
#define GETSET_DATA_FUNCS_V2(DataName, FuncName)
double fpreal
Definition: SYS_Types.h:270
#define RBD_NAME_TRIANGULATE
Definition: RBD_Utils.h:41
#define RBD_NAME_POLYCONVERT
Definition: RBD_Utils.h:38
virtual void initAlternateRepresentationSubclass(const SIM_Data &)
virtual void initializeSubclass()