00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __GU_PrimNURBSurf_h__
00022 #define __GU_PrimNURBSurf_h__
00023
00024 #include "GU_API.h"
00025 #include <GEO/GEO_PrimNURBSurf.h>
00026 #include <GEO/GEO_PrimRBezSurf.h>
00027 #include <GEO/GEO_Parameterization.h>
00028 #include <GB/GB_NUBBasis.h>
00029 #include <UT/UT_IntArray.h>
00030 #include "GU_TPSurf.h"
00031
00032 class GB_EdgeGroup;
00033 class GU_Detail;
00034 class GU_PrimRBezSurf;
00035 class UT_FloatArray;
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049 class GU_API GU_PrimNURBSurf : public GEO_PrimNURBSurf, public GU_TPSurf
00050 {
00051 public:
00052
00053
00054 GU_PrimNURBSurf(GU_Detail *gdp);
00055
00056 virtual ~GU_PrimNURBSurf();
00057
00058
00059
00060 virtual void *castTo (void) const;
00061 virtual const GEO_Primitive *castToGeo(void) const;
00062
00063
00064 GU_PrimRBezSurf *convertToBezNew(GB_PointGroup *delpoints=0,
00065 GB_PrimitiveGroup *delprim=0);
00066
00067 GEO_Primitive *convertNew(GU_ConvertParms &parms);
00068
00069
00070
00071
00072 virtual GEO_Hull *reconfigure(unsigned type, int orderu, int orderv,
00073 int openu, int openv,
00074 int endsu, int endsv) const;
00075
00076
00077
00078 virtual void changedVertices(void);
00079
00080
00081
00082
00083
00084
00085
00086 virtual GU_TPSurf *cutU(float u1, float u2,
00087 int &ind1, int &ind2, int keep);
00088
00089 virtual GU_TPSurf *cutV(float v1, float v2,
00090 int &ind1, int &ind2, int keep);
00091
00092
00093
00094 virtual void openAtU(float u);
00095 virtual void openAtV(float v);
00096
00097
00098
00099 virtual GEO_Curve *buildRowCurve(int appendPoints = 1,
00100 GU_Detail *parent = 0) const;
00101 virtual GEO_Curve *buildColCurve(int appendPoints = 1,
00102 GU_Detail *parent = 0) const;
00103
00104
00105
00106
00107
00108
00109
00110 static GU_PrimNURBSurf *build( GU_Detail *gudp,
00111 int rows, int cols,
00112 int orderu = 4, int orderv = 4,
00113 int wrapu = 0, int wrapv = 0,
00114 int interpEndsU= 1, int interpEndsV= 1,
00115 GEO_SurfaceType type = GEO_PATCH_QUADS,
00116 int appendPoints = 1);
00117
00118
00119
00120
00121
00122 int removeEdges(const GB_EdgeGroup &edges,
00123 UT_BitArray *remove_edges=0);
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137 int removeKnot(int uDir, int knotIdx, int mult=0,
00138 float tol=1e-4F,
00139 GB_PointGroup *deleteGroup=0,
00140 int uniqueInteriorCvs=0);
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153 void reduceKnots(const UT_Vector &uParm,
00154 const UT_Vector &vParm,
00155 UT_Matrix &error, float tol=1e-1F,
00156 int uNum=0, int vNum=0,
00157 GB_PointGroup *deleteGroup=0);
00158
00159
00160 virtual int evaluateBreakpoint(int uidx, int vidx,
00161 UT_Vector4 &pos,
00162 int du=0, int dv=0) const;
00163
00164
00165
00166
00167
00168
00169
00170 int interpGlobal(const UT_PtrMatrix<GEO_Point *> &gpMesh,
00171 int uOrder=4, int vOrder=4,
00172 int uWrapped=0, int vWrapped=0,
00173 GEO_SurfaceType type=GEO_PATCH_QUADS,
00174 GB_ParmType uParmType=GB_PARM_CHORD,
00175 GB_ParmType vParmType=GB_PARM_CHORD,
00176 GB_KnotSpaceType uKnotSpaceType=GB_KNOT_AVERAGING,
00177 GB_KnotSpaceType vKnotSpaceType=GB_KNOT_AVERAGING,
00178 const UT_Vector *uParmValues = 0,
00179 const UT_Vector *vParmValues = 0);
00180
00181
00182
00183 int interpBreakpoints(
00184 const UT_PtrMatrix<GEO_Point *> &gpMesh,
00185 int uOrder=4, int vOrder=4,
00186 int uWrapped=0, int vWrapped=0,
00187 GEO_SurfaceType type=GEO_PATCH_QUADS,
00188 GB_ParmType uParmType=GB_PARM_CHORD,
00189 GB_ParmType vParmType=GB_PARM_CHORD,
00190 GB_KnotSpaceType uKnotSpaceType=GB_KNOT_AVERAGING,
00191 GB_KnotSpaceType vKnotSpaceType=GB_KNOT_AVERAGING,
00192 const UT_Vector *uParmValues = 0,
00193 const UT_Vector *vParmValues = 0);
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203 void approxGlobal(const UT_PtrMatrix<GEO_Point *> &gpMesh,
00204 int uOrder, int vOrder,
00205 int uWrapped, int vWrapped,
00206 GEO_SurfaceType type,
00207 float tol, float smooth=0.0F,
00208 int uNoMultipleKnots=1, int vNoMultipleKnots=1);
00209
00210
00211 protected:
00212 virtual GEO_Hull *getSubHull(int top, int left, int bottom, int right,
00213 GEO_SubHullFlags break_flags);
00214
00215 private:
00216
00217
00218 virtual int translateBkptsFixed(const UT_IntArray &uindices,
00219 const UT_IntArray &vindices,
00220 const UT_Vector3 &delta,
00221 GB_PointGroup *ptgroup=NULL,
00222 GEO_Delta *geodelta = 0);
00223 virtual int transformBkptsFixed(const UT_IntArray &uindices,
00224 const UT_IntArray &vindices,
00225 const UT_Matrix4 &matx,
00226 GB_PointGroup *ptgroup=NULL,
00227 GEO_Delta *geodelta = 0);
00228
00229
00230
00231 void fit(const UT_PtrMatrix<GEO_Point *> &gpMesh,
00232 UT_Vector *data[3], UT_Vector *vData,
00233 int prevUEnd, int cvUEnd,
00234 int prevVEnd, int cvVEnd,
00235 UT_Vector &uSol, UT_Vector &vSol,
00236 UT_Vector &uParm, UT_Vector &vParm,
00237 UT_Matrix &error, float smooth);
00238
00239 void makeSafeDegreeEvaluateNoMult(int uDir, int m, int n,
00240 const UT_Vector &uParm, const UT_Vector &vParm,
00241 UT_Matrix &error, float tol,
00242 GB_PointGroup *deleteGroup,
00243 int &cvUEnd, int &cvVEnd);
00244
00245 void makeSafeDegreeEvaluateWMult(int uDir, int m, int n,
00246 const UT_Vector &uParm, const UT_Vector &vParm,
00247 UT_Matrix &error, float tol,
00248 GB_PointGroup *deleteGroup,
00249 int &cvUEnd, int &cvVEnd, int &breakCount);
00250
00251 void degreeEvaluateNoMult(GB_NUBBasis *basis,
00252 UT_FloatArray &knots,
00253 UT_FloatArray &tmpKnots);
00254
00255 void degreeEvaluateWMult(GB_NUBBasis *basis,
00256 UT_FloatArray &knots,
00257 UT_FloatArray &tmpKnots,
00258 int breakCount);
00259
00260
00261
00262 int create(int rows, int cols, int orderu=4, int orderv=4,
00263 int wrapu = 0, int wrapv = 0,
00264 int interpEndsU = 1, int interpEndsV = 1,
00265 GEO_SurfaceType type = GEO_PATCH_QUADS,
00266 int appendPoints = 1);
00267 };
00268
00269 #endif