00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __GU_PrimNURBCurve_h__
00022 #define __GU_PrimNURBCurve_h__
00023
00024 #include "GU_API.h"
00025 #include <GB/GB_NUBBasis.h>
00026 #include <GEO/GEO_PrimNURBCurve.h>
00027 #include <GEO/GEO_Parameterization.h>
00028 #include "GU_Curve.h"
00029
00030 class GU_Detail;
00031 class GU_PrimPoly;
00032 class GU_PrimRBezCurve;
00033 class UT_Vector4Array;
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046 class GU_API GU_PrimNURBCurve : public GEO_PrimNURBCurve, public GU_Curve
00047 {
00048 public:
00049
00050
00051 GU_PrimNURBCurve(GU_Detail *gdp) : GEO_PrimNURBCurve((GEO_Detail *)gdp),
00052 GU_Curve()
00053 {
00054 setCurve(this);
00055 }
00056
00057 #if 0
00058
00059
00060 GU_PrimNURBCurve(GU_Detail *gdp, int nelems, int order = 4,
00061 int closed = 0, int interpEnds = 1, int appendPoints = 1);
00062 #endif
00063 ~GU_PrimNURBCurve();
00064
00065 GU_PrimPoly *makeGrevillePoly(GU_Detail *dest = 0);
00066
00067 virtual int intersectRay(const UT_Vector3 &o, const UT_Vector3 &d,
00068 float tmax = 1E17F, float tol = 1E-12F,
00069 float *distance = 0, UT_Vector3 *pos = 0,
00070 UT_Vector3 *nml = 0, int accurate = 0,
00071 float *u = 0, float *v = 0,
00072 int ignoretrim = 1) const;
00073
00074
00075 virtual void *castTo() const;
00076 virtual const GEO_Primitive *castToGeo(void) const;
00077
00078
00079
00080
00081
00082
00083
00084 static GU_PrimNURBCurve *build(GU_Detail *gudp, int nelems,
00085 int order = 4, int closed = 0,
00086 int interpEnds = 1, int appendPoints= 1);
00087
00088 GEO_Primitive *convertNew(GU_ConvertParms &parms);
00089 GU_PrimRBezCurve *convertToBezNew(GB_PointGroup *delpts=0,
00090 GB_PrimitiveGroup *delprims=0);
00091
00092
00093
00094
00095
00096
00097
00098 virtual GU_Curve *cut(float u1, float u2,
00099 int &ind1, int &ind2, int keep);
00100
00101
00102 virtual void openAt(float u);
00103
00104 virtual void rotateTo(float u);
00105
00106
00107
00108
00109 virtual GEO_Face *reconfigure(unsigned type, int order, int open,
00110 int interpends, int nonrational) const;
00111
00112
00113
00114
00115
00116
00117 virtual int matchKnots(const UT_Vector &source,
00118 const UT_Vector &dest, float tol = 1e-2F);
00119
00120
00121 virtual int evaluateBreakpoint(int uidx, UT_Vector4 &pos,
00122 int du=0) const;
00123
00124
00125
00126
00127
00128
00129
00130 int removeEdges(const UT_BitArray &edgemap,
00131 UT_IntArray &removededges);
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145 int removeKnot(int knotIdx, int num, int mult=0,
00146 float tol=1e-4F,GB_PointGroup *delGroup=0,
00147 int uniqueInteriorCvs=0);
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158 void reduceKnots(const UT_Vector &parm, UT_Vector &error,
00159 float tol=1e-1F, int num=0,
00160 GB_PointGroup *deleteGroup=0);
00161
00162
00163
00164
00165
00166 int interpGlobal(const UT_PtrArray<GEO_Point *> &gpData,
00167 int order=4, int wrapped=0,
00168 GB_ParmType parmType=GB_PARM_CHORD,
00169 GB_KnotSpaceType knotSpaceType=GB_KNOT_AVERAGING,
00170 const UT_Vector *parmValues = 0);
00171 int interpGlobal(const UT_Vector4Array &v4Data,
00172 int order=4, int wrapped=0,
00173 GB_ParmType parmType=GB_PARM_CHORD,
00174 GB_KnotSpaceType knotSpaceType=GB_KNOT_AVERAGING,
00175 const UT_Vector *parmValues = 0);
00176
00177 int interpGlobal(const UT_Matrix &pointData,
00178 const UT_Matrix &derivData, int order=4,
00179 int wrapped = 0,
00180 GB_ParmType parmType=GB_PARM_CHORD,
00181 GB_KnotSpaceType knotSpaceType=GB_KNOT_AVERAGING);
00182 int interpGlobal(const UT_Matrix &pointData,
00183 const UT_Matrix &derivData,
00184 const UT_Matrix &deriv2Data, int order=6,
00185 int wrapped = 0,
00186 GB_ParmType parmType=GB_PARM_CHORD,
00187 GB_KnotSpaceType knotSpaceType=GB_KNOT_AVERAGING);
00188
00189 void interpLocal(const UT_PtrArray<GEO_Point *> &gpData,
00190 int order=4, int wrapped=0, int corner=0);
00191 void interpLocal(const UT_Vector4Array &v4Data,
00192 int order=4, int wrapped=0, int corner=0);
00193
00194
00195 int interpBreakpoints(
00196 const UT_PtrArray<GEO_Point *> &gpData,
00197 int order=4, int wrapped=0,
00198 GB_ParmType parmType=GB_PARM_CHORD,
00199 const UT_Vector *parmValues = 0);
00200 int interpBreakpoints(
00201 const UT_Vector4Array &v4Data,
00202 int order=4, int wrapped=0,
00203 GB_ParmType parmType=GB_PARM_CHORD,
00204 const UT_Vector *parmValues = 0);
00205
00206
00207
00208
00209
00210 void approxGlobal(const UT_Vector4Array &v4Data,
00211 int order=4, int wrapped=0,
00212 float tol=1e-1f, float smooth=0.0F,
00213 int noMultipleKnots=1);
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223 static int interpGlobal(const UT_Matrix &dataPts,
00224 const UT_Vector ¶m,
00225 const GB_NUBBasis &basis,
00226 UT_Matrix &cvs, int natural_end = 0);
00227
00228
00229
00230
00231 static int interpGlobal(const UT_Matrix &dataPts,
00232 const UT_Vector ¶m,
00233 const GB_NUBBasis &basis,
00234 UT_Matrix &cvs,
00235 const UT_IntArray &dervs);
00236
00237
00238 static int interpGlobal(const UT_Matrix &dataPts,
00239 const UT_Matrix &dataTans,
00240 const UT_Vector ¶m,
00241 const GB_NUBBasis &basis,
00242 UT_Matrix &cvs);
00243
00244
00245 static int interpGlobal(const UT_Matrix &dataPts,
00246 const UT_Matrix &dataTans,
00247 const UT_Matrix &dataCurvature,
00248 const UT_Vector ¶m,
00249 const GB_NUBBasis &basis,
00250 UT_Matrix &cvs);
00251
00252
00253 private:
00254
00255
00256 virtual int translateBkptsFixed(const UT_IntArray &uindices,
00257 const UT_Vector3 &delta,
00258 GB_PointGroup *ptgroup = NULL,
00259 GEO_Delta *geodelta = 0);
00260 virtual int transformBkptsFixed(const UT_IntArray &uindices,
00261 const UT_Matrix4 &matx,
00262 GB_PointGroup *ptgroup = NULL,
00263 GEO_Delta *geodelta = 0);
00264
00265
00266
00267 int create(int nelems, int order=4, int closed = 0,
00268 int interpEnds = 1, int appendPoints = 1);
00269
00270
00271 void fit(const UT_Vector4Array &v4Data,
00272 UT_Vector *data, int curOrd, int prevEnd,
00273 int cvEnd, UT_Vector *coord, UT_Vector ¶m,
00274 UT_Vector &error, float smooth);
00275 };
00276
00277 #endif