00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef __GQ_PolyBevel_h__
00020 #define __GQ_PolyBevel_h__
00021
00022 #include "GQ_API.h"
00023 #include <UT/UT_HashTable.h>
00024 #include "GQ_Detail.h"
00025
00026 class GQ_API gq_BevelEdgeNode
00027 {
00028 public:
00029 GEO_PrimPoly *myPoly;
00030 GEO_Point *myPt1;
00031 GEO_Point *myPt2;
00032 UT_Vector3 myDir1;
00033 UT_Vector3 myDir2;
00034 UT_Vector3 myCorner1;
00035 UT_Vector3 myCorner2;
00036 };
00037
00038 class GQ_API gq_BevelPointNode
00039 {
00040 public:
00041 GEO_PrimPoly *myPoly;
00042 UT_Vector3 myCorner;
00043 GB_AttributeData myAttrib;
00044 };
00045
00046 class GQ_API GQ_PolyBevel
00047 {
00048 public:
00049 GQ_PolyBevel(GU_Detail *gdp, int relative, float inset, int type,
00050 int repetitions);
00051 ~GQ_PolyBevel();
00052
00053 GB_PrimitiveGroup *pointBevel(GB_PointGroup *pointgroup);
00054 GB_PrimitiveGroup *edgeBevel(GB_EdgeGroup *edgegroup);
00055
00056 protected:
00057 void smoothBevel();
00058
00059
00060 void bevelPoints ();
00061 void cornerBevelPoints();
00062
00063
00064 void bevelEdges ();
00065
00066
00067 void smoothBevelEdges();
00068 void smoothBevelPoints();
00069
00070
00071 private:
00072
00073
00074 void findBevelPoint(GEO_Point *, float, GQ_Edge *,
00075 GEO_Point *&, bool &);
00076 void addCornerPoints(GEO_Point *, GEO_Point *,
00077 UT_RefArray<GEO_Point *>, UT_RefArray
00078 <GEO_Point *> &, GEO_PrimPoly *);
00079
00080
00081 void selectBevelPoints(GB_PointGroup *&);
00082 void findEdgePoint(GEO_Point *, GQ_Edge *,
00083 UT_PtrArray<GEO_Point *>&,
00084 GEO_Point *&, GEO_Point *, bool &);
00085 void findBeforePoint(GEO_Point *, GQ_Edge *,
00086 UT_PtrArray<GEO_Point *>&,
00087 GEO_Point *&);
00088 void findAfterPoint(GEO_Point *, GQ_Edge *,
00089 UT_PtrArray<GEO_Point *>&,
00090 GEO_Point *&, GEO_Point *);
00091 void startBevelFace(GQ_Edge *, UT_PtrArray<GQ_Face *>&,
00092 GEO_Point *, GEO_Point *);
00093 void finishBevelFace(GQ_Edge *, UT_PtrArray<GQ_Face *>& ,
00094 GEO_Point *, GEO_Point *);
00095 GEO_PrimPoly *createMidPoly(unsigned int, const
00096 UT_PtrArray<GEO_Point *> &);
00097
00098
00099 void addPerimeter(GQ_Face *,
00100 UT_PtrArray<GEO_Point *> &, const UT_Vector3 &,
00101 const GB_AttributeData &);
00102 void addMajorDivisions(GQ_Face *,
00103 const UT_PtrArray<GEO_Point *> &,
00104 UT_PtrArray<GEO_Point *> &, const UT_Vector3 &,
00105 const GB_AttributeData &);
00106 void findMajorPoints(const UT_Vector4 &,
00107 UT_PtrArray<GEO_Point *> &, const UT_Vector3 &,
00108 const UT_Plane &, const UT_Vector3 &,
00109 const GB_AttributeData &, GQ_Edge *);
00110 void addMinorDivisions(GQ_Face *,
00111 const UT_PtrArray<GEO_Point *> &,
00112 const UT_PtrArray<GEO_Point *> &,
00113 const UT_Vector3 &, const GB_AttributeData &);
00114 void addFillPolys(GQ_Face *face, const
00115 UT_PtrArray<GEO_Point *> &, const
00116 UT_PtrArray<GEO_Point *> &);
00117 void addPatchPolys(GQ_Face *face,
00118 const UT_PtrArray<GEO_Point *> &);
00119 void addCornerPolys(const UT_PtrArray<GQ_Face *> &,
00120 GB_PrimitiveGroup &);
00121 void addEdgePolys(const UT_PtrArray<GQ_Face *> &,
00122 GB_PrimitiveGroup &,
00123 const UT_RefArray<gq_BevelEdgeNode> &);
00124 UT_PtrArray<GEO_Point *> addEdgePoints(GQ_Edge *,
00125 const UT_Vector3 &, const UT_Vector3 &,
00126 const UT_Vector3 &);
00127 GEO_PrimPoly *addTriangle(GEO_Point *, GEO_Point *, GEO_Point *,
00128 GEO_PrimPoly *);
00129 GEO_PrimPoly *addRectangle(GEO_Point *, GEO_Point *, GEO_Point *,
00130 GEO_Point *, GEO_PrimPoly *);
00131
00132
00133 GU_Detail *myGdp;
00134 GQ_Detail *myGqd;
00135 int myRepetitions;
00136 float myInset;
00137 int myType;
00138 bool myRelative;
00139 GB_PrimitiveGroup *myOutput;
00140 GB_PointGroup *myPointGroup;
00141 GB_EdgeGroup *myEdgeGroup;
00142 UT_RefArray<gq_BevelEdgeNode> myBevelList;
00143 UT_RefArray<gq_BevelPointNode> myOldPoints;
00144 UT_HashTable *myBevelTable;
00145 UT_HashTable *myPointTable;
00146 GB_PrimitiveGroup *myNewOutput;
00147 UT_PtrArray<GEO_Point *> myAddedPoints;
00148 UT_PtrArray<GEO_Point *> myAddedPointsonFace;
00149 };
00150
00151 #endif