HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SIM_TriangulatedGeometry.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  */
7 
8 #ifndef __SIM_TriangulatedGeometry_H__
9 #define __SIM_TriangulatedGeometry_H__
10 
11 #include "SIM_API.h"
12 #include "SIM_Data.h"
13 #include "SIM_DataUtils.h"
14 
15 #include <UT/UT_FloatArray.h>
16 #include <UT/UT_IntArray.h>
17 #include <UT/UT_Vector4Array.h>
18 
19 /// This class holds a polyized geometry for which people can query.
20 /// This is an alternative representation.
21 /// This caches the point positions in the SIM_Geometry's space,
22 /// so are independent of SIM_Geometry's transform.
24 {
25 public:
26  /// initializes alternate geometry for lite functions
27  void init() const;
28 
29  /// Gets the position of a point in SIM_Geometry space, given point ID
30  UT_Vector3 getPointPos(int ptId) const;
31  /// Gets the position of a point in SIM_Geometry space,
32  ///given primitive ID and vertex number
33  UT_Vector3 getPointPos(int primId, int vtNum) const;
34  /// Returns the total number of points
35  int getPointCount() const;
36  /// Gets the corresponding point id given a vertex number and a
37  /// primitive id
38  int getPointId(int primId, int vtNum) const;
39  /// Gets the number of primitives
40  int getPrimitiveCount() const;
41  /// Gets the number of vertices of a given primitive
42  int getVertexCount(int primNum = 0) const;
43  /// Returns the baryCenter of a given primitive
44  /// Gets the point density, given point ID
45  float getPointDensity(int ptId) const;
46  /// Gets the point density, given primitive ID and vertex number
47  float getPointDensity(int primId, int vtNum) const;
48 
49  /// Returns the barycenter of the triangle.
50  /// It is estimated from point density (if any)
51  UT_Vector3 getBaryCenter(int primNum) const;
52 
53 protected:
54  explicit SIM_TriangulatedGeometry(const SIM_DataFactory *factory);
55  ~SIM_TriangulatedGeometry() override;
56 
57  /// Overrides to properly implement this class as a SIM_Data.
58  /// This object is meant to be updated from the object's geometry at
59  /// each frame, so we only implement skeleton save, and load methods.
60  bool getIsAlternateRepresentationSubclass() const override;
61  int64 getMemorySizeSubclass() const override;
63  const SIM_Data &) override;
64 
65 private:
66  UT_Vector3Array myPointPos;
67  UT_IntArray myPointNum;
68  UT_FloatArray myDensity;
69 
71 
73  SIM_Data,
74  "TriangulatedGeometry",
76 };
77 
78 #endif
#define DECLARE_STANDARD_GETCASTTOTYPE()
Definition: SIM_DataUtils.h:50
virtual bool getIsAlternateRepresentationSubclass() const
virtual int64 getMemorySizeSubclass() const
#define DECLARE_DATAFACTORY(DataClass, SuperClass, Description, DopParms)
Definition: SIM_DataUtils.h:63
long long int64
Definition: SYS_Types.h:116
#define SIM_API
Definition: SIM_API.h:12
virtual void initAlternateRepresentationSubclass(const SIM_Data &)
static const SIM_DopDescription * getEmptyDopDescription()
A DOP description that says not to create an automatic DOP.