00001 /* 00002 * PROPRIETARY INFORMATION. This software is proprietary to 00003 * Side Effects Software Inc., and is not to be reproduced, 00004 * transmitted, or disclosed in any way without written permission. 00005 * 00006 * Produced by: 00007 * Jeff Lait 00008 * Side Effects Software Inc 00009 * 477 Richmond Street West 00010 * Toronto, Ontario 00011 * Canada M5V 3E7 00012 * 416-504-9876 00013 * 00014 * NAME: GU_TriDivide.h ( GU Library, C++) 00015 * 00016 * COMMENTS: 00017 */ 00018 00019 #ifndef __GU_TriDivide__ 00020 #define __GU_TriDivide__ 00021 00022 #include "GU_API.h" 00023 class GB_PrimitiveGroup; 00024 class guDivTri; 00025 class UT_HashTable; 00026 00027 class GU_API GU_TriDivide 00028 { 00029 public: 00030 GU_TriDivide(GU_Detail *gdp); 00031 00032 virtual ~GU_TriDivide(); 00033 00034 void setDetail(GU_Detail *gdp) { myGdp = gdp; } 00035 GU_Detail *getDetail() const { return myGdp; } 00036 00037 void setRefDetail(const GU_Detail *refgdp) { myRefGdp = refgdp; } 00038 const GU_Detail *getRefDetail() const { return myRefGdp; } 00039 00040 /// Builds the triangle list. 00041 void buildTopology(const GB_PrimitiveGroup *grp=0); 00042 00043 /// Does root(3) subdivision. 00044 void tridivide(int depth); 00045 00046 /// Equalizes edges by splitting the longest edges. 00047 /// Splits are done until minimum length is less than minlength 00048 /// or number of splits numsplits has been done. A value of -1 00049 /// is ignored. 00050 void equalizeEdges(fpreal minlength, int numsplit); 00051 00052 /// Transforms the triangle list into actual triangles. 00053 void buildGeometry(); 00054 00055 /// Technically should be friended to our guDivTri. 00056 guDivTri *allocTri(); 00057 00058 protected: 00059 void buildTri(GEO_PrimPoly *poly, UT_HashTable &hash); 00060 00061 fpreal calculateLength(int aidx, int bidx, 00062 bool useref, 00063 const UT_Vector3Array &refpos) const; 00064 00065 protected: 00066 GU_Detail *myGdp; 00067 const GU_Detail *myRefGdp; 00068 UT_PtrArray<guDivTri *> myTriList; 00069 }; 00070 00071 #endif 00072
1.5.9