HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GA_ForwardDifference.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: GA_ForwardDifference.h ( GA Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __GA_ForwardDifference__
12 #define __GA_ForwardDifference__
13 
14 #include "GA_API.h"
15 #include "GA_Defines.h"
17 #include "GA_GenericHandle.h"
18 #include "GA_Types.h"
19 
20 #include <SYS/SYS_Types.h>
21 
22 
23 class GA_AttributeRefMap;
24 
25 
26 /// @brief Polynomial forward differencer
27 ///
28 /// This class performs forward differencing of polynomial functions by forward
29 /// differencing. To use this class, you need to specify
30 /// - The order of the polynomial
31 /// - The N derivatives of the polynomial (one for each degree)
32 /// The forward differencer can then evaluate the polynomial very efficiently.
33 template <typename T>
35 {
36 public:
37  /// Perform forward differencing
40  int uord, fpreal uinc, int vord=1, fpreal vinc=1);
42 
43  /// Initialize the forward differencer with
44  /// @param uord Order of the spline in U
45  /// @param uinc Stepping increment for integration in U
46  /// @param vord Order of the spline in V. For 1D curves, this is ignored.
47  /// @param vinc Stepping increment for integration in V
49  int uord, fpreal uinc, int vord=1, fpreal vinc=1);
50 
51  ///@{
52  /// Return the initialized U order
53  int getUOrder() const { return myMatrix.getUOrder(); }
54  /// Return the initialized U integration step size
55  fpreal getUStep() const { return myMatrix.getUStep(); }
56 
57  /// Return the initialized V order
58  int getVOrder() const { return myMatrix.getVOrder(); }
59  /// Return the initialized V integration step size
60  fpreal getVStep() const { return myMatrix.getVStep(); }
61 
62  /// Return the offset for the derivative
63  T &getDerivative(int u, int v=0) { return myDeriv[u][v]; }
64  ///@}
65 
66  /// 1D forward difference a hull into a curve
67  /// @param gah is the set of attributes to evaluate.
68  /// @param ucount is the number of vertices to fill
69  /// @param uoff Offset into the results. That is, the results will be
70  /// stored in @code results[uoff]-results[uoff+ucount-1] @endcode
71  /// @param deriv Nth Derivatives. When the hull and the results
72  /// exist in different details, the derivatives are represented by
73  /// the RHS in the gah (source mapping).
74  /// @param results List of vertex offsets where the result should be
75  /// stored. When the hull and results are in different details,
76  /// the results are the LHS of the gah (destination mapping).
77  void walk(const GA_ROGenericHandleVertex<T> &gah,
78  int ucount, int uoff,
79  T *results);
80 
81  /// 2D forward difference a hull into a mesh
82  /// @param gah is the set of attributes to evaluate.
83  /// @param ucount is the number of vertices to fill in U (columns)
84  /// @param vcount is the number of vertices to fill in V (rows)
85  /// @param uoff Offset into the results (stride).
86  /// @param voff Offset into the results (stride).
87  /// @param ncols Number of columns in the full matrix of result vertices.
88  /// This is used to stride into the offsets/rows.
89  /// @param deriv Nth Derivatives. When the hull and the results
90  /// exist in different details, the derivatives are represented by
91  /// the RHS in the gah (source mapping).
92  /// @param results List of vertex offsets where the result should be
93  /// stored. When the hull and results are in different details,
94  /// the results are the LHS of the gah (destination mapping).
95  void walk(const GA_ROGenericHandleVertex<T> &gah,
96  int ucount, int vcount,
97  int uoff, int voff, int ncols,
98  T *results);
99 
100 private:
103  T myDeriv[GA_MAXORDER][GA_MAXORDER];
104 };
105 
106 #endif
107 
fpreal getVStep() const
Return the initialized V integration step size.
const GLdouble * v
Definition: glcorearb.h:836
T & getDerivative(int u, int v=0)
Return the offset for the derivative.
#define GA_MAXORDER
Definition: GA_Defines.h:17
#define GA_API
Definition: GA_API.h:12
Polynomial forward differencer.
Helper class for a polynomial forward differencer.
A handle to simplify manipulation of multiple attributes.
OPENVDB_API void initialize()
Global registration of basic types.
Definition: logging.h:316
fpreal getUStep() const
Return the initialized U integration step size.
double fpreal
Definition: SYS_Types.h:269
int getVOrder() const
Return the initialized V order.
Specialization of GA_GenericTemp for GA_ATTRIB_POINT types.
Specialization of GA_ROGenericHandle for GA_ATTRIB_VERTEX offsets.