00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __GU_EdgeSplit_h__
00021 #define __GU_EdgeSplit_h__
00022
00023 #include "GU_API.h"
00024 #include <UT/UT_IntArray.h>
00025 #include <UT/UT_PtrArray.h>
00026 #include <UT/UT_RefArray.h>
00027 #include <UT/UT_VectorTypes.h>
00028
00029 class GB_EdgeGroup;
00030 class GB_PointGroup;
00031 class GB_PrimitiveGroup;
00032 class GEO_Closure;
00033 class GEO_Point;
00034 class GEO_PointRefArray;
00035 class GEO_PrimPoly;
00036 class GU_Detail;
00037 class GU_SplitHistory;
00038 class GU_SplitHistoryNode;
00039 class GU_SplitLoc;
00040 class GU_SplitPath;
00041 class GU_SplitPathNode;
00042 class GU_SplitPathManager;
00043 class gu_PrimToUpdate;
00044 class gu_CrossEdge;
00045
00046
00047
00048
00049
00050 class GU_API GU_SplitLoc
00051 {
00052 public:
00053 GU_SplitLoc(GEO_Point *p0 = 0, GEO_Point *p1 = 0,
00054 float t = 0.0F, GEO_PrimPoly *poly = 0) :
00055 myP0(p0), myP1(p1), myT(t), myPoly(poly)
00056 { }
00057
00058 GU_SplitLoc &operator=(const GU_SplitLoc &src)
00059 {
00060 myP0 = src.myP0;
00061 myP1 = src.myP1;
00062 myT = src.myT;
00063 myPoly = src.myPoly;
00064 return *this;
00065 }
00066 unsigned int operator==(const GU_SplitLoc &src) const;
00067 unsigned int operator!=(const GU_SplitLoc &src) const
00068 {
00069 return !(operator==(src));
00070 }
00071
00072 UT_Vector4 getPos() const;
00073 void print() const;
00074
00075 GEO_Point *myP0;
00076 GEO_Point *myP1;
00077 float myT;
00078 GEO_PrimPoly *myPoly;
00079 };
00080 typedef UT_PtrArray<GU_SplitLoc *> GU_SplitLocPtrArray;
00081
00082
00083
00084
00085
00086
00087
00088 class GU_API gu_UpdatePrimList
00089 {
00090 public:
00091 ~gu_UpdatePrimList();
00092
00093 UT_PtrArray<gu_PrimToUpdate *> myList;
00094
00095 void updatePrims(const GU_SplitHistory &hist, const GU_Detail &gdp,
00096 float tolerance);
00097
00098
00099 void getPrimsUsingPoint(const GEO_Point *pt, UT_IntArray &primlist);
00100 };
00101
00102
00103
00104
00105
00106
00107
00108
00109 class gu_PrimDistance;
00110
00111
00112
00113 class GU_API GU_EdgeSplit
00114 {
00115 public:
00116 GU_EdgeSplit(GU_Detail &gdp, GB_EdgeGroup *outedges = 0);
00117 ~GU_EdgeSplit();
00118
00119 void doSplit(const GU_SplitLocPtrArray &splitlocs, bool force,
00120 bool quadcut, float tolerance);
00121
00122 private:
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134 void split(const GU_SplitLoc &from, const GU_SplitLoc &to,
00135 GU_SplitPath *&path, bool quadcut, bool findingtail,
00136 int pointpass);
00137 int simplify(GU_SplitLoc &from, GU_SplitLoc &to);
00138
00139 void splitPoly(GEO_PrimPoly &poly, int fromedge, int toedge,
00140 float fromt, float tot,
00141 GEO_Point *newpt0, GEO_Point *newpt1);
00142
00143
00144 bool addPathNode(const GU_SplitLoc &from, const GU_SplitLoc &to,
00145 GU_SplitPath &path);
00146
00147 void updateNeighbourPrims(const GU_SplitLoc &splitloc);
00148
00149 bool restructureSplit(GU_SplitHistoryNode *stn, GU_SplitLoc &loc);
00150 void executePath(GU_SplitPath &path);
00151 bool getTransferCandidates(const GU_SplitLoc &from,
00152 GB_PrimitiveGroup &grp);
00153 bool transferLoc(GU_SplitLoc &loc, GEO_PrimPoly *poly);
00154 bool inPath(GEO_PrimPoly *poly, const GU_SplitPath &path);
00155 void pruneGroup(const GU_SplitLoc &fromloc, const GU_SplitLoc &toloc,
00156 UT_IntArray &primlist, bool quadcut);
00157
00158 void getEdgeCandidates(const GU_SplitLoc &loc,
00159 const UT_Vector4 &src, const UT_Vector4 &dest,
00160 UT_RefArray<gu_CrossEdge> &arr,
00161 bool quadcut);
00162
00163 void sortEdgeCandidates(const GU_SplitLoc &loc,
00164 const UT_Vector4 &dest,
00165 UT_RefArray<gu_CrossEdge> &arr);
00166
00167 void getPrimCandidates(const GEO_PrimPoly *poly, GEO_Point *pt0,
00168 GEO_Point *pt1,const GU_SplitPath &path,
00169 UT_IntArray &candidates, bool quadcut);
00170
00171 GEO_Point *getNewPoint(GEO_Point *pt0, GEO_Point *pt1, float t);
00172
00173 int buildFromPrimArray(const GU_SplitLoc &fromloc,
00174 const GU_SplitLoc &toloc,
00175 UT_IntArray &fromlist,
00176 UT_PtrArray<gu_PrimDistance *> &primarray,
00177 bool quadcut);
00178
00179
00180
00181
00182
00183 void quadProcessPath(GU_SplitPath &path, bool quadclosed,
00184 bool findingtail);
00185
00186 void getParticipatingPolys(const GU_SplitLoc &loc,
00187 GEO_Closure &closure, UT_IntArray &prims);
00188
00189
00190
00191 GEO_PointRefArray *myPointRefArr;
00192 GB_PrimitiveGroup *myTempPrimGrp;
00193 GB_PointGroup *myNewPointsGrp;
00194 gu_UpdatePrimList myUpdatePrimList;
00195 GU_SplitHistory *myHistory;
00196 GU_Detail &myGdp;
00197 GU_SplitPathManager *mySplitPathMan;
00198 GB_EdgeGroup *myOutEdges;
00199 bool myForceCut;
00200 float myTolerance;
00201 };
00202
00203 #endif