00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __GU_Curve_h__
00022 #define __GU_Curve_h__
00023
00024 #include "GU_API.h"
00025 #include <GEO/GEO_Curve.h>
00026 #include "GU_Prim.h"
00027
00028 class UT_Matrix;
00029 class UT_Vector4Array;
00030 class GEO_Hull;
00031 class GU_PrimPoly;
00032 class GU_Detail;
00033 class GU_CurveCache;
00034 class GU_RayCache;
00035 class GU_RayInfoHit;
00036 class GU_ConvertMethod;
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046 class GU_API GU_Curve : public GU_Primitive
00047 {
00048 public:
00049 virtual ~GU_Curve();
00050
00051
00052
00053 GEO_Primitive *convert(GU_ConvertParms &parms,
00054 GB_PointGroup *usedpts = 0);
00055
00056 GEO_Primitive *convertNew(GU_ConvertParms &parms);
00057 GEO_Hull *convertToSurfNew(GU_ConvertParms &parms);
00058
00059
00060
00061
00062 virtual GEO_Face *reconfigure(unsigned type, int order, int open,
00063 int interpends, int nonrational) const=0;
00064
00065
00066 GEO_Curve *getCurve(void) const { return theCurve; }
00067
00068
00069
00070
00071
00072 GU_PrimPoly *makeGrevillePoly(GU_Detail *dest = 0);
00073
00074
00075 virtual GU_DisplayCache *getDisplayCache(void) const;
00076 virtual int buildDisplayCache(GU_CacheParms &parms);
00077
00078 virtual GU_DisplayMesh *getDisplayMesh(int noff, float lod);
00079
00080 virtual GU_RayIntersect *getRayCache(void) const;
00081 virtual int buildRayCache(void);
00082
00083
00084 virtual GU_RayIntersect *createRayCache(int &persistent);
00085
00086 virtual void destroyCache(void);
00087 virtual void notifyCache(int type);
00088 virtual void notifyCache(int type, const GEO_Point &ppt);
00089 virtual void notifyCache(int type, const GB_PointGroup &grp);
00090 virtual void notifyCache(int type, const UT_Matrix4 &xform,
00091 int push);
00092 virtual void notifyCache(int type, const UT_Vector3 &delta);
00093
00094
00095 int elevateOrder(int order);
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107 void computeDataPtsUnitTangents(const UT_Matrix &dataPts,
00108 UT_Matrix &tangents);
00109
00110
00111
00112 void curveNormal(UT_Vector3 &n) const;
00113 virtual void normal(int noff) const;
00114 virtual void normal(UT_Vector3Array &output) const;
00115
00116
00117
00118
00119
00120
00121
00122 virtual GU_Curve *cut(float u1, float u2,
00123 int &ind1, int &ind2, int keep) = 0;
00124
00125
00126 virtual void openAt(float u) = 0;
00127
00128
00129 virtual int intersect(GU_Primitive &prim,
00130 UT_RefArray<GU_RayInfoHit> &hitList,
00131 float tol = 0.01F, int ignoretrim = 1);
00132
00133
00134
00135 int interpretBreakpoint(int idx, UT_Vector3 &p);
00136
00137
00138 protected:
00139
00140 GU_Curve() : GU_Primitive() { theDisplayCache = 0; theRayCache = 0;}
00141
00142
00143
00144 int create(GEO_Curve *crv, int nelems, int closed,
00145 int appendPoints = 1);
00146
00147
00148 void setCurve(GEO_Curve *crv) { theCurve = crv; }
00149
00150
00151
00152 void evaluationInterval(float lod,
00153 float &ustart, float &ustop, int &nu) const;
00154
00155
00156
00157 public:
00158 int evaluateCurve( GU_ConvertMethod &method,
00159 UT_Vector4Array &pos) const;
00160 protected:
00161 int evaluateCurve( GU_ConvertMethod &method,
00162 UT_Vector4Array &pos,
00163 GB_AttributeData *&adata,
00164 int &vtxattrib) const;
00165
00166 private:
00167 GEO_Curve *theCurve;
00168 GU_CurveCache *theDisplayCache;
00169 GU_RayCache *theRayCache;
00170
00171 GEO_Primitive *convertToPoly(GU_ConvertParms &parms);
00172 GEO_Hull *convertToTrim(GU_ConvertParms &p);
00173 GEO_Hull *convertToPotatoChip(void);
00174 };
00175
00176 #endif