00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __GU_Group_h__
00021 #define __GU_Group_h__
00022
00023 #include "GU_API.h"
00024
00025 #include <UT/UT_BoundingBox.h>
00026 #include <UT/UT_VectorTypes.h>
00027
00028 class UT_String;
00029 class GEO_Point;
00030 class GU_Detail;
00031 class GU_RayIntersect;
00032 class GA_ElementGroup;
00033
00034
00035
00036
00037
00038
00039
00040 class GU_API GU_GroupParms
00041 {
00042 public:
00043 GU_GroupParms()
00044 {
00045 useBounding = 0;
00046 useNumbering = 0;
00047 useNormal = 0;
00048 useBackface = 0;
00049 useEdgeDist = 0;
00050 useDegenerate = 0;
00051 origptgroup = 0;
00052 edgedepth = 0;
00053 useNonPlanar = 0;
00054 isoOffset = 0.0;
00055 invertVolume = false;
00056 boundGdp = 0;
00057 }
00058 ~GU_GroupParms() {}
00059
00060 const char *pattern;
00061 int ordered;
00062 int start;
00063 int end;
00064 int incStart;
00065 int incEnd;
00066 float radx, rady, radz;
00067 float tx, ty, tz;
00068 float rx, ry, rz;
00069 float nx, ny, nz;
00070 UT_Vector3 eye;
00071 float spreadAngle;
00072 int boundingType;
00073 int numberingType;
00074 int useBounding;
00075 int useNumbering;
00076 int useNormal;
00077 int useBackface;
00078 int booleanType;
00079 int useEdgeDist;
00080 GA_PointGroup *origptgroup;
00081 int edgedepth;
00082 GU_RayIntersect *rayTree;
00083 const UT_String *group1;
00084 const UT_String *group2;
00085 int useNonPlanar;
00086 float nonPlanarTol;
00087 int useDegenerate;
00088 bool useDegenPrims;
00089 bool useZAF;
00090 bool doOpenZAF;
00091 float tolZAF;
00092 float isoOffset;
00093 bool invertVolume;
00094 const GU_Detail *boundGdp;
00095 };
00096
00097
00098
00099
00100
00101
00102
00103 enum GU_GroupBoolOp
00104 {
00105 GU_GROUP_BOOLOP_NONE = 0,
00106 GU_GROUP_BOOLOP_OR = 1,
00107 GU_GROUP_BOOLOP_AND = 2,
00108 GU_GROUP_BOOLOP_XOR = 3,
00109 GU_GROUP_BOOLOP_MINUS = 4
00110 };
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125 class GU_API GU_Group
00126 {
00127 public:
00128 GU_Group(GU_Detail *gdp);
00129 virtual ~GU_Group();
00130
00131 virtual GA_ElementGroup *newGroup(const char *) = 0;
00132 virtual GA_ElementGroup *find(const char *) const = 0;
00133 virtual void destroy(void) = 0;
00134
00135
00136
00137
00138 virtual bool boolean(GU_GroupBoolOp boolop,
00139 const UT_String &group1, bool negate1,
00140 const UT_String &group2, bool negate2) const;
00141
00142 virtual bool boolean(GU_GroupBoolOp boolop,
00143 GA_ElementGroup *group1, bool negate1,
00144 GA_ElementGroup *group2, bool negate2) const;
00145
00146 GA_ElementGroup *group() const { return theGroup; }
00147
00148 protected:
00149
00150 virtual void generateGroup(const GU_GroupParms &parms) = 0;
00151
00152
00153
00154
00155
00156
00157
00158 virtual void range(int, int, int, int, int, int) const=0;
00159 void getRangeValues(int, int &, int &,
00160 int &, int &) const;
00161
00162
00163
00164 virtual void pattern(char *pattern, int nelements,
00165 int order) const=0;
00166
00167
00168 virtual int boundingBox(float, float, float,
00169 float, float, float,
00170 float, float, float);
00171
00172
00173
00174 virtual void boundingSphere(float, float, float,
00175 float, float, float) const = 0;
00176
00177
00178
00179 virtual void normal(UT_Vector3 &nml, float angle) const = 0;
00180
00181
00182
00183
00184
00185 virtual void degenerate(bool degenerate, bool zaf,
00186 bool doOpen, float tol) const = 0;
00187
00188 int isBackface(UT_Vector3 pos,
00189 UT_Vector3 nml,
00190 UT_Vector3 eye) const;
00191
00192
00193
00194
00195 bool pointInsideSphere(const GU_Detail *gdp,
00196 GA_Offset ptoff,
00197 float a, float b, float c,
00198 float tx, float ty, float tz)
00199 const;
00200
00201
00202 GU_Detail *gdp() const { return theGdp; }
00203 UT_BoundingBox *getBBox() const { return theBBox; }
00204
00205
00206 void setGroup(GA_ElementGroup *grp) { theGroup = grp; }
00207 void deleteBBox();
00208
00209
00210 private:
00211
00212 GA_ElementGroup *theGroup;
00213 UT_BoundingBox *theBBox;
00214 GU_Detail *theGdp;
00215 };
00216
00217 #endif