Rhino C++ API  8.6
Public Member Functions | Public Attributes | List of all members
ON_SubD_FixedSizeHeap Class Reference

#include <opennurbs_subd.h>

Public Member Functions

 ON_SubD_FixedSizeHeap ()=default
 
 ~ON_SubD_FixedSizeHeap ()
 
const ON_SubDEdgePtr AllocateEdge (bool bUseFindOrAllocatEdge, ON_SubDVertex *v0, double v0_sector_coefficient, ON_SubDVertex *v1, double v1_sector_coefficient)
 
const ON_SubDEdgePtr AllocateEdge (ON_SubDVertex *v0, double v0_sector_coefficient, ON_SubDVertex *v1, double v1_sector_coefficient)
 
ON_SubDVertexAllocateEdgeSubdivisionVertex (bool bUseFindOrAllocate, const ON_SubDEdge *edge0)
 
ON__UINT_PTR * AllocatePtrArray (unsigned int capacity, bool bZeroMemory)
 
ON_SubDFaceAllocateQuad (unsigned int zero_face_id, unsigned int parent_face_id, const ON_SubDEdgePtr eptrs[4])
 
ON_SubDFaceAllocateQuad (unsigned int zero_face_id, unsigned int parent_face_id, ON_SubDEdgePtr e0, ON_SubDEdgePtr e1, ON_SubDEdgePtr e2, ON_SubDEdgePtr e3)
 
ON_SubDVertexAllocateSectorFaceVertex (const ON_SubDFace *sector_face0)
 
ON_SubDVertexAllocateVertex (const double vertexP[3], unsigned int edge_capacity)
 
ON_SubDVertexAllocateVertex (const ON_SubDEdge *edge0)
 
ON_SubDVertexAllocateVertex (const ON_SubDVertex *vertex0, unsigned int edge_capacity)
 
void Destroy ()
 
const ON_SubDEdgePtr FindOrAllocateEdge (ON_SubDVertex *v0, double v0_sector_coefficient, ON_SubDVertex *v1, double v1_sector_coefficient)
 
ON_SubDVertexFindOrAllocateVertex (const ON_SubDEdge *edge0)
 
ON_SubDVertexFindOrAllocateVertex (const ON_SubDFace *face0)
 
bool InUse () const
 
bool ReserveSubDWorkspace (const ON_SubDFace *center_face0)
 
bool ReserveSubDWorkspace (unsigned int sector_edge_count)
 
void Reset ()
 
bool ReturnPtrArray (void *p, unsigned int capacity)
 

Public Attributes

const unsigned int m_sn = ++m__sn_factory
 The serial number is used for debugging purposes. More...
 

Detailed Description

ON_SubD_FixedSizeHeap Description: A ON_SubD_FixedSizeHeap is used to manage heap used for a local subdivision.

Constructor & Destructor Documentation

◆ ON_SubD_FixedSizeHeap()

ON_SubD_FixedSizeHeap::ON_SubD_FixedSizeHeap ( )
default

◆ ~ON_SubD_FixedSizeHeap()

ON_SubD_FixedSizeHeap::~ON_SubD_FixedSizeHeap ( )

Member Function Documentation

◆ AllocateEdge() [1/2]

const ON_SubDEdgePtr ON_SubD_FixedSizeHeap::AllocateEdge ( bool  bUseFindOrAllocatEdge,
ON_SubDVertex v0,
double  v0_sector_coefficient,
ON_SubDVertex v1,
double  v1_sector_coefficient 
)

◆ AllocateEdge() [2/2]

const ON_SubDEdgePtr ON_SubD_FixedSizeHeap::AllocateEdge ( ON_SubDVertex v0,
double  v0_sector_coefficient,
ON_SubDVertex v1,
double  v1_sector_coefficient 
)

Parameters: v0 - [in] v0_sector_coefficient - [in] If v0 null or ON_SubDVertexTag::Smooth == v0->m_vertex_tag, and v1 is null or tagged, then m_sector_coefficient[0] is set to v0_sector_coefficient. In all other cases the value of v0_sector_coefficient is ignored and m_sector_coefficient[0] is set to ON_SubDSectorType::IgnoredSectorCoefficient. v1 - [in] v1_sector_coefficient - [in] If v1 null or ON_SubDVertexTag::Smooth == v1->m_vertex_tag, and v0 is null or tagged, then m_sector_coefficient[1] is set to v1_sector_coefficient. In all other cases the value of v1_sector_coefficient is ignored and m_sector_coefficient[1] is set to ON_SubDSectorType::IgnoredSectorCoefficient. Returns: An edge. The vertex parameter information is used to set the ON_SubDEdge.m_vertex[] and ON_SubDEdge.m_sector_coefficient[] values. If v0 and v1 are not null and both are tagged, then ON_SubDEdge.m_edge_tag is set to ON_SubDEdgeTag::Crease.
In all other cases, ON_SubDEdge.m_edge_tag is set to ON_SubDEdgeTag::Smooth. If v0 or v1 is not null, then ON_SubDEdge.m_level is set to the maximum of v0->m_level or v1->m_level.

◆ AllocateEdgeSubdivisionVertex()

ON_SubDVertex* ON_SubD_FixedSizeHeap::AllocateEdgeSubdivisionVertex ( bool  bUseFindOrAllocate,
const ON_SubDEdge edge0 
)

Description: Allocate a vertex located at the edge0 subdivision point. The vertex will have an edge and face capacity of 4. Parameters: edge0 - [in]

◆ AllocatePtrArray()

ON__UINT_PTR* ON_SubD_FixedSizeHeap::AllocatePtrArray ( unsigned int  capacity,
bool  bZeroMemory 
)

Parameters: capacity - [in] desired array size bZeroMemory - [in] If true, all array element values are zero. If false, array element values are undefined. Returns: An array of capacity ON__UINT_PTR pointers.

◆ AllocateQuad() [1/2]

ON_SubDFace* ON_SubD_FixedSizeHeap::AllocateQuad ( unsigned int  zero_face_id,
unsigned int  parent_face_id,
const ON_SubDEdgePtr  eptrs[4] 
)

◆ AllocateQuad() [2/2]

ON_SubDFace* ON_SubD_FixedSizeHeap::AllocateQuad ( unsigned int  zero_face_id,
unsigned int  parent_face_id,
ON_SubDEdgePtr  e0,
ON_SubDEdgePtr  e1,
ON_SubDEdgePtr  e2,
ON_SubDEdgePtr  e3 
)

◆ AllocateSectorFaceVertex()

ON_SubDVertex* ON_SubD_FixedSizeHeap::AllocateSectorFaceVertex ( const ON_SubDFace sector_face0)

Description: Allocate a vertex located at the sector_face0 subdivision point. The vertex will have an edge and face capacity of 3. Parameters: sector_face0 - [in] A face in a vertex sector.

◆ AllocateVertex() [1/3]

ON_SubDVertex* ON_SubD_FixedSizeHeap::AllocateVertex ( const double  vertexP[3],
unsigned int  edge_capacity 
)

◆ AllocateVertex() [2/3]

ON_SubDVertex* ON_SubD_FixedSizeHeap::AllocateVertex ( const ON_SubDEdge edge0)

Description: Allocate a vertex located at the edge0 subdivision point. The vertex will have an edge and face capacity of 4. Parameters: edge0 - [in]

◆ AllocateVertex() [3/3]

ON_SubDVertex* ON_SubD_FixedSizeHeap::AllocateVertex ( const ON_SubDVertex vertex0,
unsigned int  edge_capacity 
)

Description: Allocate a vertex located at the vertex0 subdivision point.

Parameters: vertex0 - [in] edge_capacity - [in] If the returned vertex will be interior in a local subdivision, then pass vertex0->EdgeCount(). If the returned vertex will be an outer ring vertex in a local subdivision, then pass 3.

◆ Destroy()

void ON_SubD_FixedSizeHeap::Destroy ( )

Description: Deallocate all reserved heap.

◆ FindOrAllocateEdge()

const ON_SubDEdgePtr ON_SubD_FixedSizeHeap::FindOrAllocateEdge ( ON_SubDVertex v0,
double  v0_sector_coefficient,
ON_SubDVertex v1,
double  v1_sector_coefficient 
)

Description: NOTE WELL: In order for FindOrAllocateEdge() to find an edge, that edge must have been created by an earlier call to FindOrAllocateEdge().

◆ FindOrAllocateVertex() [1/2]

ON_SubDVertex* ON_SubD_FixedSizeHeap::FindOrAllocateVertex ( const ON_SubDEdge edge0)

Description: Find or allocate a vertex located at the edge0 subdivision point. The vertex will have an edge and face capacity of 4. Parameters: edge0 - [in] Remarks: In order for FindOrAllocateVertex() to find a vertex, that vertex must have been created by an earlier call to FindOrAllocateVertex(). Typically, AllocateVertex(edge0) is used for center face boundary edges and FindOrAllocateVertex(edge0) is used for ring edges.

◆ FindOrAllocateVertex() [2/2]

ON_SubDVertex* ON_SubD_FixedSizeHeap::FindOrAllocateVertex ( const ON_SubDFace face0)

Description: Find or allocate a vertex and the face subdivision point. The vertex will have an edge and face capacity of face0->EdgeCount(). Parameters: face0 - [in] outer face in a local subdivision situation Remarks: In order for FindOrAllocateVertex() to find a vertex, that vertex must have been created by an earlier call to FindOrAllocateVertex(). Typically, AllocateVertex(edge0) is used for the center face and and FindOrAllocateVertex(edge0) is used for ring faces.

◆ InUse()

bool ON_SubD_FixedSizeHeap::InUse ( ) const

◆ ReserveSubDWorkspace() [1/2]

bool ON_SubD_FixedSizeHeap::ReserveSubDWorkspace ( const ON_SubDFace center_face0)

Description: Reserve enough room for a local subdivide the neighborhood of center_face. Parameters: center_face0 - [in]

◆ ReserveSubDWorkspace() [2/2]

bool ON_SubD_FixedSizeHeap::ReserveSubDWorkspace ( unsigned int  sector_edge_count)

Description: Reserve enough room to for a subdivision of a vertex sector. Parameters: sector_edge_count - [in] Number of edges in the sector.

◆ Reset()

void ON_SubD_FixedSizeHeap::Reset ( )

Description: Reset this ON_SubD_FixedSizeHeap so it can be used again.

◆ ReturnPtrArray()

bool ON_SubD_FixedSizeHeap::ReturnPtrArray ( void *  p,
unsigned int  capacity 
)

Description: Return the most recent array obtained from AllocatePtrArray(). so it can be reused.
Returns: True: Success. False: Failure. The array was not the most recent array obtained from AllocatePtrArray().

Member Data Documentation

◆ m_sn

const unsigned int ON_SubD_FixedSizeHeap::m_sn = ++m__sn_factory

The serial number is used for debugging purposes.