Rhino C++ API  8.14
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
ON_SubDComponentRegionIndex Class Reference

#include <opennurbs_subd.h>

Public Types

enum  : unsigned short { IndexCapacity = 9 }
 

Public Member Functions

 ON_SubDComponentRegionIndex ()=default
 
 ON_SubDComponentRegionIndex (const ON_SubDComponentRegionIndex &)=default
 
 ~ON_SubDComponentRegionIndex ()=default
 
unsigned short Index (unsigned short i) const
 
ON_SubDComponentRegionIndexoperator= (const ON_SubDComponentRegionIndex &)=default
 
void Pop ()
 
void Push (unsigned int region_index)
 
ON__UINT32 ToCompressedRegionIndex () const
 
const ON_wString ToString () const
 
wchar_t * ToString (wchar_t *s, size_t s_capacity) const
 

Static Public Member Functions

static int Compare (const ON_SubDComponentRegionIndex *lhs, const ON_SubDComponentRegionIndex *rhs)
 
static int CompareMinimumSubregion (const ON_SubDComponentRegionIndex *lhs, const ON_SubDComponentRegionIndex *rhs)
 
static const ON_SubDComponentRegionIndex FromCompressedRegionIndex (ON__UINT32 compressed_region_index)
 
static void FromCompressedRegionIndex (ON__UINT32 compressed_region_index, unsigned short *subdivision_count, unsigned short *region_index)
 
static ON__UINT32 ToCompressedRegionIndex (unsigned short subdivision_count, const unsigned short *region_index)
 

Public Attributes

unsigned short m_index [ON_SubDComponentRegionIndex::IndexCapacity] = {}
 
unsigned short m_subdivision_count = 0
 

Static Public Attributes

static const ON_SubDComponentRegionIndex Unset
 All values are 0xFFFF. More...
 
static const ON_SubDComponentRegionIndex Zero
 All values are zero. More...
 

Member Enumeration Documentation

◆ anonymous enum

anonymous enum : unsigned short
Enumerator
IndexCapacity 

Capacity of the m_index[] array;.

Constructor & Destructor Documentation

◆ ON_SubDComponentRegionIndex() [1/2]

ON_SubDComponentRegionIndex::ON_SubDComponentRegionIndex ( )
default

◆ ~ON_SubDComponentRegionIndex()

ON_SubDComponentRegionIndex::~ON_SubDComponentRegionIndex ( )
default

◆ ON_SubDComponentRegionIndex() [2/2]

ON_SubDComponentRegionIndex::ON_SubDComponentRegionIndex ( const ON_SubDComponentRegionIndex )
default

Member Function Documentation

◆ Compare()

static int ON_SubDComponentRegionIndex::Compare ( const ON_SubDComponentRegionIndex lhs,
const ON_SubDComponentRegionIndex rhs 
)
static

Description: Compares subdivision counts. If the counts are the same, compares m_indices[].

◆ CompareMinimumSubregion()

static int ON_SubDComponentRegionIndex::CompareMinimumSubregion ( const ON_SubDComponentRegionIndex lhs,
const ON_SubDComponentRegionIndex rhs 
)
static

Description: Compares subdivision indices for minimum(lhs->m_subdivision_count,rhs->m_subdivision_count).

◆ FromCompressedRegionIndex() [1/2]

static const ON_SubDComponentRegionIndex ON_SubDComponentRegionIndex::FromCompressedRegionIndex ( ON__UINT32  compressed_region_index)
static

◆ FromCompressedRegionIndex() [2/2]

static void ON_SubDComponentRegionIndex::FromCompressedRegionIndex ( ON__UINT32  compressed_region_index,
unsigned short *  subdivision_count,
unsigned short *  region_index 
)
static

Description: Decompress a 32-bit region. Parameters: region32 - [in] Value returned from To32BitRegion(). subdivision_count - [out] Subdivision count region_index[] - out Region indices. The region_index[] array must have a capcity of at least ON_SubDComponentRegion::region_index_capacity elements.

◆ Index()

unsigned short ON_SubDComponentRegionIndex::Index ( unsigned short  i) const

◆ operator=()

ON_SubDComponentRegionIndex& ON_SubDComponentRegionIndex::operator= ( const ON_SubDComponentRegionIndex )
default

◆ Pop()

void ON_SubDComponentRegionIndex::Pop ( )

◆ Push()

void ON_SubDComponentRegionIndex::Push ( unsigned int  region_index)

◆ ToCompressedRegionIndex() [1/2]

ON__UINT32 ON_SubDComponentRegionIndex::ToCompressedRegionIndex ( ) const

Description: Encodes ON_SubDComponentRegionIndex information in 32 bits. (m_subdivision_count) << 24 | (0x00FF0000 & ((m_region_index[0]) << 16)) | (m_region_index[1] & 0x0003) << (14) | (m_region_index[2] & 0x0003) << (12) ... | (m_index[m_subdivision_count] & 0x0003) <<(16-(2*m_subdivision_count)) Remarks: This is useful when quick compare and sorting of regions is required, m_subdivision_count < 256, m_index[0] < 256, m_index[1] < 4, ..., m_index[m_subdivision_count] < 4 Regions of N-gons with N < 256 and regions of edges satisfy these condition when m_subdivision_count < 256 (which is always in real world situations).

◆ ToCompressedRegionIndex() [2/2]

static ON__UINT32 ON_SubDComponentRegionIndex::ToCompressedRegionIndex ( unsigned short  subdivision_count,
const unsigned short *  region_index 
)
static

◆ ToString() [1/2]

const ON_wString ON_SubDComponentRegionIndex::ToString ( ) const

◆ ToString() [2/2]

wchar_t* ON_SubDComponentRegionIndex::ToString ( wchar_t *  s,
size_t  s_capacity 
) const

Description: Get a string of the form .a.b.c .a.b.c = m_index[] values.

Member Data Documentation

◆ m_index

unsigned short ON_SubDComponentRegionIndex::m_index[ON_SubDComponentRegionIndex::IndexCapacity] = {}

If m_subdivision_count > 0, then m_index[0], ..., m_index[m_subdivision_count-1] identifies a subregion of the level 0 component.

Faces with quad subdivision: m_index[n] is the subdivision quad for the region that contains the parent face's corner at face->m_vertex[m_index[n]]. Edges m_region_index[n] = 0 indicates the beginning half of the parent edge. (begins at edge->Vertex(0)) m_region_index[n] = 1 indicates the ending half of the parent edge. (ends at edge->Vertex(1))

When a component is created during a subdivision step, the value 0xFFFF is used to mark the non-existent regions at earlier subdivision levels. For example, if a level 1 edge is created by connecting a level0 edge subdivision point (middle-ish of the edge) to a level0 face subdivision point (center-ish of the face), then the level 1 edge would have m_level0_component = ON_SubDComponentPtr::CreateNull(ON_SubDComponentPtr::Type::Edge, bReversed), (m_level0_component.IsNull() will be true) m_level0_component_id = ON_SubDComponentRegion::NewTransientId() m_subdivision_count = 1, m_region_index[0] = 0xFFFF.

◆ m_subdivision_count

unsigned short ON_SubDComponentRegionIndex::m_subdivision_count = 0

◆ Unset

const ON_SubDComponentRegionIndex ON_SubDComponentRegionIndex::Unset
static

All values are 0xFFFF.

◆ Zero

const ON_SubDComponentRegionIndex ON_SubDComponentRegionIndex::Zero
static

All values are zero.