HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GU_WindingNumber.h
Go to the documentation of this file.
1 #ifndef __GU_WindingNumber_h__
2 #define __GU_WindingNumber_h__
3 
4 #include "GU_API.h"
5 
6 #include <GEO/GEO_Detail.h>
8 #include <UT/UT_SolidAngle.h>
9 
10 
12 {
13 public:
14  /// Initializes WindingNumber3DExact class
15  ///
16  /// NOTE: The class keeps non-owning pointer `mesh_geo` to the geometry.
17  /// The pointer has to stay valid as long as you want to call `eval`
18  void init(const GEO_Detail *const mesh_geo,
19  const GA_PrimitiveGroup *const mesh_prim_group);
20 
21  void clear();
22 
23  double eval(const UT_Vector3 &query_point,
24  const bool as_solid_angle = false,
25  const bool negate = false) const;
26 
27  void eval(const GEO_Detail *const query_points,
28  const GA_SplittableRange &point_range,
29  const GA_RWHandleF &winding_number_attrib,
30  const bool as_solid_angle = false,
31  const bool negate = false) const;
32 
33 private:
34  const GEO_Detail * myMeshGeo = nullptr;
35  GA_OffsetList myPrimoffs{};
36 };
37 
39 {
40 public:
41  void init(const GA_Detail &mesh_geo,
42  const GA_PrimitiveGroup *const mesh_prim_group,
43  const int approx_order);
44 
45  void clear();
46 
47  bool isClear() const { return mySolidAngleTree.isClear(); }
48 
49 
50  double eval(const UT_Vector3 &query_point,
51  const double accuracy_scale,
52  const bool as_solid_angle = false,
53  const bool negate = false) const;
54 
55  void eval(const GEO_Detail *const query_points,
56  const GA_SplittableRange &point_range,
57  const GA_RWHandleF &winding_number_attrib,
58  const double accuracy_scale,
59  const bool as_solid_angle = false,
60  const bool negate = false) const;
61 
62 private:
63  UT_SolidAngle<float,float> mySolidAngleTree{};
64  UT_Array<int> myTrianglePoints{};
65  UT_Array<UT_Vector3> myPositions3D{};
66 };
67 
68 
70 {
71 public:
72  /// Initializes WindingNumber2DExact class
73  ///
74  /// NOTE: The class keeps non-owning pointer `mesh_geo` to the geometry.
75  /// The pointer has to stay valid as long as you want to call `eval`
76  void init(const GEO_Detail *const mesh_geo,
77  const GA_PrimitiveGroup *const mesh_prim_group,
78  const int axis0, const int axis1);
79 
80  void clear();
81 
82  double eval(const UT_Vector2 &query_point,
83  const bool as_angle = false,
84  const bool negate = false) const;
85 
86  void eval(const GEO_Detail *const query_points,
87  const GA_SplittableRange &point_range,
88  const GA_RWHandleF &winding_number_attrib,
89  const bool as_angle = false,
90  const bool negate = false) const;
91 
92 private:
93  const GEO_Detail * myMeshGeo = nullptr;
94  GA_OffsetList myPrimoffs{};
95  int myAxis0, myAxis1;
96 };
97 
98 
100 {
101 public:
102  void init(const GA_Detail &mesh_geo,
103  const GA_PrimitiveGroup *const prim_group,
104  const int approx_order,
105  const int axis0, const int axis1);
106 
107  void clear();
108 
109  bool isClear() const { return mySubtendedAngleTree.isClear(); }
110 
111  double eval(const UT_Vector2 &query_point,
112  const double accuracy_scale,
113  const bool as_angle = false,
114  const bool negate = false) const;
115 
116  void eval(const GEO_Detail *const query_points,
117  const GA_SplittableRange &point_range,
118  const GA_RWHandleF &winding_number_attrib,
119  const double accuracy_scale,
120  const bool as_angle = false,
121  const bool negate = false) const;
122 
123 private:
124  UT_SubtendedAngle<float,float> mySubtendedAngleTree{};
125  UT_Array<int> mySegmentPoints{};
126  UT_Array<UT_Vector2> myPositions2D{};
127  int myAxis0, myAxis1;
128 };
129 
130 #endif
HUSD_API bool eval(VtValue &val, T &ret_val)
#define GU_API
Definition: GU_API.h:14
Container class for all geometry.
Definition: GA_Detail.h:96