15 #ifndef __GEO_VolumeElement__
16 #define __GEO_VolumeElement__
26 #define DISPATCH(TYPEID, FUNCTION, ...) \
27 switch ((TYPEID).get()) \
29 case GA_PRIMTETRAHEDRON: \
30 return GEO_PrimTetrahedron::FUNCTION(__VA_ARGS__); \
31 case GA_PRIMHEXAHEDRON: \
32 return GEO_PrimHexahedron::FUNCTION(__VA_ARGS__); \
73 template <
typename OP>
100 template <
typename OP>
108 template <
typename OP>
136 if (!myDetail)
return false;
149 myType = myDetail->getPrimitiveTypeId(myOffset);
160 myType = myDetail->getPrimitiveTypeId(myOffset);
169 {
DISPATCH(type, rawVertexCount);
return 0; }
171 {
return getVertexCount(myType, myDetail, myOffset); }
177 {
return getVertexList(myDetail, myOffset); }
183 {
return getVertexOffset(myDetail, myOffset, index); }
187 {
return gdp->
vertexPoint(getVertexOffset(gdp, offset, index)); }
189 {
return getPointOffset(myDetail, myOffset, index); }
193 {
DISPATCH(type, rawFaceCount);
return 0; }
195 {
return getFaceCount(myType, myDetail, myOffset); }
199 {
DISPATCH(type, rawFaceIndices, gdp, offset, faceno, vtxlist);
return 0; }
201 {
return getFaceIndices(myType, myDetail, myOffset, faceno, vtxlist); }
205 {
DISPATCH(type, rawFaceIndexCount, gdp, offset, faceno);
return 0; }
207 {
return getFaceIndexCount(myType, myDetail, myOffset, faceno); }
211 {
return findSharedFace(myType, myDetail, myOffset, faceno); }
215 {
DISPATCH(type, rawEdgeCount);
return 0; }
217 {
return getEdgeCount(myType, myDetail, myOffset); }
222 {
DISPATCH(type, rawEdgeIndices, gdp, offset, edgeno, e0, e1); }
224 { getEdgeIndices(myType, myDetail, myOffset, edgeno, e0, e1); }
228 {
DISPATCH(type, rawComputeInteriorPointWeights, gdp, offset, vtxlist, weightlist, u, v, w) }
230 { computeInteriorPointWeights(myType, myDetail, myOffset, vtxlist, weightlist, u, v, w); }
SYS_FORCE_INLINE GA_Offset getPrimitiveVertexOffset(GA_Offset primoff, GA_Size i) const
static GA_Offset getPointOffset(const GA_Detail *gdp, GA_Offset offset, GA_Size index)
Return the point offset from a given vertex index.
SYS_FORCE_INLINE int getPrimitiveTypeId(GA_Offset primoff) const
static void computeInteriorPointWeights(GA_PrimitiveTypeId type, const GA_Detail *gdp, GA_Offset offset, UT_Array< GA_Offset > &vtxlist, UT_Array< float > &weightlist, fpreal u, fpreal v, fpreal w)
Evaluate the interior point weights.
SYS_FORCE_INLINE T * SYSconst_cast(const T *foo)
int getFaceIndexCount(GA_Size faceno) const
#define DISPATCH(TYPEID, FUNCTION,...)
GA_PrimitiveTypeId typeId() const
const GA_Detail * detail() const
void getEdgeIndices(GA_Size edgeno, int &e0, int &e1) const
static GA_Size getFaceCount(GA_PrimitiveTypeId type, const GA_Detail *d, GA_Offset offset)
The number of faces that make up this volume.
SYS_FORCE_INLINE bool GAisValid(GA_Size v)
exint GA_Size
Defines the bit width for index and offset types in GA.
GA_Size getEdgeCount() const
#define GA_INVALID_OFFSET
GA_Size getVertexCount() const
int getFaceIndices(GA_Size faceno, UT_Array< int > &vtxlist) const
void bind(const GA_Detail *gdp, GA_Offset offset)
const GA_Detail * myDetail
static int getFaceIndices(GA_PrimitiveTypeId type, const GA_Detail *gdp, GA_Offset offset, GA_Size faceno, UT_Array< int > &vtxlist)
Returns the indices to the vertices, not the vertex offsets!
static void dispatch(GA_PrimitiveTypeId type, const GA_Detail *gdp, GA_Offset offset, OP op)
GA_Offset getPointOffset(GA_Size index) const
void setOffset(GA_Offset offset)
Update the element to point to another primitive in same detail.
SYS_FORCE_INLINE GA_OffsetListRef getPrimitiveVertexList(GA_Offset primoff) const
static GA_Offset getVertexOffset(const GA_Detail *gdp, GA_Offset offset, GA_Size index)
Return the vertex offset from a given vertex index.
GA_PrimitiveTypeId myType
static GA_OffsetListRef getVertexList(const GA_Detail *gdp, GA_Offset offset)
Return shallow copy of the vertex list.
GA_Offset getMapOffset() const
SYS_FORCE_INLINE int get() const
SYS_FORCE_INLINE GA_Offset vertexPoint(GA_Offset vertex) const
Given a vertex, return the point it references.
static void dispatch(GA_PrimitiveTypeId type, const GA_Primitive *baseprim, OP op)
SYS_FORCE_INLINE GEO_VolumeElement()
static void getEdgeIndices(GA_PrimitiveTypeId type, const GA_Detail *gdp, GA_Offset offset, GA_Size edgeno, int &e0, int &e1)
static GA_Size getVertexCount(GA_PrimitiveTypeId type, const GA_Detail *gdp, GA_Offset offset)
static int getFaceIndexCount(GA_PrimitiveTypeId type, const GA_Detail *gdp, GA_Offset offset, GA_Size faceno)
Returns the number of indices in specified face.
static void dispatch(const GA_Detail *gdp, GA_Offset offset, OP op)
SYS_FORCE_INLINE GEO_VolumeElement(const GA_Detail *gdp, GA_Offset offset=GA_INVALID_OFFSET)
GA_Size getFaceCount() const
GA_Offset getVertexOffset(GA_Size index) const
GA_Offset findSharedFace(GA_Size faceno) const
void computeInteriorPointWeights(UT_Array< GA_Offset > &vtxlist, UT_Array< float > &weightlist, fpreal u, fpreal v, fpreal w)
Container class for all geometry.
GLubyte GLubyte GLubyte GLubyte w
static GA_Size getEdgeCount(GA_PrimitiveTypeId type, const GA_Detail *gdp, GA_Offset offset)
The number of edges in this volume.
bool GAisVolumeElement(const GA_PrimitiveTypeId &id)
GA_OffsetListRef getVertexList() const