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 {
00041 GU_POLYKNIT_TRIANGLE = 0,
00042 GU_POLYKNIT_QUAD,
00043 GU_POLYKNIT_META_TRIANGLE,
00044 GU_POLYKNIT_META_QUAD
00045 };
00046
00047
00048 class GU_API GU_PolyKnitParms
00049 {
00050 public:
00051 bool myUnique;
00052 bool myFlipNormals;
00053 bool myRemoveDegenerates;
00054 bool myCollapseQuads;
00055 };
00056
00057 class GU_API GU_PolyKnit
00058 {
00059 public:
00060 GU_PolyKnit(GU_Detail *gdp, bool buildpointref);
00061 GU_PolyKnit(GU_Detail *gdp, GEO_PointRefArray *ptrefarr);
00062 ~GU_PolyKnit();
00063
00064
00065
00066 bool buildPolygons(GU_Detail *destgdp,
00067 const UT_IntArray &ptarray,
00068 const UT_IntArray &typearray,
00069 const GU_PolyKnitParms &parms,
00070 GA_PrimitiveGroup *resultprims);
00071
00072
00073
00074
00075 bool getShortestPath(GEO_Point *srcpt, GEO_Point *destpt,
00076 UT_PtrArray<GEO_Point *> &ptlist);
00077
00078
00079
00080 bool arePointsConnected(GEO_Point &srcpt, GEO_Point &destpt);
00081
00082 private:
00083
00084 void updateWeights(GEO_Point *srcpt, float src_w,
00085 UT_PtrArray<GEO_Point *> &src_path,
00086 gu_WeightPriorityQueue &pq);
00087
00088 void updateWeightsForPoint(GEO_Point *srcpt,
00089 const GEO_Point *nextpt,
00090 float src_w,
00091 UT_PtrArray<GEO_Point *> &src_path,
00092 gu_WeightPriorityQueue &pq,
00093 UT_BitArray &visited);
00094
00095
00096
00097 bool buildTriangle(GU_Detail *gdp, const UT_IntArray &ptarray,
00098 const UT_PtrArray<GEO_Point *> &newptarray,
00099 int i, bool reverse_poly, bool remove_degenerates,
00100 bool unique, GEO_PrimPoly *&poly);
00101 bool buildQuad(GU_Detail *gdp, const UT_IntArray &ptarray,
00102 const UT_PtrArray<GEO_Point *> &newptarray,
00103 int i, bool reverse_poly, bool remove_degenerates,
00104 bool unique, bool collapse_quads,
00105 GEO_PrimPoly *&poly);
00106 bool buildMetaTriangle(GU_Detail *gdp,
00107 const UT_IntArray &ptarray,
00108 UT_PtrArray<GEO_Point *> &newptarray,
00109 int idx, bool reverse_poly, bool remove_degenerates,
00110 bool unique, GA_PrimitiveGroup *resultprims);
00111 bool buildMetaQuad(GU_Detail *gdp, const UT_IntArray &ptarray,
00112 UT_PtrArray<GEO_Point *> &newptarray,
00113 int idx, bool reverse_poly, bool remove_degenerates,
00114 bool unique, bool collapse_quads,
00115 GA_PrimitiveGroup *resultprims);
00116
00117
00118
00119 void createNewPoints(GU_Detail *gdp,
00120 const UT_PtrArray<GEO_Point *> &srcptlist,
00121 UT_PtrArray<GEO_Point *> &newptarray);
00122
00123
00124
00125
00126
00127 bool reorderPoints(GEO_Point *srcpt0, GEO_Point *&srcpt1,
00128 GEO_Point *&destpt0, GEO_Point *&destpt1);
00129
00130 bool reorderPoints(GEO_Point *&srcpt, GEO_Point *&destpt0,
00131 GEO_Point *&destpt1);
00132
00133
00134
00135
00136
00137 GEO_PrimPoly *createTriangle(int i0, int i1, int i2,
00138 bool unique, bool reverse, GU_Detail *gdp,
00139 UT_PtrArray<GEO_Point *> &newptarray);
00140 GEO_PrimPoly *createQuad(int i0, int i1, int i2, int i3, bool unique,
00141 bool reverse, GU_Detail *gdp,
00142 UT_PtrArray<GEO_Point *> &newptarray);
00143
00144
00145 GU_Detail *myGdp;
00146 GEO_PointRefArray *myPointRefArray;
00147 GEO_Closure myClosure;
00148 GEO_PointClassifier myPointClassifier;
00149 bool myOwnPointRefArray;
00150 };
00151
00152 #endif