00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef __GU_PolyKnit_h__
00020 #define __GU_PolyKnit_h__
00021
00022 #include "GU_API.h"
00023 #include <UT/UT_IntArray.h>
00024 #include <UT/UT_PtrArray.h>
00025 #include <GEO/GEO_Closure.h>
00026 #include <GEO/GEO_PointClassifier.h>
00027
00028 class UT_BitArray;
00029 class GEO_Point;
00030 class GEO_PointRefArray;
00031 class GEO_PrimPoly;
00032 class GU_Detail;
00033 class gu_WeightPathPair;
00034 class gu_WeightPriorityQueue;
00035
00036
00037
00038
00039 enum GU_PolyKnitType {
00040 GU_POLYKNIT_TRIANGLE = 0,
00041 GU_POLYKNIT_QUAD,
00042 GU_POLYKNIT_META_TRIANGLE,
00043 GU_POLYKNIT_META_QUAD
00044 };
00045
00046
00047 class GU_API GU_PolyKnitParms
00048 {
00049 public:
00050 bool myUnique;
00051 bool myFlipNormals;
00052 bool myRemoveDegenerates;
00053 bool myCollapseQuads;
00054 };
00055
00056 class GU_API GU_PolyKnit
00057 {
00058 public:
00059 GU_PolyKnit(GU_Detail *gdp, bool buildpointref);
00060 GU_PolyKnit(GU_Detail *gdp, GEO_PointRefArray *ptrefarr);
00061 ~GU_PolyKnit();
00062
00063
00064
00065 bool buildPolygons(GU_Detail *destgdp,
00066 const UT_IntArray &ptarray,
00067 const UT_IntArray &typearray,
00068 const GU_PolyKnitParms &parms,
00069 GB_PrimitiveGroup *resultprims);
00070
00071
00072
00073
00074 bool getShortestPath(GEO_Point *srcpt, GEO_Point *destpt,
00075 UT_PtrArray<GEO_Point *> &ptlist);
00076
00077
00078
00079 bool arePointsConnected(GEO_Point &srcpt, GEO_Point &destpt);
00080
00081 private:
00082
00083 void updateWeights(GEO_Point *srcpt, float src_w,
00084 UT_PtrArray<GEO_Point *> &src_path,
00085 gu_WeightPriorityQueue &pq);
00086
00087 void updateWeightsForPoint(GEO_Point *srcpt,
00088 const GEO_Point *nextpt,
00089 float src_w,
00090 UT_PtrArray<GEO_Point *> &src_path,
00091 gu_WeightPriorityQueue &pq,
00092 UT_BitArray &visited);
00093
00094
00095
00096 bool buildTriangle(GU_Detail *gdp, const UT_IntArray &ptarray,
00097 const UT_PtrArray<GEO_Point *> &newptarray,
00098 int i, bool reverse_poly, bool remove_degenerates,
00099 bool unique, GEO_PrimPoly *&poly);
00100 bool buildQuad(GU_Detail *gdp, const UT_IntArray &ptarray,
00101 const UT_PtrArray<GEO_Point *> &newptarray,
00102 int i, bool reverse_poly, bool remove_degenerates,
00103 bool unique, bool collapse_quads,
00104 GEO_PrimPoly *&poly);
00105 bool buildMetaTriangle(GU_Detail *gdp,
00106 const UT_IntArray &ptarray,
00107 UT_PtrArray<GEO_Point *> &newptarray,
00108 int idx, bool reverse_poly, bool remove_degenerates,
00109 bool unique, GB_PrimitiveGroup *resultprims);
00110 bool buildMetaQuad(GU_Detail *gdp, const UT_IntArray &ptarray,
00111 UT_PtrArray<GEO_Point *> &newptarray,
00112 int idx, bool reverse_poly, bool remove_degenerates,
00113 bool unique, bool collapse_quads,
00114 GB_PrimitiveGroup *resultprims);
00115
00116
00117
00118 void createNewPoints(GU_Detail *gdp,
00119 const UT_PtrArray<GEO_Point *> &srcptlist,
00120 UT_PtrArray<GEO_Point *> &newptarray);
00121
00122
00123
00124
00125
00126 bool reorderPoints(GEO_Point *srcpt0, GEO_Point *&srcpt1,
00127 GEO_Point *&destpt0, GEO_Point *&destpt1);
00128
00129 bool reorderPoints(GEO_Point *&srcpt, GEO_Point *&destpt0,
00130 GEO_Point *&destpt1);
00131
00132
00133
00134
00135
00136 GEO_PrimPoly *createTriangle(int i0, int i1, int i2,
00137 bool unique, bool reverse, GU_Detail *gdp,
00138 UT_PtrArray<GEO_Point *> &newptarray);
00139 GEO_PrimPoly *createQuad(int i0, int i1, int i2, int i3, bool unique,
00140 bool reverse, GU_Detail *gdp,
00141 UT_PtrArray<GEO_Point *> &newptarray);
00142
00143
00144 GU_Detail *myGdp;
00145 GEO_PointRefArray *myPointRefArray;
00146 GEO_Closure myClosure;
00147 GEO_PointClassifier myPointClassifier;
00148 bool myOwnPointRefArray;
00149 };
00150
00151 #endif