HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GA_Primitive Class Referenceabstract

#include <GA_Primitive.h>

+ Inheritance diagram for GA_Primitive:

Public Types

enum  GA_DereferenceStatus { GA_DEREFERENCE_FAIL, GA_DEREFERENCE_OK, GA_DEREFERENCE_DEGENERATE, GA_DEREFERENCE_DESTROY }
 

Public Member Functions

virtual ~GA_Primitive ()
 
virtual const
GA_PrimitiveDefinition
getTypeDef () const =0
 
const char * getTypeName () const
 
SYS_FORCE_INLINE GA_DetailgetDetail () const
 
SYS_FORCE_INLINE GA_Offset getMapOffset () const
 Gets the offset of this primitive in the detail containing it. More...
 
SYS_FORCE_INLINE GA_Index getMapIndex () const
 Gets the index of this primitive in the detail containing it. More...
 
SYS_FORCE_INLINE const
GA_IndexMap
getIndexMap () const
 Gets the index map for primitives in the detail containing this primitive. More...
 
GA_Index getNum () const
 
void swapOffsetValue (const GA_Defragment &defrag)
 For defragmentation, we need to update the offset. More...
 
bool isPrimary () const
 
SYS_FORCE_INLINE const
GA_PrimitiveTypeId
getTypeId () const
 
GA_PrimitiveFamilyMask getFamilyMask () const
 
bool isFamily (unsigned family_mask) const
 
bool hasLocalTransform () const
 Whether the primitive has a transform associated with it. More...
 
virtual void getLocalTransform (UT_Matrix3D &matrix) const
 
virtual void getLocalTransform4 (UT_Matrix4D &matrix) const
 
virtual void setLocalTransform (const UT_Matrix3D &matrix)
 Set the local transform. The default implementation does nothing. More...
 
virtual GA_PrimCompat::TypeMask getPrimitiveId () const
 
virtual int64 getMemoryUsage () const
 
virtual void countMemory (UT_MemoryCounter &counter) const
 
SYS_FORCE_INLINE GA_Size getVertexCount () const
 Return the number of vertices used by this primitive. More...
 
SYS_FORCE_INLINE GA_Offset getVertexOffset (GA_Size primvertexnum) const
 
SYS_FORCE_INLINE GA_Index getVertexIndex (GA_Size primvertexnum) const
 
SYS_FORCE_INLINE GA_Offset getPointOffset (GA_Size i) const
 
SYS_FORCE_INLINE void setPointOffset (GA_Size i, GA_Offset ptoff)
 
SYS_FORCE_INLINE GA_Index getPointIndex (GA_Size i) const
 
SYS_FORCE_INLINE UT_Vector3 getPos3 (GA_Size i) const
 
SYS_FORCE_INLINE void setPos3 (GA_Size i, const UT_Vector3 &pos) const
 
SYS_FORCE_INLINE UT_Vector4 getPos4 (GA_Size i) const
 
SYS_FORCE_INLINE void setPos4 (GA_Size i, const UT_Vector4 &pos) const
 
GA_Range getVertexRange (bool harden=false) const
 Get a range of all the vertices accessed by the primitive. More...
 
GA_Range getPointRange (bool harden=false) const
 
bool isPointUsed (GA_Offset ptoff) const
 
void addPointRefToGroup (GA_PointGroup &grp) const
 
virtual bool hasEdge (const GA_Edge &edge) const
 Method to determine if a primitive has an edge (undirected). More...
 
void edgeApply (GA_EdgeApplyFunc apply, void *data=nullptr) const
 
void edgeApplyIndex (GA_EdgeApplyIndexFunc apply, void *data=nullptr) const
 
virtual void iterateEdges (GA_IterateEdgesFunc apply_func) const
 
virtual void iterateEdgesByVertex (GA_IterateEdgesByVertexFunc apply_func) const
 
bool findEdgePoints (GA_Offset ptoff0, GA_Offset ptoff1, GA_Size &vtx0, GA_Size &vtx1) const
 
virtual GA_DereferenceStatus dereferencePoint (GA_Offset point, bool dry_run=false)=0
 
virtual GA_DereferenceStatus dereferencePoints (const GA_RangeMemberQuery &pt_q, bool dry_run=false)=0
 
virtual bool enlargeBoundingSphere (UT_BoundingSphere &b, const GA_Attribute *P) const
 
virtual void enlargePointBounds (UT_BoundingBox &box) const
 
virtual bool isDegenerate () const =0
 Is the primitive degenerate. More...
 
virtual void copyUnwiredForMerge (const GA_Primitive *src, const GA_MergeMap &map)
 
virtual const GA_PrimitiveJSONgetJSON () const =0
 
virtual bool saveSharedLoadData (UT_JSONWriter &w, GA_SaveMap &save, GA_GeometryIndex *geometryIndex) const
 
virtual bool registerSharedLoadData (int load_data_type, GA_SharedDataHandlePtr item)
 
virtual bool loadH9 (UT_IStream &is, const UT_Array< GA_AttribLoadDataH9 > &prim_attribs, const UT_Array< GA_AttribLoadDataH9 > &vtx_attribs)
 
virtual bool saveH9 (std::ostream &os, bool binary, const UT_Array< GA_AttribSaveDataH9 > &prim_attribs, const UT_Array< GA_AttribSaveDataH9 > &vtx_attribs) const
 
const GA_IntrinsicManagergetIntrinsicManager () const
 
virtual void clearForDeletion ()
 
virtual void getAdjacentBoundaryVertices (GA_Offset vtx, GA_Offset &prev_vtx, GA_Offset &next_vtx) const
 
virtual bool supportsHedge () const
 
virtual GA_Offset releaseVertex (GA_Offset vtx)
 
virtual int isVisible () const
 
virtual unsigned getNumSecondaryDetails () const
 A primitive may support any number of secondary details. More...
 
virtual const GA_DetailgetSecondaryDetail (GA_Index i) const
 
virtual GA_DetailgetSecondaryDetail (GA_Index i)
 
GA_Index getNumSecondary (GA_Index detail) const
 
const GA_PrimitivegetSecondaryByIndex (GA_Index detail, GA_Index i) const
 
GA_PrimitivegetSecondaryByIndex (GA_Index detail, GA_Index i)
 
const GA_PrimitivegetSecondaryByOffset (GA_Index detail, GA_Offset o) const
 
GA_PrimitivegetSecondaryByOffset (GA_Index detail, GA_Offset o)
 
SYS_FORCE_INLINE bool isVertexListTrivial () const
 
bool isPointListTrivial () const
 
template<typename FUNCTOR >
SYS_FORCE_INLINE void forEachVertex (FUNCTOR &&functor) const
 
template<typename FUNCTOR >
SYS_FORCE_INLINE void forEachPoint (FUNCTOR &&functor) const
 
bool vertexApply (bool(*apply)(GA_Offset vtx, void *), void *data=nullptr) const
 
virtual void stashed (bool beingstashed, GA_Offset offset=GA_INVALID_OFFSET)
 
virtual void flushCEWriteCaches ()
 Copy any modified caches from the GPU back to CPU cache. More...
 
virtual void flushCECaches ()
 
virtual void swapVertexOffsets (const GA_Defragment &defrag)
 
virtual bool enlargeBoundingBox (UT_BoundingRect &b, const GA_Attribute *P) const
 
virtual bool enlargeBoundingBox (UT_BoundingBox &b, const GA_Attribute *P) const
 
GA_LocalIntrinsic findIntrinsic (const char *nm) const
 
GA_LocalIntrinsic findIntrinsic (GA_GlobalIntrinsic h) const
 
GA_GlobalIntrinsic findGlobalIntrinsic (GA_LocalIntrinsic h) const
 
const char * getIntrinsicName (GA_LocalIntrinsic h) const
 
GA_Size getIntrinsicTupleSize (GA_LocalIntrinsic h) const
 
GA_StorageClass getIntrinsicStorage (GA_LocalIntrinsic h) const
 
bool getIntrinsicReadOnly (GA_LocalIntrinsic h) const
 
const UT_OptionsgetIntrinsicOptions (GA_LocalIntrinsic h) const
 
GA_Size getIntrinsic (GA_LocalIntrinsic h, UT_String &val) const
 
GA_Size getIntrinsic (GA_LocalIntrinsic h, UT_StringArray &val) const
 
GA_Size getIntrinsic (GA_LocalIntrinsic h, int64 *v, GA_Size size) const
 
GA_Size getIntrinsic (GA_LocalIntrinsic h, fpreal64 *v, GA_Size sz) const
 
bool getIntrinsic (GA_LocalIntrinsic h, float &v) const
 
bool getIntrinsic (GA_LocalIntrinsic h, int &v) const
 
bool getIntrinsic (GA_LocalIntrinsic h, UT_Vector2 &v) const
 
bool getIntrinsic (GA_LocalIntrinsic h, UT_Vector3 &v) const
 
bool getIntrinsic (GA_LocalIntrinsic h, UT_Vector4 &v) const
 
bool getIntrinsic (GA_LocalIntrinsic h, UT_Matrix2 &v) const
 
bool getIntrinsic (GA_LocalIntrinsic h, UT_Matrix3 &v) const
 
bool getIntrinsic (GA_LocalIntrinsic h, UT_Matrix4 &v) const
 
GA_Size setIntrinsic (GA_LocalIntrinsic h, const char *value)
 
GA_Size setIntrinsic (GA_LocalIntrinsic h, const UT_StringArray &value)
 
GA_Size setIntrinsic (GA_LocalIntrinsic h, const char **val, GA_Size s)
 
GA_Size setIntrinsic (GA_LocalIntrinsic h, const int64 val)
 
GA_Size setIntrinsic (GA_LocalIntrinsic h, const fpreal64 val)
 
GA_Size setIntrinsic (GA_LocalIntrinsic h, const int64 *val, GA_Size sz)
 
GA_Size setIntrinsic (GA_LocalIntrinsic h, const fpreal64 *v, GA_Size sz)
 
virtual void reverse ()=0
 
virtual fpreal calcVolume (const UT_Vector3 &refpt) const
 
virtual fpreal calcArea () const
 
virtual fpreal calcPerimeter () const
 

Static Public Member Functions

static SYS_FORCE_INLINE
GA_PrimCompat::TypeMask 
primCompatMaskFromTypeId (int type_id)
 

Protected Member Functions

SYS_FORCE_INLINE GA_Primitive (GA_Detail &detail, GA_Offset offset=GA_INVALID_OFFSET)
 
void setNumVertices (GA_Size nvertices)
 
GA_Offset allocateVertex (GA_Offset point=GA_INVALID_OFFSET)
 allocateVertex() will call wireVertex() if the point given is not -1 More...
 
void destroyVertex (GA_Offset vertex)
 
void wireVertex (GA_Offset vertex, GA_Offset point)
 
void registerVertex (GA_Offset vertex)
 
SYS_FORCE_INLINE int64 getBaseMemoryUsage () const
 Report approximate memory usage for myVertexList for subclasses. More...
 
void countBaseMemory (UT_MemoryCounter &counter) const
 
void copyVertexListForMerge (const GA_OffsetListRef &src_vertices, const GA_MergeMap &map)
 

Protected Attributes

GA_OffsetList myVertexList
 

Friends

class GA_PrimitiveList
 

Detailed Description

Member Enumeration Documentation

The return status of dereferencePoint()

  • GA_DEREFERENCE_FAIL
    The primitive cannot detach itself from the points and thus the points cannot be deleted. It's possible that the primitive may be destroyed in this case if the user specified this behaviour (see GA_Detail::GA_DestroyPointMode).
  • GA_DEREFERENCE_OK
    The primitive has detached the points and is still valid.
  • GA_DEREFERENCE_DEGENERATE
    The primitive has detached the points but is now degenerate.
  • GA_DEREFERENCE_DESTROY
    The primitive has detached the points and should now be destroyed.
Enumerator
GA_DEREFERENCE_FAIL 
GA_DEREFERENCE_OK 
GA_DEREFERENCE_DEGENERATE 
GA_DEREFERENCE_DESTROY 
Examples:
tetprim/GEO_PrimTetra.h.

Definition at line 376 of file GA_Primitive.h.

Constructor & Destructor Documentation

SYS_FORCE_INLINE GA_Primitive::GA_Primitive ( GA_Detail detail,
GA_Offset  offset = GA_INVALID_OFFSET 
)
inlineprotected

NOTE: The constructor should only be called from subclass constructors.

Definition at line 108 of file GA_Primitive.h.

virtual GA_Primitive::~GA_Primitive ( )
inlinevirtual

NOTE: The destructor should only be called from subclass destructors; only GA_PrimitiveList should be calling delete on GA_Primitive pointers.

Definition at line 117 of file GA_Primitive.h.

Member Function Documentation

void GA_Primitive::addPointRefToGroup ( GA_PointGroup grp) const

Add all points referenced by the primitive to the given group. This defaults to iterating over the vertices and adding their referenced points.

Examples:
tetprim/GEO_PrimTetra.C.
GA_Offset GA_Primitive::allocateVertex ( GA_Offset  point = GA_INVALID_OFFSET)
protected

allocateVertex() will call wireVertex() if the point given is not -1

virtual fpreal GA_Primitive::calcPerimeter ( ) const
inlinevirtual
virtual void GA_Primitive::clearForDeletion ( )
inlinevirtual

Private interface The clearForDeletion() method is called just prior to the detail being cleared out. This allows the primitive to simplify its data structures, knowing that topology doesn't need to be maintained (i.e. unwiring all vertices);

Reimplemented in GEO_PrimVolume, GEO_Hull, GEO_PrimVDB, GEO_Quadric, GEO_TriMesh, GEO_PrimParticle, GEO_PrimTriBezier, GEO_PrimPasteDAG, GD_Face, and GEO_TPSurf.

Definition at line 595 of file GA_Primitive.h.

virtual void GA_Primitive::copyUnwiredForMerge ( const GA_Primitive src,
const GA_MergeMap map 
)
virtual

Copy the specified primitive as part of the merge. The source primitive will be of the same type.

Since the vertex offsets will change for the merged geometry, the map should be used to lookup the new vertex offsets. For example

map.mapDestFromSource( GA_ATTRIB_VERTEX, source_vertex );
See Also
GA_MergeMap

Reimplemented in GEO_PrimPolySoup, GEO_PrimVolume, GEO_Hull, GEO_PrimParticle, GEO_PrimVDB, GEO_PrimPasteDAG, GEO_PrimTube, GD_Face, GEO_Quadric, GEO_PrimTriBezier, GEO_TriMesh, GEO_TPSurf, GEO_Face, GD_Curve, GEO_Curve, HDK_Sample::GEO_PrimTetra, GEO_PrimNull, GEO_PrimPacked, GEO_PrimMetaBall, and GEO_PrimMetaSQuad.

Examples:
tetprim/GEO_PrimTetra.C.
void GA_Primitive::copyVertexListForMerge ( const GA_OffsetListRef src_vertices,
const GA_MergeMap map 
)
protected

This is the implementation of this level of copyUnwiredForMerge, and enables GA_PrimitiveList to set the vertex list without a source primitive.

void GA_Primitive::countBaseMemory ( UT_MemoryCounter counter) const
protected

This is called by the subclasses to count the memory used by myVertexList

Examples:
tetprim/GEO_PrimTetra.C.
void GA_Primitive::destroyVertex ( GA_Offset  vertex)
protected
void GA_Primitive::edgeApply ( GA_EdgeApplyFunc  apply,
void data = nullptr 
) const

Calls apply for each directed edge in this primitive

Deprecated:
Use iterateEdges instead.
void GA_Primitive::edgeApplyIndex ( GA_EdgeApplyIndexFunc  apply,
void data = nullptr 
) const

Calls apply for each directed edge in this primitive

Deprecated:
Use iterateEdgesByVertex instead.
virtual bool GA_Primitive::enlargeBoundingBox ( UT_BoundingRect b,
const GA_Attribute P 
) const
virtual

Enlarge a bounding box by the bounding box of the primitive. A return value of false indicates an error in the operation, most likely an invalid P. By default, these methods simply enlarge the bounding box based on the vertices.

Reimplemented in GEO_PrimVDB, GEO_PrimVolume, GEO_Primitive, GEO_PrimParticle, GEO_PrimPasteDAG, and GEO_Quadric.

virtual bool GA_Primitive::enlargeBoundingBox ( UT_BoundingBox b,
const GA_Attribute P 
) const
virtual

Enlarge a bounding box by the bounding box of the primitive. A return value of false indicates an error in the operation, most likely an invalid P. By default, these methods simply enlarge the bounding box based on the vertices.

Reimplemented in GEO_PrimVDB, GEO_PrimVolume, GEO_Primitive, GEO_PrimParticle, GEO_PrimPasteDAG, and GEO_Quadric.

virtual bool GA_Primitive::enlargeBoundingSphere ( UT_BoundingSphere b,
const GA_Attribute P 
) const
virtual

Enlarge a bounding sphere to encompass the primitive. A return value of false indicates an error in the operation, most likely an invalid P. By default, this method simply enlarges the bounding box based on the vertices.

Reimplemented in GEO_PrimVDB, GEO_PrimVolume, GEO_PrimParticle, GEO_PrimPasteDAG, and GEO_Quadric.

virtual void GA_Primitive::enlargePointBounds ( UT_BoundingBox box) const
virtual

Enlarge a point bounding box for implicit primitive bounds. If a primitive (such as a sphere) has a bounding box larger than its point hull, then it should implement this method. Otherwise, it can rely on the default behaviour.

Reimplemented in GEO_PrimVDB, GEO_PrimVolume, GEO_Quadric, and GEO_PrimPacked.

bool GA_Primitive::findEdgePoints ( GA_Offset  ptoff0,
GA_Offset  ptoff1,
GA_Size vtx0,
GA_Size vtx1 
) const

Calls edgeApplyIndex to find the vertices within this primitive, corresponding with the first undirected edge between ptoff0 and ptoff1. If the edge is not in this primitive, vtx0 and vtx1 will not be written-to, and the function will return false. When written, vtx0->vtx1 will always be the direction the edge appears in this primitive, which may be opposite ptoff0->ptoff1.

GA_GlobalIntrinsic GA_Primitive::findGlobalIntrinsic ( GA_LocalIntrinsic  h) const
inline

Query properties of the primitive intrinsic. Note that the tuple size calls the virtual method since the tuple size may be dynamic (i.e. basis knot vector)

Definition at line 540 of file GA_Primitive.h.

GA_LocalIntrinsic GA_Primitive::findIntrinsic ( const char *  nm) const
inline

Query properties of the primitive intrinsic. Note that the tuple size calls the virtual method since the tuple size may be dynamic (i.e. basis knot vector)

Definition at line 536 of file GA_Primitive.h.

GA_LocalIntrinsic GA_Primitive::findIntrinsic ( GA_GlobalIntrinsic  h) const
inline

Query properties of the primitive intrinsic. Note that the tuple size calls the virtual method since the tuple size may be dynamic (i.e. basis knot vector)

Definition at line 538 of file GA_Primitive.h.

virtual void GA_Primitive::flushCECaches ( )
inlinevirtual

Copy any modified caches from the GPU to CPU. Then delete the GPU cache.

Reimplemented in GEO_PrimVolume.

Definition at line 724 of file GA_Primitive.h.

virtual void GA_Primitive::flushCEWriteCaches ( )
inlinevirtual

Copy any modified caches from the GPU back to CPU cache.

Reimplemented in GEO_PrimVolume.

Definition at line 720 of file GA_Primitive.h.

template<typename FUNCTOR >
SYS_FORCE_INLINE void GA_Primitive::forEachPoint ( FUNCTOR &&  functor) const
inline

Calls a functor (e.g. a lambda) for each point offset in this primitive, in the order they occur in the vertex list. This is optimized to only check triviality once and only look up the vertex-to-point topology attribute once.

Definition at line 688 of file GA_Primitive.h.

template<typename FUNCTOR >
SYS_FORCE_INLINE void GA_Primitive::forEachVertex ( FUNCTOR &&  functor) const
inline

Calls a functor (e.g. a lambda) for each vertex offset in this primitive, in the order they occur in the vertex list. This is optimized to only check triviality once.

Definition at line 677 of file GA_Primitive.h.

virtual void GA_Primitive::getAdjacentBoundaryVertices ( GA_Offset  vtx,
GA_Offset prev_vtx,
GA_Offset next_vtx 
) const
inlinevirtual

Return the next and previous vertex on the "boundary" of the primitive (as understood by the primitive) relative to a given vertex. These are needed to maintain half-edge topology attributes. They must be implemented for primitives that realize a notion of a boundary composed of one or more closed cycles of vertices if we want to be able to use hedges to quickly move from such a primitive to another sharing an edge with it. A GA_INVALID_OFFSET for prev_vtx or next_vtx means that either the primitive doesn't care about hedges, the input vertex is not a boundary vertex in the primitive (or not a vertex at all), or vtx is at an end of a boundary (e.g. open polys).

Reimplemented in GEO_PrimPoly.

Definition at line 607 of file GA_Primitive.h.

SYS_FORCE_INLINE int64 GA_Primitive::getBaseMemoryUsage ( ) const
inlineprotected

Report approximate memory usage for myVertexList for subclasses.

Examples:
tetprim/GEO_PrimTetra.C.

Definition at line 750 of file GA_Primitive.h.

SYS_FORCE_INLINE GA_Detail& GA_Primitive::getDetail ( ) const
inline

Gets the detail containing this primitive.

FIXME: This should return a const detail, and a non-const version should return a non-const detail.

Examples:
standalone/geo2voxel.C.

Definition at line 133 of file GA_Primitive.h.

GA_PrimitiveFamilyMask GA_Primitive::getFamilyMask ( ) const
inline

Definition at line 171 of file GA_Primitive.h.

SYS_FORCE_INLINE const GA_IndexMap& GA_Primitive::getIndexMap ( ) const
inline

Gets the index map for primitives in the detail containing this primitive.

Definition at line 148 of file GA_Primitive.h.

GA_Size GA_Primitive::getIntrinsic ( GA_LocalIntrinsic  h,
UT_String val 
) const

Get the value of a primitive intrinsic. These methods return the number of items retrieved.

GA_Size GA_Primitive::getIntrinsic ( GA_LocalIntrinsic  h,
UT_StringArray val 
) const

Get the value of a primitive intrinsic. These methods return the number of items retrieved.

GA_Size GA_Primitive::getIntrinsic ( GA_LocalIntrinsic  h,
int64 v,
GA_Size  size 
) const

Get the value of a primitive intrinsic. These methods return the number of items retrieved.

GA_Size GA_Primitive::getIntrinsic ( GA_LocalIntrinsic  h,
fpreal64 v,
GA_Size  sz 
) const

Get the value of a primitive intrinsic. These methods return the number of items retrieved.

bool GA_Primitive::getIntrinsic ( GA_LocalIntrinsic  h,
float &  v 
) const

Get the value of a primitive intrinsic. Returns false if not the right type or not found. Always will clear out the provided value.

bool GA_Primitive::getIntrinsic ( GA_LocalIntrinsic  h,
int v 
) const

Get the value of a primitive intrinsic. Returns false if not the right type or not found. Always will clear out the provided value.

bool GA_Primitive::getIntrinsic ( GA_LocalIntrinsic  h,
UT_Vector2 v 
) const

Get the value of a primitive intrinsic. Returns false if not the right type or not found. Always will clear out the provided value.

bool GA_Primitive::getIntrinsic ( GA_LocalIntrinsic  h,
UT_Vector3 v 
) const

Get the value of a primitive intrinsic. Returns false if not the right type or not found. Always will clear out the provided value.

bool GA_Primitive::getIntrinsic ( GA_LocalIntrinsic  h,
UT_Vector4 v 
) const

Get the value of a primitive intrinsic. Returns false if not the right type or not found. Always will clear out the provided value.

bool GA_Primitive::getIntrinsic ( GA_LocalIntrinsic  h,
UT_Matrix2 v 
) const

Get the value of a primitive intrinsic. Returns false if not the right type or not found. Always will clear out the provided value.

bool GA_Primitive::getIntrinsic ( GA_LocalIntrinsic  h,
UT_Matrix3 v 
) const

Get the value of a primitive intrinsic. Returns false if not the right type or not found. Always will clear out the provided value.

bool GA_Primitive::getIntrinsic ( GA_LocalIntrinsic  h,
UT_Matrix4 v 
) const

Get the value of a primitive intrinsic. Returns false if not the right type or not found. Always will clear out the provided value.

const GA_IntrinsicManager& GA_Primitive::getIntrinsicManager ( ) const
inline

Get the intrinsic manager for primitive intrinsics. All primitives have at least the following intrinsics:

  • "string typename"
    The type name of the primitive
  • "int typeid"
    The type id (may change per run)
  • "int vertexcount"
    The number of vertices in the primitive

Definition at line 529 of file GA_Primitive.h.

const char* GA_Primitive::getIntrinsicName ( GA_LocalIntrinsic  h) const
inline

Query properties of the primitive intrinsic. Note that the tuple size calls the virtual method since the tuple size may be dynamic (i.e. basis knot vector)

Definition at line 543 of file GA_Primitive.h.

const UT_Options* GA_Primitive::getIntrinsicOptions ( GA_LocalIntrinsic  h) const
inline

Query properties of the primitive intrinsic. Note that the tuple size calls the virtual method since the tuple size may be dynamic (i.e. basis knot vector)

Definition at line 550 of file GA_Primitive.h.

bool GA_Primitive::getIntrinsicReadOnly ( GA_LocalIntrinsic  h) const
inline

Query properties of the primitive intrinsic. Note that the tuple size calls the virtual method since the tuple size may be dynamic (i.e. basis knot vector)

Definition at line 548 of file GA_Primitive.h.

GA_StorageClass GA_Primitive::getIntrinsicStorage ( GA_LocalIntrinsic  h) const
inline

Query properties of the primitive intrinsic. Note that the tuple size calls the virtual method since the tuple size may be dynamic (i.e. basis knot vector)

Definition at line 546 of file GA_Primitive.h.

GA_Size GA_Primitive::getIntrinsicTupleSize ( GA_LocalIntrinsic  h) const

Query properties of the primitive intrinsic. Note that the tuple size calls the virtual method since the tuple size may be dynamic (i.e. basis knot vector)

virtual const GA_PrimitiveJSON* GA_Primitive::getJSON ( ) const
pure virtual

This method returns the JSON interface for saving/loading the primitive If the method returns a NULL pointer, then the primitive will not be saved to geometry files (and thus cannot be loaded).

Implemented in GEO_PrimVolume, GEO_PrimPolySoup, GEO_PrimNURBCurve, GEO_PrimNURBSurf, GEO_PrimVDB, GEO_PrimRBezSurf, GEO_PrimTetrahedron, GEO_PrimParticle, GEO_PrimRBezCurve, GEO_PrimTriBezier, GEO_PrimPasteDAG, GEO_PrimTube, GEO_PrimPoly, GEO_PrimMesh, HDK_Sample::GEO_PrimTetra, GEO_PrimTriStrip, GEO_PrimMetaSQuad, GEO_PrimPacked, GEO_PrimMetaBall, GEO_PrimNull, GEO_PrimCircle, GEO_PrimSphere, GEO_PrimTriFan, GD_Curve, and GD_PrimPoly.

virtual void GA_Primitive::getLocalTransform ( UT_Matrix3D matrix) const
virtual

Return the local transform matrix for the primitive. Some primitives don't store transforms (see hasLocalTransform()). The default behaviour is to make the transform an identity.

Reimplemented in GEO_PrimVolume, GEO_PrimVDB, GEO_Quadric, and GEO_PrimPacked.

virtual void GA_Primitive::getLocalTransform4 ( UT_Matrix4D matrix) const
virtual

Return the local transform matrix for the primitive, but with the translates specified by the position of the first vertex of the primitive. This only includes the local transform and the translate due to the point position.

SYS_FORCE_INLINE GA_Index GA_Primitive::getMapIndex ( ) const
inline

Gets the index of this primitive in the detail containing it.

Examples:
field3d/f3d_io.C, SOP/SOP_PrimVOP.C, and standalone/geo2voxel.C.

Definition at line 143 of file GA_Primitive.h.

SYS_FORCE_INLINE GA_Offset GA_Primitive::getMapOffset ( ) const
inline

Gets the offset of this primitive in the detail containing it.

Examples:
field3d/f3d_io.C, RAY/RAY_DemoMountain.C, RAY/RAY_DemoSprite.C, SIM/SIM_ForceOrbit.C, standalone/geo2voxel.C, and tetprim/GEO_PrimTetra.C.

Definition at line 138 of file GA_Primitive.h.

GA_Index GA_Primitive::getNum ( ) const
inline

Definition at line 152 of file GA_Primitive.h.

GA_Index GA_Primitive::getNumSecondary ( GA_Index  detail) const
virtual unsigned GA_Primitive::getNumSecondaryDetails ( ) const
virtual

A primitive may support any number of secondary details.

Reimplemented in GEO_TPSurf.

SYS_FORCE_INLINE GA_Index GA_Primitive::getPointIndex ( GA_Size  i) const
inline

Given a vertex number (into the primitive's vertex list), return its point index number.

Definition at line 260 of file GA_Primitive.h.

SYS_FORCE_INLINE GA_Offset GA_Primitive::getPointOffset ( GA_Size  i) const
inline

Given a vertex number (into the primitive's vertex list), return the point offset.

Examples:
packedshareddata/packedshareddata.C, packedsphere/packedsphere.C, SIM/SIM_SolverHair.C, tetprim/GEO_PrimTetra.C, tetprim/GEO_PrimTetra.h, and tetprim/SOP_Tetra.C.

Definition at line 246 of file GA_Primitive.h.

GA_Range GA_Primitive::getPointRange ( bool  harden = false) const
inline

Get a range of all the points accessed by the primitive. Note, the range may visit points multiple times.

Definition at line 296 of file GA_Primitive.h.

SYS_FORCE_INLINE UT_Vector3 GA_Primitive::getPos3 ( GA_Size  i) const
inline

Given a vertex number (into the primitive's vertex list), return its point's position.

Examples:
tetprim/GEO_PrimTetra.C.

Definition at line 266 of file GA_Primitive.h.

SYS_FORCE_INLINE UT_Vector4 GA_Primitive::getPos4 ( GA_Size  i) const
inline

Given a vertex number (into the primitive's vertex list), return its point's position.

Definition at line 278 of file GA_Primitive.h.

virtual GA_PrimCompat::TypeMask GA_Primitive::getPrimitiveId ( ) const
inlinevirtual
Deprecated:
This method is only for transitional backward compatibility for the HDK and will be removed in a future release. TODO: Should be pure virtual here, overwritten at GEO_Primitive.

Reimplemented in GEO_Primitive, and GD_Primitive.

Definition at line 196 of file GA_Primitive.h.

const GA_Primitive* GA_Primitive::getSecondaryByIndex ( GA_Index  detail,
GA_Index  i 
) const
GA_Primitive* GA_Primitive::getSecondaryByIndex ( GA_Index  detail,
GA_Index  i 
)
const GA_Primitive* GA_Primitive::getSecondaryByOffset ( GA_Index  detail,
GA_Offset  o 
) const
GA_Primitive* GA_Primitive::getSecondaryByOffset ( GA_Index  detail,
GA_Offset  o 
)
virtual const GA_Detail* GA_Primitive::getSecondaryDetail ( GA_Index  i) const
virtual

Reimplemented in GEO_TPSurf.

virtual GA_Detail* GA_Primitive::getSecondaryDetail ( GA_Index  i)
virtual

Reimplemented in GEO_TPSurf.

const char* GA_Primitive::getTypeName ( ) const
inline

Definition at line 125 of file GA_Primitive.h.

SYS_FORCE_INLINE GA_Size GA_Primitive::getVertexCount ( ) const
inline

Return the number of vertices used by this primitive.

Examples:
SIM/SIM_SolverHair.C, and tetprim/GEO_PrimTetra.C.

Definition at line 224 of file GA_Primitive.h.

SYS_FORCE_INLINE GA_Index GA_Primitive::getVertexIndex ( GA_Size  primvertexnum) const
inline

Definition at line 238 of file GA_Primitive.h.

SYS_FORCE_INLINE GA_Offset GA_Primitive::getVertexOffset ( GA_Size  primvertexnum) const
inline

Given an vertex number (into the primitive's vertex list), return the vertex offset.

Examples:
tetprim/GEO_PrimTetra.C, tetprim/GEO_PrimTetra.h, tetprim/GR_PrimTetra.C, and tetprim/GT_PrimTetra.C.

Definition at line 232 of file GA_Primitive.h.

GA_Range GA_Primitive::getVertexRange ( bool  harden = false) const
inline

Get a range of all the vertices accessed by the primitive.

Definition at line 288 of file GA_Primitive.h.

virtual bool GA_Primitive::hasEdge ( const GA_Edge edge) const
virtual

Method to determine if a primitive has an edge (undirected).

Reimplemented in GEO_Hull, GEO_PrimPolySoup, GEO_Face, GEO_Primitive, and GEO_PrimTetrahedron.

bool GA_Primitive::hasLocalTransform ( ) const
inline

Whether the primitive has a transform associated with it.

Definition at line 177 of file GA_Primitive.h.

bool GA_Primitive::isFamily ( unsigned  family_mask) const
inline

Definition at line 173 of file GA_Primitive.h.

bool GA_Primitive::isPointListTrivial ( ) const

A trivial point list is doubly-trivial: getPointOffset(i) == getPointOffset(0) + i This requires testing every point so is slower than isVertexListTrivial.

bool GA_Primitive::isPointUsed ( GA_Offset  ptoff) const
inline

Return whether a point is referenced by a primitive. This simply iterates over the vertices, checking if any vertices reference the point.

Definition at line 306 of file GA_Primitive.h.

bool GA_Primitive::isPrimary ( void  ) const
inline

Returns true if the primitive is part of a 3D geometry detail (GEO_Detail), and false if it is part of a 2D geometry detail (GD_Detail) for trim/projection curves.

Definition at line 161 of file GA_Primitive.h.

SYS_FORCE_INLINE bool GA_Primitive::isVertexListTrivial ( ) const
inline

A trivial vertex list is a uniform ascending list, so getFastVertexOffset(i) == getFastVertexOffset(0) + i

Definition at line 666 of file GA_Primitive.h.

virtual int GA_Primitive::isVisible ( ) const
virtual

Backward compatible methods for GD library Determine whether the primitive is visisble on the interval of the parent surface. Partial visiblity should return true as well.

Returns
  • 0: Not visible on parent surface
  • 1: Full visibility (default)
  • 2: Partial visibility

Reimplemented in GD_Face.

virtual void GA_Primitive::iterateEdges ( GA_IterateEdgesFunc  apply_func) const
inlinevirtual

Calls apply_func for each directed edge on the primitive. If the apply_func function returns false, then the traversal will be stopped.

Reimplemented in GEO_Hull, GEO_PrimPolySoup, GEO_Face, and GEO_PrimTetrahedron.

Definition at line 339 of file GA_Primitive.h.

virtual void GA_Primitive::iterateEdgesByVertex ( GA_IterateEdgesByVertexFunc  apply_func) const
inlinevirtual

Calls apply_func for each directed edge on the primitive, passing in the GA_Size primitive vertex index for each point on the edge. If the apply_func function returns false, then the traversal will be stopped.

Reimplemented in GEO_Hull, GEO_PrimPolySoup, GEO_Face, and GEO_PrimTetrahedron.

Definition at line 349 of file GA_Primitive.h.

virtual bool GA_Primitive::loadH9 ( UT_IStream is,
const UT_Array< GA_AttribLoadDataH9 > &  prim_attribs,
const UT_Array< GA_AttribLoadDataH9 > &  vtx_attribs 
)
virtual
static SYS_FORCE_INLINE GA_PrimCompat::TypeMask GA_Primitive::primCompatMaskFromTypeId ( int  type_id)
inlinestatic

Definition at line 728 of file GA_Primitive.h.

virtual bool GA_Primitive::registerSharedLoadData ( int  load_data_type,
GA_SharedDataHandlePtr  item 
)
virtual

Reimplemented in GEO_PrimVolume, GEO_PrimPacked, and GU_PrimPacked.

void GA_Primitive::registerVertex ( GA_Offset  vertex)
protected

Create the topological binding between preallocated vertex and primitive.

virtual GA_Offset GA_Primitive::releaseVertex ( GA_Offset  vtx)
inlinevirtual

Release the given vertex. This is equivalent to deleting a vertex without modifying its topology attributes. In other words, the primitive doesn't use the vertex anymore, but the vertex stays wired to the primitive and to the point it was wired to. The intended use is with stealVertex methods, so that the same vertex can be aquired by another primitive, thus maintaining its offset number and attributes The return value is the vertex offset (same as input) if successful and GA_INVALID_OFFSET otherwise.

Reimplemented in GEO_TriMesh.

Definition at line 625 of file GA_Primitive.h.

virtual bool GA_Primitive::saveH9 ( std::ostream &  os,
bool  binary,
const UT_Array< GA_AttribSaveDataH9 > &  prim_attribs,
const UT_Array< GA_AttribSaveDataH9 > &  vtx_attribs 
) const
virtual
virtual bool GA_Primitive::saveSharedLoadData ( UT_JSONWriter w,
GA_SaveMap save,
GA_GeometryIndex geometryIndex 
) const
virtual

Some primitives can have common/shared data between different instances of the primitives. This method is invoked during the save process to save data. The method requires you to save two objects sequentially (the data is stored in a list) for each shared key:

  • The primitive typedef name. This is used at load time to find the definition which knows how to load the data.
  • The data required to represent the shared object. This is typically a list or map containing the type of data, the key value (used for loading) and the actual object data.

If there are multiple shared data pointers, the array can continue with name/value pairs.

For example, you might have something like:

const char *key = makeKeyForSharedPtr(ptr);
bool ok = true;
if (!save.hasSavedSharedData(key))
{
save.setSavedSharedData(key); // Flag this data as saved
ok = ok && w.jsonStringToken(getTypeName());
ok = ok && w.jsonBeginArray();
ok = ok && w.jsonStringToken("datatype");
ok = ok && w.jsonStringToken(key);
ok = ok && saveSharedData(ptr);
ok = ok && w.jsonEndArray();
}
return ok;

Then in the primitive JSON, you'd likely want to have two fields, one for the shared data pointer, the other for an expanded version of the data. The shouldSaveField() method would be something like:

if (index == SHARED_DATA_KEY)
return save.hasSavedSharedData(key);
if (index == EXPANDED_DATA_KEY)
return !save.hasSavedSharedData(key);

Then the saveField() method of the primitive JSON would look something like:

switch (index)
{
case SHARED_DATA_KEY:
UT_ASSERT(save.hasSaveSharedData(key));
return w.jsonString(key);
case EXPANDED_DATA_KEY:
UT_ASSERT(!save.hasSaveSharedData(key));
return saveSharedData(ptr);
}

During the loading process, you can just get the shared data from the load map.

MySharedDataContainer *data;
data = load.sharedLoadDataAs<MySharedDataContainer>(key);
if (data)
setSharedPointer(data->getSharedData();
else
return false;

Reimplemented in GEO_PrimVolume, GEO_PrimPacked, and GU_PrimPacked.

GA_Size GA_Primitive::setIntrinsic ( GA_LocalIntrinsic  h,
const char *  value 
)

Set intrinsic attributes. This will fail if the intrinsic is read-only. These methods return the number of items set.

GA_Size GA_Primitive::setIntrinsic ( GA_LocalIntrinsic  h,
const UT_StringArray value 
)

Set intrinsic attributes. This will fail if the intrinsic is read-only. These methods return the number of items set.

GA_Size GA_Primitive::setIntrinsic ( GA_LocalIntrinsic  h,
const char **  val,
GA_Size  s 
)

Set intrinsic attributes. This will fail if the intrinsic is read-only. These methods return the number of items set.

GA_Size GA_Primitive::setIntrinsic ( GA_LocalIntrinsic  h,
const int64  val 
)

Set intrinsic attributes. This will fail if the intrinsic is read-only. These methods return the number of items set.

GA_Size GA_Primitive::setIntrinsic ( GA_LocalIntrinsic  h,
const fpreal64  val 
)

Set intrinsic attributes. This will fail if the intrinsic is read-only. These methods return the number of items set.

GA_Size GA_Primitive::setIntrinsic ( GA_LocalIntrinsic  h,
const int64 val,
GA_Size  sz 
)

Set intrinsic attributes. This will fail if the intrinsic is read-only. These methods return the number of items set.

GA_Size GA_Primitive::setIntrinsic ( GA_LocalIntrinsic  h,
const fpreal64 v,
GA_Size  sz 
)

Set intrinsic attributes. This will fail if the intrinsic is read-only. These methods return the number of items set.

virtual void GA_Primitive::setLocalTransform ( const UT_Matrix3D matrix)
virtual

Set the local transform. The default implementation does nothing.

Reimplemented in GEO_PrimVolume, GEO_PrimVDB, GEO_Quadric, and GEO_PrimPacked.

void GA_Primitive::setNumVertices ( GA_Size  nvertices)
protected
SYS_FORCE_INLINE void GA_Primitive::setPointOffset ( GA_Size  i,
GA_Offset  ptoff 
)
inline

Given a vertex number (into the primitive's vertex list), set the corresponding point offset.

Examples:
SIM/SNOW_Solver.C, and tetprim/GEO_PrimTetra.C.

Definition at line 252 of file GA_Primitive.h.

SYS_FORCE_INLINE void GA_Primitive::setPos3 ( GA_Size  i,
const UT_Vector3 pos 
) const
inline

Given a vertex number (into the primitive's vertex list), move the point to the specified position.

Definition at line 272 of file GA_Primitive.h.

SYS_FORCE_INLINE void GA_Primitive::setPos4 ( GA_Size  i,
const UT_Vector4 pos 
) const
inline

Given a vertex number (into the primitive's vertex list), move the point to the specified position.

Definition at line 284 of file GA_Primitive.h.

virtual void GA_Primitive::stashed ( bool  beingstashed,
GA_Offset  offset = GA_INVALID_OFFSET 
)
virtual

Stash (deactivate) or unstash (reactivate) the primitive.

Stashing a primitive will set its offset to that specified, typically GA_INVALID_OFFSET. Primitives are only stashed as part of clearing a detail, so there is no need to explicitly deallocate vertices. It is safe to delete a stashed primitive.

Unstashing a primitive will re-register that primitive with its parent detail at the specified offset (or a new offset if GA_INVALID_OFFSET).

Reimplemented in GEO_Hull, GEO_TPSurf, GEO_PrimVolume, GEO_Quadric, GEO_PrimParticle, GEO_TriMesh, GEO_PrimPolySoup, GEO_PrimPasteDAG, GEO_PrimTriBezier, HDK_Sample::GEO_PrimTetra, GU_PrimPacked, and GEO_PrimPacked.

Examples:
tetprim/GEO_PrimTetra.C.
virtual bool GA_Primitive::supportsHedge ( ) const
inlinevirtual

Primitives that implement getAdjacentBoundaryVertices must respond true to supportsHedge().

Reimplemented in GEO_PrimPoly.

Definition at line 614 of file GA_Primitive.h.

void GA_Primitive::swapOffsetValue ( const GA_Defragment defrag)

For defragmentation, we need to update the offset.

virtual void GA_Primitive::swapVertexOffsets ( const GA_Defragment defrag)
virtual

This method is called when the vertex index map is being defragmented. Since the defragmentation process moves vertex offsets, primitives need to update their references with the new values.

new_vtx_offset = defrag.mapOffset(new_vtx_offset);
myOffsetList.swapOffsetValues(defrag);
myOffsetMatrix.swapOffsetValues(defrag);

Reimplemented in GEO_Hull, GEO_PrimVolume, GEO_PrimPolySoup, GEO_Quadric, GEO_TriMesh, GD_Face, GEO_PrimParticle, GEO_PrimVDB, GEO_PrimTriBezier, GEO_PrimPasteDAG, and GEO_PrimNull.

bool GA_Primitive::vertexApply ( bool(*)(GA_Offset vtx, void *)  apply,
void data = nullptr 
) const
inline

Definition at line 696 of file GA_Primitive.h.

void GA_Primitive::wireVertex ( GA_Offset  vertex,
GA_Offset  point 
)
protected

Friends And Related Function Documentation

friend class GA_PrimitiveList
friend

Definition at line 786 of file GA_Primitive.h.

Member Data Documentation

GA_OffsetList GA_Primitive::myVertexList
protected
Examples:
tetprim/GEO_PrimTetra.C.

Definition at line 791 of file GA_Primitive.h.


The documentation for this class was generated from the following file: