13 #ifndef __GEO_PrimTetrahedron__
14 #define __GEO_PrimTetrahedron__
29 #define FACE_PER_TET 4
30 #define EDGE_PER_TET 6
49 myVertexList = vertex_list;
92 GA_Offset point,
bool dry_run=
false)
override;
109 {
return getFastVertexOffset(index); }
113 {
return rawVertexCount(); }
129 const int *
f = fastFaceIndices(faceno);
155 return faceidx[faceno];
162 const int *
indices = fastFaceIndices(tri);
163 v0 = fastVertexOffset(indices[0]);
164 v1 = fastVertexOffset(indices[1]);
165 v2 = fastVertexOffset(indices[2]);
171 {
return rawEdgeCount(); }
184 e0 = edgeidx[edgeno][0];
185 e1 = edgeidx[edgeno][1];
198 {
return GAisValid(findSharedTet(faceno)); }
201 {
return findSharedTet(faceno); }
208 if (fastVertexOffset(i) == vtx)
return i;
215 if (vertexPoint(i) == pt)
return i;
232 static void remapTetCoords(
T &u,
T &
v,
T &
w,
T &uvw);
248 {
return myTet.getFastVertexOffset(myF[i]); }
250 {
return getFastVertexOffset(i); }
252 {
return myTet.getPointOffset(myF[i]); }
254 {
return myTet.getPos3(myF[i]); }
260 const int *
const myF;
271 void normal(NormalComp &output)
const override;
272 void normal(NormalCompD &output)
const override;
281 bool isContainedInside(
const UT_Vector3 &pt_pos,
304 const int *tetpointnumbers)
308 static void rawComputeInteriorPointWeights(
316 vtxlist, weightlist, u,
v,
w); }
319 void allocateVertices();
321 template <
typename T>
323 template <
typename T>
325 template <
typename T>
326 fpreal internalCalcArea()
const;
327 template <
typename T>
328 fpreal internalCalcPerimeter()
const;
334 virtual
bool validate() const;
354 friend class GU_PrimitiveFactory;
fpreal calcPerimeter() const override
static void rawEdgeIndices(const GA_Detail *gdp, GA_Offset offset, GA_Size edgeno, int &e0, int &e1)
GA_Size findVertex(GA_Offset vtx) const
GLsizei GLenum const void * indices
SYS_FORCE_INLINE GA_Detail & getDetail() const
static GA_Offset buildBlock(GA_Detail *detail, const GA_Offset startpt, const GA_Size npoints, const GA_Size ntets, const int *tetpointnumbers)
static GA_Size rawEdgeCount(const GA_Detail *gdp=nullptr, GA_Offset=GA_INVALID_OFFSET)
Used to pass options and map offset values during saving.
SYS_FORCE_INLINE GA_Size getFastVertexCount() const
Face(const GEO_PrimTetrahedron &tet, int face)
GA_Offset getVertexOffset(GA_Size i) const
static int rawFaceIndices(const GA_Detail *gdp, GA_Offset offset, GA_Size faceno, UT_Array< int > &vtxlist)
void setVertexPoint(int i, GA_Offset pt)
fpreal calcVolume(const UT_Vector3 &) const override
virtual GA_DereferenceStatus dereferencePoint(GA_Offset point, bool dry_run=false)=0
JSON reader class which handles parsing of JSON or bJSON files.
SYS_FORCE_INLINE GEO_Detail * getParent() const
void reverse() override=0
Reverse the order of vertices.
#define GA_DECLARE_INTRINSICS(OVERRIDE)
Class which writes ASCII or binary JSON streams.
Abstract base class for a range membership query object.
GLfloat GLfloat GLfloat v2
GLfloat GLfloat GLfloat GLfloat v3
virtual int64 getMemoryUsage() const
fpreal calcArea() const override
SYS_FORCE_INLINE bool GAisValid(GA_Size v)
void wireVertex(GA_Offset vertex, GA_Offset point)
exint GA_Size
Defines the bit width for index and offset types in GA.
int getFaceIndices(GA_Size faceno, UT_Array< int > &vtxlist) const override
Returns the indices to the vertices, not the vertex offsets!
SYS_FORCE_INLINE GA_Offset fastVertexOffset(GA_Size index) const
#define GA_INVALID_OFFSET
virtual void normal(NormalComp &output) const =0
virtual bool isDegenerate() const =0
Is the primitive degenerate.
void getTriangleVertexOffsets(GA_Size tri, GA_Offset &v0, GA_Offset &v1, GA_Offset &v2) const
Get the vertex offsets of the specified tri.
UT_Vector3 getPos3(GA_Size i) const
GA_Size getFaceCount() const override
The number of faces that make up this volume.
UT_Vector3D computeNormalD() const override
virtual int evaluateInteriorPointV4(UT_Vector4 &pos, fpreal u, fpreal v, fpreal w=0) const
void getEdgeIndices(GA_Size edgeno, int &e0, int &e1) const override
virtual void countMemory(UT_MemoryCounter &counter) const
static GA_Size rawVertexCount(const GA_Detail *gdp=nullptr, GA_Offset=GA_INVALID_OFFSET)
virtual const GA_PrimitiveJSON * getJSON() const =0
void computeInteriorPointWeights(UT_Array< GA_Offset > &vtxlist, UT_Array< float > &weightlist, fpreal u, fpreal v, fpreal w) const overridefinal
Provide a JSON interface to a primitive.
A handle to simplify manipulation of multiple attributes.
static GA_Offset buildBlock(GA_Detail *detail, const GA_Offset startpt, const GA_Size npoints, const GA_Size nprims, GA_PrimitiveTypeId primtype, int vertexperprim, const int *primpointnumbers)
SYS_FORCE_INLINE GA_Offset vertexPoint(GA_Offset vertex) const
Given a vertex, return the point it references.
GA_Offset getFastVertexOffset(GA_Size i) const
virtual GA_DereferenceStatus dereferencePoints(const GA_RangeMemberQuery &pt_q, bool dry_run=false)=0
int getFaceIndexCount(GA_Size faceno) const override
Returns the number of indices in specified face.
SYS_FORCE_INLINE GEO_PrimTetrahedron(GA_Detail *d, GA_Offset offset=GA_INVALID_OFFSET)
NOTE: This constructor should only be called via GU_PrimitiveFactory.
exint entries() const
Alias of size(). size() is preferred.
GA_Size getVertexCount() const
virtual bool evaluateInteriorPointRefMap(GA_Offset result_vtx, GA_AttributeRefMap &map, fpreal u, fpreal v, fpreal w=0) const
virtual int detachPoints(GA_PointGroup &grp)=0
GA_Size getFastVertexCount() const
SYS_FORCE_INLINE GEO_PrimTetrahedron(GA_Detail *gdp, GA_Offset offset, const GA_OffsetListRef &vertex_list)
SYS_FORCE_INLINE GA_Offset getFastVertexOffset(GA_Size index) const
SYS_FORCE_INLINE GA_Offset getMapOffset() const
Gets the offset of this primitive in the detail containing it.
GA_Size find(GA_Offset pt) const
SYS_FORCE_INLINE GA_Offset getVertexOffset(GA_Size primvertexnum) const
static GA_PrimitiveDefinition * theDefinition
static GA_Size rawFaceCount(const GA_Detail *gdp=nullptr, GA_Offset offset=GA_INVALID_OFFSET)
Return the topology of the tetrahedron.
SYS_FORCE_INLINE bool isFaceShared(GA_Size faceno) const
Container class for all geometry.
virtual GEO_Primitive * convert(GEO_ConvertParms &parms, GA_PointGroup *usedpts=0)=0
GLubyte GLubyte GLubyte GLubyte w
static int rawFaceIndexCount(const GA_Detail *gdp, GA_Offset offset, GA_Size faceno)
UT_Vector3 computeNormal() const override
Return a normal vector for the primitive.
Definition of a geometric primitive.
void clear()
Resets list to an empty list.
GA_Offset getPointOffset(GA_Size i) const
virtual const GA_PrimitiveDefinition & getTypeDef() const =0
GA_Offset findSharedFace(GA_Size faceno) const override
GA_Size getEdgeCount() const override
The number of edges in this volume.
virtual GEO_Primitive * convertNew(GEO_ConvertParms &parms)=0
SYS_FORCE_INLINE FromType size() const
Returns the number of used elements in the list (always <= capacity())
static SYS_FORCE_INLINE const int * fastFaceIndices(GA_Size faceno)