HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GT_TrimNuCurves.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: GT_TrimNuCurves.h ( GT Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __GT_TrimNuCurves__
12 #define __GT_TrimNuCurves__
13 
14 #include "GT_API.h"
15 #include "GT_CountArray.h"
16 #include "GT_DataArray.h"
17 #include "GT_Handles.h"
18 
19 class UT_JSONWriter;
20 
21 /// @brief Trim loops specified by a number of individual NURBS curves
23 {
24 public:
25  /// Default constructor
27  /// Copy constructor
29  /// The @c loop_counts array is a list of the number of curves per loop.
30  /// For example, a trim loop may be made of multiple curves.
31  ///
32  /// The @c curve_counts array is a list of the number of vertices in each
33  /// curve. The array should be sum(curve_counts) entries long (one entry
34  /// for each individual curve).
35  ///
36  /// The @c curve_orders array is a list of the order of the NURBS curves
37  /// for each curve. The array should be sum(curve_counts) entries long
38  /// (one entry for each individual curve).
39  ///
40  /// The @c knots array is a single array storing the knots of the curves
41  /// concatenated together. The array should be <tt>sum(curve_orders) +
42  /// sum(vertex_counts)</tt> entries long.
43  ///
44  /// The @c min and @c max arrays represent the basis extents for each
45  /// curve. The arrays should be sum(curve_counts) entries long (one for
46  /// each individual curve).
47  ///
48  /// The @c uv array is the list of point positions, either 2D
49  /// (non-rational) or 3D (rational). There should be @c sum(vertex_counts)
50  /// uv positions.
51  GT_TrimNuCurves(const GT_DataArrayHandle &loop_counts,
52  const GT_DataArrayHandle &curve_counts,
53  const GT_DataArrayHandle &curve_orders,
54  const GT_DataArrayHandle &knots,
55  const GT_DataArrayHandle &min,
56  const GT_DataArrayHandle &max,
57  const GT_DataArrayHandle &uv);
58  ~GT_TrimNuCurves();
59 
60  bool isValid() const { return myCurves.entries(); }
61 
62  /// Return the total number of segments
63  GT_Size getCurveCount() const { return myCurves.entries(); }
64  GT_Size getCurveCount(int loop) const
65  { return myLoops.getCount(loop); }
66  GT_Size getCurveOffset(int loop) const
67  { return myLoops.getOffset(loop); }
68 
69  /// Return the number of cv's
70  GT_Size getVertexCount() const { return myUV->entries(); }
71 
72  /// Return the number of vertices for the Nth curve
74  { return myCurves.getCount(curve); }
75  /// Get the order for the given curve
76  int getOrder(GT_Offset curve) const
77  { return myOrders->getI32(curve); }
78 
79  /// @{
80  /// Accessors
81  const GT_CountArray &getLoopCountArray() const { return myLoops; }
82  const GT_CountArray &getCurveCountArray() const { return myCurves; }
83  const GT_DataArrayHandle &getOrders() const { return myOrders; }
84  const GT_DataArrayHandle &getKnots() const { return myKnots; }
85  const GT_DataArrayHandle &getMin() const { return myMin; }
86  const GT_DataArrayHandle &getMax() const { return myMax; }
87  const GT_DataArrayHandle &getUV() const { return myUV; }
88  /// @}
89 
90  /// Save the primitive to a JSON stream. The default method does nothing
91  /// and returns false.
92  bool save(UT_JSONWriter &w) const;
93  void dump() const;
94 
95  /// Harden all arrays
96  void harden();
97 
98 private:
99  void validate();
100  void makeInvalid();
101 
102  GT_CountArray myLoops;
103  GT_CountArray myCurves;
104  GT_DataArrayHandle myOrders;
105  GT_DataArrayHandle myKnots;
106  GT_DataArrayHandle myMin;
107  GT_DataArrayHandle myMax;
108  GT_DataArrayHandle myUV;
109 };
110 
111 #endif
GT_Size getVertexCount(GT_Offset curve) const
Return the number of vertices for the Nth curve.
GT_Size getCurveCount(int loop) const
int getOrder(GT_Offset curve) const
Get the order for the given curve.
GA_API const UT_StringHolder uv
GT_Size getCurveOffset(int loop) const
#define GT_API
Definition: GT_API.h:11
const GT_DataArrayHandle & getMin() const
Class which writes ASCII or binary JSON streams.
Definition: UT_JSONWriter.h:32
GT_Size getVertexCount() const
Return the number of cv's.
const GT_CountArray & getCurveCountArray() const
const GT_DataArrayHandle & getMax() const
GT_Size getCurveCount() const
Return the total number of segments.
const GT_CountArray & getLoopCountArray() const
const std::enable_if<!VecTraits< T >::IsVec, T >::type & max(const T &a, const T &b)
Definition: Composite.h:133
const GT_DataArrayHandle & getKnots() const
const GT_DataArrayHandle & getUV() const
const GT_DataArrayHandle & getOrders() const
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:856
int64 GT_Offset
Definition: GT_Types.h:113
int64 GT_Size
Definition: GT_Types.h:112
Trim loops specified by a number of individual NURBS curves.
const std::enable_if<!VecTraits< T >::IsVec, T >::type & min(const T &a, const T &b)
Definition: Composite.h:129
bool isValid() const
GLenum src
Definition: glcorearb.h:1792