HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GT_CountArray Class Reference

#include <GT_CountArray.h>

Public Member Functions

 GT_CountArray ()
 
 GT_CountArray (const GT_CountArray &src)
 
 GT_CountArray (const GT_DataArrayHandle &counts, GT_Size mincount=0, GT_Size maxcount=0)
 
exint getMemoryUsage () const
 Return memory used. More...
 
void harden ()
 harden the data array More...
 
void clear ()
 Clear the count array. More...
 
GT_Storage getStorage () const
 Return the storage type. More...
 
void init (const GT_DataArrayHandle &counts, GT_Size mincount=0, GT_Size maxcount=0)
 Initialize given an array of counts. More...
 
void init (exint entries, exint repeated_value)
 
GT_Size entries () const
 
GT_Offset getOffset (exint idx) const
 
GT_Size getCount (exint idx) const
 
bool isEqual (const GT_CountArray &other) const
 Test equality. More...
 
bool operator== (const GT_CountArray &other) const
 
bool operator!= (const GT_CountArray &other) const
 
GT_Size getMinCount () const
 Return the minimum value that getCount() can return. More...
 
GT_Size getMaxCount () const
 Return the maximum value that getCount() can return. More...
 
GT_Size sumCounts () const
 Return the sum of all the counts. More...
 
GT_DataArrayHandle extractCounts () const
 
GT_DataArrayHandle extractOffsets () const
 
GT_DataArrayHandle buildRepeatList () const
 Creates a list of {0,0,0, 1,1,1,1,1, 2,2} from {3,5,2}. More...
 
bool save (UT_JSONWriter &w) const
 

Detailed Description

A count/offset array

In a polygon mesh, there is a list of faces. Each face has a number of vertices and a list of vertices. Thus, for each polygon, there's an offset into the vertex array and a count of the number of vertices to extract. This array manages those offsets/counts efficiently For example, if there are counts [3, 4, 2], the corresponding offset array would be [0, 3, 7]. Thus:

counts.getOffset(0) == 0;
counts.getOffset(1) == 3;
counts.getOffset(2) == 7;
counts.getCount(0) == 3;
counts.getCount(1) == 4;
counts.getCount(2) == 2;

Definition at line 35 of file GT_CountArray.h.

Constructor & Destructor Documentation

GT_CountArray::GT_CountArray ( )
inline

Definition at line 38 of file GT_CountArray.h.

GT_CountArray::GT_CountArray ( const GT_CountArray src)
inline

Definition at line 44 of file GT_CountArray.h.

GT_CountArray::GT_CountArray ( const GT_DataArrayHandle counts,
GT_Size  mincount = 0,
GT_Size  maxcount = 0 
)
inline

Definition at line 50 of file GT_CountArray.h.

Member Function Documentation

GT_DataArrayHandle GT_CountArray::buildRepeatList ( ) const

Creates a list of {0,0,0, 1,1,1,1,1, 2,2} from {3,5,2}.

void GT_CountArray::clear ( void  )
inline

Clear the count array.

Definition at line 63 of file GT_CountArray.h.

GT_Size GT_CountArray::entries ( void  ) const
inline

Definition at line 82 of file GT_CountArray.h.

GT_DataArrayHandle GT_CountArray::extractCounts ( ) const
GT_DataArrayHandle GT_CountArray::extractOffsets ( ) const
GT_Size GT_CountArray::getCount ( exint  idx) const
inline

Definition at line 85 of file GT_CountArray.h.

GT_Size GT_CountArray::getMaxCount ( ) const
inline

Return the maximum value that getCount() can return.

Definition at line 113 of file GT_CountArray.h.

exint GT_CountArray::getMemoryUsage ( ) const

Return memory used.

GT_Size GT_CountArray::getMinCount ( ) const
inline

Return the minimum value that getCount() can return.

Definition at line 111 of file GT_CountArray.h.

GT_Offset GT_CountArray::getOffset ( exint  idx) const
inline

Definition at line 83 of file GT_CountArray.h.

GT_Storage GT_CountArray::getStorage ( ) const
inline

Return the storage type.

Definition at line 70 of file GT_CountArray.h.

void GT_CountArray::harden ( )

harden the data array

void GT_CountArray::init ( const GT_DataArrayHandle counts,
GT_Size  mincount = 0,
GT_Size  maxcount = 0 
)

Initialize given an array of counts.

void GT_CountArray::init ( exint  entries,
exint  repeated_value 
)

Initialize when you know that there are entries that are all the same repeated_value.

bool GT_CountArray::isEqual ( const GT_CountArray other) const
inline

Test equality.

Definition at line 94 of file GT_CountArray.h.

bool GT_CountArray::operator!= ( const GT_CountArray other) const
inline

Definition at line 107 of file GT_CountArray.h.

bool GT_CountArray::operator== ( const GT_CountArray other) const
inline

Definition at line 105 of file GT_CountArray.h.

bool GT_CountArray::save ( UT_JSONWriter w) const

Saves as an array of the counts (not the offsets). i.e. [ getCount(0), getCount(1), ... getCount(n) ]

GT_Size GT_CountArray::sumCounts ( ) const
inline

Return the sum of all the counts.

Definition at line 116 of file GT_CountArray.h.


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