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_DataArrayHandle &counts, GT_Size mincount=0, GT_Size maxcount=0)
 
 GT_CountArray (const GT_CountArray &counts, const GT_DataArrayHandle &raw_offsets, GT_Size mincount, GT_Size maxcount)
 
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
 
std::pair< GT_Size, GT_SizegetOffsetCount (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...
 
const GT_DataArrayHandlerawOffsets () const
 
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_DataArrayHandle counts,
GT_Size  mincount = 0,
GT_Size  maxcount = 0 
)
inline

Definition at line 44 of file GT_CountArray.h.

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

Clone from the source count array, but swapping out the offset array with the given one.

Definition at line 53 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 ( )
inline

Clear the count array.

Definition at line 70 of file GT_CountArray.h.

GT_Size GT_CountArray::entries ( ) const
inline

Definition at line 89 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 94 of file GT_CountArray.h.

GT_Size GT_CountArray::getMaxCount ( ) const
inline

Return the maximum value that getCount() can return.

Definition at line 130 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 128 of file GT_CountArray.h.

GT_Offset GT_CountArray::getOffset ( exint  idx) const
inline

Definition at line 90 of file GT_CountArray.h.

std::pair<GT_Size,GT_Size> GT_CountArray::getOffsetCount ( exint  idx) const
inline

Definition at line 103 of file GT_CountArray.h.

GT_Storage GT_CountArray::getStorage ( ) const
inline

Return the storage type.

Definition at line 77 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 111 of file GT_CountArray.h.

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

Definition at line 124 of file GT_CountArray.h.

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

Definition at line 122 of file GT_CountArray.h.

const GT_DataArrayHandle& GT_CountArray::rawOffsets ( ) const
inline

Definition at line 135 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 133 of file GT_CountArray.h.


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