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

#include <opennurbs_subd.h>

Public Types

enum  ExtraordinarySource : unsigned char { ExtraordinarySource::Unset = 0, ExtraordinarySource::None = 1, ExtraordinarySource::Level0ExtraordinaryVertex = 2, ExtraordinarySource::Level1NgonCenterVertex = 3 }
 When a ON_SubDFaceRegion::Type is Extraordinary or ExtraordinaryAdjacent, the ExtraordinarySource enum indicates if the source of the extraordinary vertex was a level 0 extraordinary vertex or a level 1 extraordinary vertex at the center of a level 0 N-gon face. More...
 
enum  Type : unsigned char { Type::Unset = 0, Type::Ordinary = 1, Type::Extraordinary = 2, Type::ExtraordinaryAdjacent = 3 }
 ON_SubDFaceRegion::Type has meaning only for regions of a SubD face that result from two or more subdivisions. The Type is used in creating NURBS approximations of SubD near level 0 extraordinary vertices level 1 extraordinary vertices that result from subdividing level 0 faces that have 3 or 5 or more edges (also called N-gon faces). More...
 

Public Member Functions

 ON_SubDFaceRegion ()=default
 
 ON_SubDFaceRegion (const ON_SubDFaceRegion &)=default
 
 ~ON_SubDFaceRegion ()=default
 
unsigned int CornerIndexFromVertexId (unsigned int vertex_id) const
 
bool IsValid (bool bSilentError) const
 
const ON_SubDFaceLevel0Face () const
 This is an expert user function that can return either Level0PersistentFace() or a transient face. Using this pointer depends on the constext. If you are not managing the entire creation process of the ON_SubDFaceRegion, you should be using Level0PersistentFace(). More...
 
const ON_SubDFaceLevel0PersistentFace () const
 An ON_SubDFaceRegion is a subdivision quad of a face. When that face is a level 0 face in an ON_SubD, it is called a persistent face. This function returns faces that have been set as persistent level 0 faces. More...
 
unsigned Level0PersistentFaceId () const
 An ON_SubDFaceRegion is a subdivision quad of a face. When that face is a level 0 face in an ON_SubD, it is called a persistent face. This function returns faces that have been set as persistent level 0 faces. More...
 
const ON_SubDVertexLevel0PersistentVertex () const
 An ON_SubDFaceRegion is a subdivision quad of a face. When that face is a level 0 face on from an ON_SubD, it is a persistent face and the level 1 quad has one corner at a face vertex. This vertex is returned by Level0PersistentVertex(). NOTE WELL: The caller must insure the parent ON_SubD exists before calling Level0PersistentVertex(). More...
 
unsigned Level0PersistentVertexId () const
 An ON_SubDFaceRegion is a subdivision quad of a face. When that face is a level 0 face on from an ON_SubD, it is a persistent face and the level 1 quad has one corner at a face vertex. This vertex is returned by Level0PersistentVertex(). NOTE WELL: The caller must insure the parent ON_SubD exists before calling Level0PersistentVertex(). More...
 
ON_SubDFaceRegionoperator= (const ON_SubDFaceRegion &)=default
 
void Push (unsigned int quadrant_index)
 
ON_SubDFaceRegion::ExtraordinarySource RegionExtraordinarySource () const
 RegionExtraordinarySource() applies only when RegionType() is Extraordinary or ExtraordinaryAdjacent and the region is a result of 2 or more subdivisions. More...
 
unsigned RegionExtraordinaryValence () const
 When the region is near a leve 0 or leve 1 extraordinary vertex, this function returns the valence of the extraodinary vertex. When RegionExtraordinarySource() = Level0ExtraordinaryVertex, this is the number of faces and edges around the level 0 vertex. When RegionExtraordinarySource() = Level1NgonCenterVertex, this is the number edges around the level 0 ngon which is also the number of edges and faces around the level 1 extraordinary vertex at the center of the ngon. /// More...
 
ON_SubDFaceRegion::Type RegionType () const
 RegionType() applys only when the regions is a result of 2 or more subdivisions. More...
 
const ON_wString ToString () const
 
wchar_t * ToString (wchar_t *s, size_t s_capacity) const
 

Static Public Member Functions

static int CompareSourceLevel0IdAndType (const ON_SubDFaceRegion *lhs, const ON_SubDFaceRegion *rhs)
 CompareSourceLevel0IdAndType is used to sort regions from the same subdivision level around level 0 extraordinary vertices and level 1 extraordinary vertices at the center of ngons. This is typically done in the context of calculating NURBS approsimations for subdivision regions that an extraordinary vertex. The compare is done as follows. 1st compare is RegionExtraordinarySource(). Unset < None < Level0ExtraordinaryVertex < Level1NgonCenterVertex. If lhs and rhs have the same value of RegionExtraordinarySource(), the 2nd compare is the component id. If the common source is Level0ExtraordinaryVertex, the vertex ids of Level0PersistentVertex() are compared. Otherwise the face ids of Level0PersistentFace() are compared. If lhs and rhs have the same component id, the 3rd compare is RegionType(). Unset < Ordinary < Extraordinary < ExtraordinaryAdjacent. Typically, this sort is happing in the context where the Extraordinary regions are being replaced with NURBS approximations that are G2 with ExtraordinaryAdjacent regions. More...
 

Public Attributes

ON_SubDComponentRegion m_edge_region [4]
 
ON_SubDComponentRegion m_face_region
 Identifies a region of an ON_SubDFace. More...
 
ON_SubDSectorId m_sector_id [4]
 
unsigned int m_vertex_id [4] = {}
 

Static Public Attributes

static const ON_SubDFaceRegion Empty
 

Member Enumeration Documentation

◆ ExtraordinarySource

enum ON_SubDFaceRegion::ExtraordinarySource : unsigned char
strong

When a ON_SubDFaceRegion::Type is Extraordinary or ExtraordinaryAdjacent, the ExtraordinarySource enum indicates if the source of the extraordinary vertex was a level 0 extraordinary vertex or a level 1 extraordinary vertex at the center of a level 0 N-gon face.

Enumerator
Unset 
None 
Level0ExtraordinaryVertex 

The regions are around a level 0 extraordinary vertex. These are smooth vertices that have 3 or 5 or more smooth edges.

Level1NgonCenterVertex 

The regions are around a level 1 extraordinary vertex created at the center of a level 0 N-gon face. These level 1 vertices are smooth and have N smooth edges.

◆ Type

enum ON_SubDFaceRegion::Type : unsigned char
strong

ON_SubDFaceRegion::Type has meaning only for regions of a SubD face that result from two or more subdivisions. The Type is used in creating NURBS approximations of SubD near level 0 extraordinary vertices level 1 extraordinary vertices that result from subdividing level 0 faces that have 3 or 5 or more edges (also called N-gon faces).

Enumerator
Unset 
Ordinary 

Ordinary subdivision regions are bounded by 4 smooth subdivision edges. Ordinary subdivision regions can be represents with a bibezier whose control points conincide whte the subdivided SubD's control points. Orindary regions do not chare a smooth edge with Extraordinary regions.

Extraordinary 

Extraordinary subdivision regions are bounded by 4 smooth subdivision edges. Extraordinary subdivision regions have a corner at either a level 0 extraordinary vertex or a level 1 extraordinary vertex created at the center of a level 0 ngon face (3 or 5 or more edges). In general, the SubD limit surface of these regions cannot be exactly represented by an rational polynomial surface. No amount of subdivsion changes this in the general case. Thus, any bibezier or NURBS patch representing these regions is an approximation.

ExtraordinaryAdjacent 

ExtraordinaryAdjacent subdivision regions are bounded by 4 smooth subdivision edges. ExtraordinaryAdjacent regions share an edge with Extraordinary regions. Mathematically, Ordindary and ExtraordinaryAdjacent regions have the same subdivion properties. ExtraordinaryAdjacent get a special identifying mark because they are used to specify boundary conditions for calculating NURBS patches that approximate Extraordinary regions. There are 2 ExtraordinaryAdjacent regions for each Extraordinary region. A subdivision levels>= 2, these regions can be exactly represented by a bicubicbezier patch with 16 control points equal to the SubD level 2 control points around the region.

Constructor & Destructor Documentation

◆ ON_SubDFaceRegion() [1/2]

ON_SubDFaceRegion::ON_SubDFaceRegion ( )
default

◆ ~ON_SubDFaceRegion()

ON_SubDFaceRegion::~ON_SubDFaceRegion ( )
default

◆ ON_SubDFaceRegion() [2/2]

ON_SubDFaceRegion::ON_SubDFaceRegion ( const ON_SubDFaceRegion )
default

Member Function Documentation

◆ CompareSourceLevel0IdAndType()

static int ON_SubDFaceRegion::CompareSourceLevel0IdAndType ( const ON_SubDFaceRegion lhs,
const ON_SubDFaceRegion rhs 
)
static

CompareSourceLevel0IdAndType is used to sort regions from the same subdivision level around level 0 extraordinary vertices and level 1 extraordinary vertices at the center of ngons. This is typically done in the context of calculating NURBS approsimations for subdivision regions that an extraordinary vertex. The compare is done as follows. 1st compare is RegionExtraordinarySource(). Unset < None < Level0ExtraordinaryVertex < Level1NgonCenterVertex. If lhs and rhs have the same value of RegionExtraordinarySource(), the 2nd compare is the component id. If the common source is Level0ExtraordinaryVertex, the vertex ids of Level0PersistentVertex() are compared. Otherwise the face ids of Level0PersistentFace() are compared. If lhs and rhs have the same component id, the 3rd compare is RegionType(). Unset < Ordinary < Extraordinary < ExtraordinaryAdjacent. Typically, this sort is happing in the context where the Extraordinary regions are being replaced with NURBS approximations that are G2 with ExtraordinaryAdjacent regions.

Parameters
lhs
rhs
Returns

◆ CornerIndexFromVertexId()

unsigned int ON_SubDFaceRegion::CornerIndexFromVertexId ( unsigned int  vertex_id) const

Returns: If vertex_id > 0 and there is a unique element of m_vertex_id[] with the same value, the index of that element is returned (0,1,2 or 3). Otherwise ON_UNSET_UNINT_INDEX is returned.

◆ IsValid()

bool ON_SubDFaceRegion::IsValid ( bool  bSilentError) const

◆ Level0Face()

const ON_SubDFace* ON_SubDFaceRegion::Level0Face ( ) const

This is an expert user function that can return either Level0PersistentFace() or a transient face. Using this pointer depends on the constext. If you are not managing the entire creation process of the ON_SubDFaceRegion, you should be using Level0PersistentFace().

Returns
A persistent or transient face that depends on the context of this ON_SubDFaceRegion class.

◆ Level0PersistentFace()

const ON_SubDFace* ON_SubDFaceRegion::Level0PersistentFace ( ) const

An ON_SubDFaceRegion is a subdivision quad of a face. When that face is a level 0 face in an ON_SubD, it is called a persistent face. This function returns faces that have been set as persistent level 0 faces.

Returns
A pointer to the level 0 persistent face. It is the caller's responsibility to check for a nullptr and to insure the parent ON_SubD exists before dereferencing this pointer.

◆ Level0PersistentFaceId()

unsigned ON_SubDFaceRegion::Level0PersistentFaceId ( ) const

An ON_SubDFaceRegion is a subdivision quad of a face. When that face is a level 0 face in an ON_SubD, it is called a persistent face. This function returns faces that have been set as persistent level 0 faces.

Returns
The id of the level 0 persistent face or 0 if it is not available.

◆ Level0PersistentVertex()

const ON_SubDVertex* ON_SubDFaceRegion::Level0PersistentVertex ( ) const

An ON_SubDFaceRegion is a subdivision quad of a face. When that face is a level 0 face on from an ON_SubD, it is a persistent face and the level 1 quad has one corner at a face vertex. This vertex is returned by Level0PersistentVertex(). NOTE WELL: The caller must insure the parent ON_SubD exists before calling Level0PersistentVertex().

Returns
A pointer to the level 0 persistent vertex. It is the caller's responsibility to check for a nullptr and to insure the parent ON_SubD exists before dereferencing this pointer.

◆ Level0PersistentVertexId()

unsigned ON_SubDFaceRegion::Level0PersistentVertexId ( ) const

An ON_SubDFaceRegion is a subdivision quad of a face. When that face is a level 0 face on from an ON_SubD, it is a persistent face and the level 1 quad has one corner at a face vertex. This vertex is returned by Level0PersistentVertex(). NOTE WELL: The caller must insure the parent ON_SubD exists before calling Level0PersistentVertex().

Returns
The id of the level 0 persistent vertex or 0 if it is not available.

◆ operator=()

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

◆ Push()

void ON_SubDFaceRegion::Push ( unsigned int  quadrant_index)

◆ RegionExtraordinarySource()

ON_SubDFaceRegion::ExtraordinarySource ON_SubDFaceRegion::RegionExtraordinarySource ( ) const

RegionExtraordinarySource() applies only when RegionType() is Extraordinary or ExtraordinaryAdjacent and the region is a result of 2 or more subdivisions.

Returns

◆ RegionExtraordinaryValence()

unsigned ON_SubDFaceRegion::RegionExtraordinaryValence ( ) const

When the region is near a leve 0 or leve 1 extraordinary vertex, this function returns the valence of the extraodinary vertex. When RegionExtraordinarySource() = Level0ExtraordinaryVertex, this is the number of faces and edges around the level 0 vertex. When RegionExtraordinarySource() = Level1NgonCenterVertex, this is the number edges around the level 0 ngon which is also the number of edges and faces around the level 1 extraordinary vertex at the center of the ngon. ///

Returns
If RegionExtraordinarySource() is Level0ExtraordinaryVertex or Level1NgonCenterVertex, the valance of the extraordinary vertex is returned. Otherwise 0 is returned.

◆ RegionType()

ON_SubDFaceRegion::Type ON_SubDFaceRegion::RegionType ( ) const

RegionType() applys only when the regions is a result of 2 or more subdivisions.

Returns

◆ ToString() [1/2]

const ON_wString ON_SubDFaceRegion::ToString ( ) const

◆ ToString() [2/2]

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

Member Data Documentation

◆ Empty

const ON_SubDFaceRegion ON_SubDFaceRegion::Empty
static

◆ m_edge_region

ON_SubDComponentRegion ON_SubDFaceRegion::m_edge_region[4]

When the face region is a quad, m_edge_region[4] identifies regions of ON_SubDEdge elements. When the face region is a sub-quad, these edges may be null or have null ON_SubDEdge pointers and the ids will be zero or ON_SubDComponentRegion::IsTransientId() will be true. When ON_SubDComponentRegion::IsTransientId() is true, the id does not identify a persistent edge in the ON_SubD.

◆ m_face_region

ON_SubDComponentRegion ON_SubDFaceRegion::m_face_region

Identifies a region of an ON_SubDFace.

◆ m_sector_id

ON_SubDSectorId ON_SubDFaceRegion::m_sector_id[4]
mutable

When a vertex is exceptional, a NURBS conversion is typically an approximation of the SubD around the exceptional vertex. There are a variety of post processes that can be applied in this case and the processes need to be applied sector by sector. Note well that when a level zero face is an N-gon with N != 4, the face subdivision point is an exceptional smooth vertex with valence = N. In this case the corresponding m_vertex_id[] value will be zero.

◆ m_vertex_id

unsigned int ON_SubDFaceRegion::m_vertex_id[4] = {}
mutable

If set, these are the vertice ids at the region's limit surface corners. m_vertex_id[] is mutable because these values appear during recursive calculations. When the face region is a sub-quad, these ids will be zero or ON_SubDComponentRegion::IsTransientId() will be true. When ON_SubDComponentRegion::IsTransientId() is true, the id does not identify a persistent vertex in the ON_SubD.