HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GU_NSidedSubdivPatch.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: GU_NSidedSubdivPatch.h (GU Library, C++)
7  *
8  * COMMENTS: This class is based off the subdivision scheme detailed in the
9  * following paper:
10  * Filling an N-sided hole using subdivision schemes
11  * Adi Levin
12  * adilev@math.tau.ac.il, http://www.math.tau.ac.il/~adilev
13  * Tel Aviv university
14  * June 3, 1999
15  * http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.16.4131&rep=rep1&type=pdf
16  *
17  * Note that this is different from GU_SubDivPatch, this takes some extra work
18  * to ensure that the sides of the hole are smooth with the surface surrounding
19  * the hole. An example of it's use can be seen in GU_PolyBevel.C in
20  * BlendPositioner::positionPointsCubicSubdiv().
21  */
22 
23 
24 #ifndef __GU_GU_NSidedSubdivPatch_h__
25 #define __GU_GU_NSidedSubdivPatch_h__
26 
27 #include "GU_API.h"
28 
29 #include <UT/UT_Vector.h>
30 
32 {
33 public:
34  GU_NSidedSubdivPatch(int sides, bool cubic = false) :
35  mySides(sides), myCubic(cubic), myDivs(1)
36  {
37  setupMesh();
38  }
39 
41  mySides(src->sides()), myCubic(src->myCubic), myDivs(2 * src->divs())
42  {
43  setupMesh();
44  }
45 
46  int divs() const { return myDivs; }
47  int sides() const { return mySides; }
48 
49  const UT_Vector3 &pt(int m, int i, int j) const
50  { return myPoints(pointIndex(m, i, j)); }
51 
52  UT_Vector3 &pt(int m, int i, int j)
53  { return myPoints(pointIndex(m, i, j)); }
54 
55  UT_Vector3 interpolate(int m, fpreal u, fpreal v);
56 
57  void subdivide(const GU_NSidedSubdivPatch *src);
58 
59  int pointIndex(int m, int i, int j) const;
60 
61 private:
62 
63  void setupMesh();
64 
65 
66  void subdivideQuadratic(const GU_NSidedSubdivPatch *src);
67  void subdivideCubic(const GU_NSidedSubdivPatch *src);
68 
69  int mySides;
70  int myDivs;
71  int myMeshSize;
72 
73  fpreal myMeshUnit;
74 
75  bool myCubic;
76  UT_Vector3Array myPoints;
77 };
78 
79 #endif
const GLdouble * v
Definition: glcorearb.h:836
GU_NSidedSubdivPatch(const GU_NSidedSubdivPatch *src)
UT_Vector3 & pt(int m, int i, int j)
png_uint_32 i
Definition: png.h:2877
int divs(int x, int y)
Definition: ImathFun.h:180
#define GU_API
Definition: GU_API.h:12
double fpreal
Definition: SYS_Types.h:270
const UT_Vector3 & pt(int m, int i, int j) const
GU_NSidedSubdivPatch(int sides, bool cubic=false)
GLenum src
Definition: glcorearb.h:1792