Rhino C++ API  7.22
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | Friends | List of all members
ON_SubDComponentBase Class Reference

#include <opennurbs_subd.h>

Inheritance diagram for ON_SubDComponentBase:
ON_SubDEdge ON_SubDFace ON_SubDVertex

Public Member Functions

 ON_SubDComponentBase ()=default
 
 ON_SubDComponentBase (const ON_SubDComponentBase &)=default
 
 ~ON_SubDComponentBase ()=default
 
unsigned int ArchiveId () const
 
bool ClearMark () const
 
ON__UINT8 ClearMarkBits () const
 
void ClearSavedSubdivisionPoint () const
 
void ClearSubdivisionDisplacement () const
 
bool GetSavedSubdivisionPoint (double subdivision_point[3]) const
 
bool GetSubdivisionDisplacement (double *) const
 
bool InSymmetrySet () const
 
bool IsActive () const
 
bool IsSymmetrySetPrimaryMotif () const
 
bool Mark () const
 
ON__UINT8 MarkBits () const
 
ON_SubDComponentBaseoperator= (const ON_SubDComponentBase &)=default
 
const ON_3dPoint SavedSubdivisionPoint () const
 
bool SavedSubdivisionPointIsSet () const
 
void SetArchiveId (unsigned int archive_id) const
 
bool SetMark () const
 
bool SetMark (bool bMark) const
 
ON__UINT8 SetMarkBits (ON__UINT8 mark_bits) const
 
bool SetSavedSubdivisionPoint (const double subdivision_point[3]) const
 
bool SetSubdivisionDisplacement (const double *)
 
void SetSubdivisionLevel (unsigned level)
 
const ON_ComponentStatus Status () const
 
const ON_3dVector SubdivisionDisplacement () const
 
bool SubdivisionDisplacementIsNonzero () const
 
const unsigned SubdivisionLevel () const
 

Static Public Member Functions

static int CompareId (const ON_SubDComponentBase *lhs, const ON_SubDComponentBase *rhs)
 

Public Attributes

unsigned int m_group_id = 0U
 
unsigned int m_id = 0
 
ON_ComponentStatus m_status = ON_ComponentStatus::NoneSet
 
const class ON_SubDVertexm_subd_point1 = nullptr
 

Static Public Attributes

static const ON_SubDComponentBase Unset
 

Protected Types

enum  ModifiedFlags : unsigned char { Modified1Bit = 0x01, Modified2Bit = 0x02, ModifiedFlagsMask = 0x03 }
 
enum  SavedPointsFlags : unsigned char { SubdivisionPointBit = 0x40, SurfacePointBit = 0x80, CachedPointMask = 0xC0 }
 

Protected Member Functions

void CopyBaseFrom (const ON_SubDComponentBase *src, bool bCopySymmetrySetNext)
 
void Internal_ClearModifiedFlags () const
 
void Internal_ClearSubdivisionPointAndSurfacePointFlags () const
 
void Internal_ClearSubdivisionPointFlag () const
 
void Internal_ClearSurfacePointFlag () const
 
bool Internal_Modified1IsSet () const
 
bool Internal_Modified1or2IsSet () const
 
void Internal_SetModified1Flag () const
 
void Internal_SetModified2Flag () const
 
void Internal_SetSavedSurfacePointFlag (bool bSavedSurfacePointFlag) const
 
bool Internal_SubdivisionPointFlag () const
 
bool Internal_SurfacePointFlag () const
 
void Internal_TransformComponentBase (bool bTransformationSavedSubdivisionPoint, const class ON_Xform &xform)
 

Protected Attributes

unsigned char m_level = 0U
 
unsigned char m_saved_points_flags = 0U
 
double m_saved_subd_point1 [3]
 GetSubdivisionPoint( bUseSavedSubdivisionPoint=true ) can change the value of m_cache_subd_P. More...
 

Friends

class ON_Internal_SubDFaceMeshFragmentAccumulator
 
class ON_SubDArchiveIdMap
 
class ON_SubDHeap
 

Detailed Description

ON_SubDComponentBase

Member Enumeration Documentation

◆ ModifiedFlags

enum ON_SubDComponentBase::ModifiedFlags : unsigned char
protected
Enumerator
Modified1Bit 

if ( 0 != (m_saved_points_flags & Modified1Bit), then the component has been modified and cached subdivision information needs to be recalculated.

Modified2Bit 

if ( 0 != (m_saved_points_flags & Modified2Bit), then the component is adjacent to a modified component and cached subdivision information needs to be recalculated.

ModifiedFlagsMask 

ModifiedFlagsMask = Modified1Bit | Modified2Bit if ( 0 != (m_saved_points_flags & ModifiedFlagsMask), then any cached subdivision information on that component needs to be recalculated.

◆ SavedPointsFlags

enum ON_SubDComponentBase::SavedPointsFlags : unsigned char
protected
Enumerator
SubdivisionPointBit 

if ( 0 != (m_saved_points_flags & SubdivisionPointBit), then m_cache_subd_P is set.

SurfacePointBit 

if ( 0 != (m_saved_points_flags & SurfacePointBit), then ON_SubDVertex.m_limit* values are set. ON_SubDVertex: Set means one or more sector limit surface points are saved in ON_SubDVertex.m_limit_point. ON_SubDEdge: Set means the limit surface NURBS curve control points are cached. ON_SubDFace: Set means limit surface mesh fragments are saved in ON_SubDFace.m_surface_mesh_fragments. Unset means any information in the fields identified above is invalid and must be recalculated.

CachedPointMask 

SubdivisionPointBit | SurfacePointBit.

Constructor & Destructor Documentation

◆ ON_SubDComponentBase() [1/2]

ON_SubDComponentBase::ON_SubDComponentBase ( )
default

◆ ~ON_SubDComponentBase()

ON_SubDComponentBase::~ON_SubDComponentBase ( )
default

◆ ON_SubDComponentBase() [2/2]

ON_SubDComponentBase::ON_SubDComponentBase ( const ON_SubDComponentBase )
default

Member Function Documentation

◆ ArchiveId()

unsigned int ON_SubDComponentBase::ArchiveId ( ) const
inline

Description: Pretend ArchiveId() and SetArchiveId() do not exist. Returns: The ArchiveId is a value set and used by ON_BinaryArchive Read() and Write() functions and copy constructors and operator=(). A public interface is supplied because it is not practical to use friends. Remarks: A value of ON_UNSET_UINT_INDEX indicates the component is not in use.

◆ ClearMark()

bool ON_SubDComponentBase::ClearMark ( ) const

Description: Clears (sets to false) the value of the component mark. Remarks: SubD components have a mutable runtime mark that can be used in any context where a single thread cares about the marks. Any code can use Mark() at any time. You cannot assume that other functions including const will not change its value. It is widely used in many calculations to keep track of sets of components that are in a certain context specfic state. Returns: Input value of Mark().

◆ ClearMarkBits()

ON__UINT8 ON_SubDComponentBase::ClearMarkBits ( ) const

Returns: Set the component mark bits to 0 ( m_status->SetMarkBits( 0 ) ). Remarks: Mark() and MarkBits() are independent.

SubD components have a mutable runtime mark bits that can be used in any context where a single thread cares about the mark bits value. Any code can use MarkBits() at any time. You cannot assume that other functions including const will not change their value. It is widely used in many calculations to keep track of sets of components that are in a certain context specfic state.

MarkBits() is used in more complex calculations where the single true/false provided by Mark() is not sufficient. Typically MarkBits() is used when a collecection of components needs to be partitioned into more than two sets or when the value of Mark() cannot be changed. Returns: Input value of MarkBits().

◆ ClearSavedSubdivisionPoint()

void ON_SubDComponentBase::ClearSavedSubdivisionPoint ( ) const

Description: Clears saved subdivision and limit surface information for this component. Attached components are not modifed.

◆ ClearSubdivisionDisplacement()

void ON_SubDComponentBase::ClearSubdivisionDisplacement ( ) const
Deprecated:
Does nothing.

◆ CompareId()

static int ON_SubDComponentBase::CompareId ( const ON_SubDComponentBase lhs,
const ON_SubDComponentBase rhs 
)
static

◆ CopyBaseFrom()

void ON_SubDComponentBase::CopyBaseFrom ( const ON_SubDComponentBase src,
bool  bCopySymmetrySetNext 
)
protected

◆ GetSavedSubdivisionPoint()

bool ON_SubDComponentBase::GetSavedSubdivisionPoint ( double  subdivision_point[3]) const

◆ GetSubdivisionDisplacement()

bool ON_SubDComponentBase::GetSubdivisionDisplacement ( double *  ) const
Deprecated:
Does nothing. Returns false.

◆ InSymmetrySet()

bool ON_SubDComponentBase::InSymmetrySet ( ) const

Returns: True if this component is marked being in a symmetry set. Remarks: You must use ON_SubD SymmetrySet memeber functions to get symmetry set contents.

◆ Internal_ClearModifiedFlags()

void ON_SubDComponentBase::Internal_ClearModifiedFlags ( ) const
protected

◆ Internal_ClearSubdivisionPointAndSurfacePointFlags()

void ON_SubDComponentBase::Internal_ClearSubdivisionPointAndSurfacePointFlags ( ) const
protected

Description: Clears the flags indicating the saved subdivision point and surface point information is current.

◆ Internal_ClearSubdivisionPointFlag()

void ON_SubDComponentBase::Internal_ClearSubdivisionPointFlag ( ) const
protected

Description: Clears the flag indicating the saved subdivision point is current.

◆ Internal_ClearSurfacePointFlag()

void ON_SubDComponentBase::Internal_ClearSurfacePointFlag ( ) const
protected

Description: Clears the flag indicating the saved surface point information is current.

◆ Internal_Modified1IsSet()

bool ON_SubDComponentBase::Internal_Modified1IsSet ( ) const
protected

Returns: True if Modified1Bit or Modified2Bit is set.

◆ Internal_Modified1or2IsSet()

bool ON_SubDComponentBase::Internal_Modified1or2IsSet ( ) const
protected

Returns: True if Modified1Bit or Modified2Bit is set.

◆ Internal_SetModified1Flag()

void ON_SubDComponentBase::Internal_SetModified1Flag ( ) const
protected

◆ Internal_SetModified2Flag()

void ON_SubDComponentBase::Internal_SetModified2Flag ( ) const
protected

◆ Internal_SetSavedSurfacePointFlag()

void ON_SubDComponentBase::Internal_SetSavedSurfacePointFlag ( bool  bSavedSurfacePointFlag) const
protected

m_saved_points_flags is a bit field based on ON_SubDComponentBase::SavePointsFlags values. GetSurfacePoint( bUseSavedSurfacePoint=true ) can change the value of m_saved_points_flags

◆ Internal_SubdivisionPointFlag()

bool ON_SubDComponentBase::Internal_SubdivisionPointFlag ( ) const
protected

◆ Internal_SurfacePointFlag()

bool ON_SubDComponentBase::Internal_SurfacePointFlag ( ) const
protected

◆ Internal_TransformComponentBase()

void ON_SubDComponentBase::Internal_TransformComponentBase ( bool  bTransformationSavedSubdivisionPoint,
const class ON_Xform xform 
)
protected

◆ IsActive()

bool ON_SubDComponentBase::IsActive ( ) const

Returns: True if this component is active in its parent subd or other relevent context. Remarks: When a component is in use, IsActive() = true. If was used and then deleted, IsActive() is false.

◆ IsSymmetrySetPrimaryMotif()

bool ON_SubDComponentBase::IsSymmetrySetPrimaryMotif ( ) const

Returns: True if this component is marked as a primary motif component. Remarks: You must use ON_SubD SymmetrySet memeber functions to get symmetry set contents.

◆ Mark()

bool ON_SubDComponentBase::Mark ( ) const

Returns: The current value of the component mark ( m_status->RuntimeMark() ). Remarks: SubD components have a mutable runtime mark that can be used in any context where a single thread cares about the marks. Any code can use Mark() at any time. You cannot assume that other functions including const will not change its value. It is widely used in many calculations to keep track of sets of components that are in a certain context specfic state.

◆ MarkBits()

ON__UINT8 ON_SubDComponentBase::MarkBits ( ) const

Returns: The current value of the component mark bits ( m_status->MarkBits() ). Remarks: Mark() and MarkBits() are independent.

SubD components have a mutable runtime mark bits that can be used in any context where a single thread cares about the mark bits value. Any code can use MarkBits() at any time. You cannot assume that other functions including const will not change their value. It is widely used in many calculations to keep track of sets of components that are in a certain context specfic state.

MarkBits() is used in more complex calculations where the single true/false provided by Mark() is not sufficient. Typically MarkBits() is used when a collecection of components needs to be partitioned into more than two sets or when the value of Mark() cannot be changed.

◆ operator=()

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

◆ SavedSubdivisionPoint()

const ON_3dPoint ON_SubDComponentBase::SavedSubdivisionPoint ( ) const

Returns: Saved subdivision point. If a point has not been saved, ON_3dPoint::NanPoint is returned.

◆ SavedSubdivisionPointIsSet()

bool ON_SubDComponentBase::SavedSubdivisionPointIsSet ( ) const

Returns: True if the subdivision point is cached.

◆ SetArchiveId()

void ON_SubDComponentBase::SetArchiveId ( unsigned int  archive_id) const
inline

m_archive_id is mutable

◆ SetMark() [1/2]

bool ON_SubDComponentBase::SetMark ( ) const

Description: Sets (sets to true) the value of the component mark. Remarks: SubD components have a mutable runtime mark that can be used in any context where a single thread cares about the marks. Any code can use Mark() at any time. You cannot assume that other functions including const will not change its value. It is widely used in many calculations to keep track of sets of components that are in a certain context specfic state. Returns: Input value of Mark().

◆ SetMark() [2/2]

bool ON_SubDComponentBase::SetMark ( bool  bMark) const

Description: Sets the value of the component mark to bMark. Parameter: bMark - [in] Remarks: SubD components have a mutable runtime mark that can be used in any context where a single thread cares about the marks. Any code can use Mark() at any time. You cannot assume that other functions including const will not change its value. It is widely used in many calculations to keep track of sets of components that are in a certain context specfic state. Returns: Input value of Mark().

◆ SetMarkBits()

ON__UINT8 ON_SubDComponentBase::SetMarkBits ( ON__UINT8  mark_bits) const

Returns: Set the component mark bits ( m_status->SetMarkBits( mark_bits ) ). Remarks: Mark() and MarkBits() are independent.

SubD components have a mutable runtime mark bits that can be used in any context where a single thread cares about the mark bits value. Any code can use MarkBits() at any time. You cannot assume that other functions including const will not change their value. It is widely used in many calculations to keep track of sets of components that are in a certain context specfic state.

MarkBits() is used in more complex calculations where the single true/false provided by Mark() is not sufficient. Typically MarkBits() is used when a collecection of components needs to be partitioned into more than two sets or when the value of Mark() cannot be changed. Returns: Input value of MarkBits().

◆ SetSavedSubdivisionPoint()

bool ON_SubDComponentBase::SetSavedSubdivisionPoint ( const double  subdivision_point[3]) const

Saved subdivision point Description: Set the saved subdivision point. Parameters: subdivision_point - [in] includes displacement if it exists Returns: true if successful

◆ SetSubdivisionDisplacement()

bool ON_SubDComponentBase::SetSubdivisionDisplacement ( const double *  )
Deprecated:
Does nothing. Returns false.

◆ SetSubdivisionLevel()

void ON_SubDComponentBase::SetSubdivisionLevel ( unsigned  level)

Parameters: level - [in] Subdivision level (0 to 255)

◆ Status()

const ON_ComponentStatus ON_SubDComponentBase::Status ( ) const

◆ SubdivisionDisplacement()

const ON_3dVector ON_SubDComponentBase::SubdivisionDisplacement ( ) const
Deprecated:
Does nothing. Returns nans.

◆ SubdivisionDisplacementIsNonzero()

bool ON_SubDComponentBase::SubdivisionDisplacementIsNonzero ( ) const
Deprecated:
Does nothing. Returns false.

◆ SubdivisionLevel()

const unsigned ON_SubDComponentBase::SubdivisionLevel ( ) const

Returns: Subdivision level (0 to 255)

Friends And Related Function Documentation

◆ ON_Internal_SubDFaceMeshFragmentAccumulator

friend class ON_Internal_SubDFaceMeshFragmentAccumulator
friend

◆ ON_SubDArchiveIdMap

friend class ON_SubDArchiveIdMap
friend

Symmetry sets are a linked loops of components order so that symmetry(component) = next component. There is exactly one motif in each symmetry set. The motif component is marked with 1 == m_symmetry_set_next.ComponentDirection(). The next component in the symmetry set loop is m_symmetry_set_next.Vertex()/Edge()/Face(). When a symmetry set is a singleton (fixed component in the symmetry), this = m_symmetry_set_next and m_symmetry_set_next.ComponentDirection()= 1. The only safe way query, set, and clear symmetry set information is to use ON_SubD.*SymmetrySet*() functions. Any other technique is not supported and will cause crashes.

◆ ON_SubDHeap

friend class ON_SubDHeap
friend

Member Data Documentation

◆ m_group_id

unsigned int ON_SubDComponentBase::m_group_id = 0U
mutable

All the faces with the same nonzero value of m_group_id are in the same "group". SDK interface on ON_SubD will be added after we get a better idea of how this feature will be used.

◆ m_id

unsigned int ON_SubDComponentBase::m_id = 0

The audience for this comment is anybody who wants to change the data fields in ON_SubDComponentBase. Everyone else should ignore this comment. It is critical that the offset of m_id in ON_SubDComponentBase be >= sizeof(void*). ON_SubD components come from ON_FixedSizePool and ON_SubD code use ON_FixedSizePool.ElementFromId and ON_FixedSizePool.ReturnElement. Once assigned, m_id is never changed and that allows ON_SubD component indices to work. Id assigned to this component. NEVER MODIFY THE m_id VALUE.
It is assigned by allocators and used to find the component from an ON_COMPONENT_INDEX.

◆ m_level

unsigned char ON_SubDComponentBase::m_level = 0U
protected

◆ m_saved_points_flags

unsigned char ON_SubDComponentBase::m_saved_points_flags = 0U
mutableprotected

◆ m_saved_subd_point1

double ON_SubDComponentBase::m_saved_subd_point1[3]
mutableprotected

GetSubdivisionPoint( bUseSavedSubdivisionPoint=true ) can change the value of m_cache_subd_P.

saved subdivision point

◆ m_status

ON_ComponentStatus ON_SubDComponentBase::m_status = ON_ComponentStatus::NoneSet
mutable

◆ m_subd_point1

const class ON_SubDVertex* ON_SubDComponentBase::m_subd_point1 = nullptr

The audience for this comment is anybody who wants to change the data fields in ON_SubDComponentBase. Everyone else should ignore this comment. ON_SubD components come from ON_FixedSizePool and ON_SubD code uses ON_FixedSizePool.ReturnElement. The first sizeof(void*) bytes must be a data field that is not referenced in returned elements. Since a returned element cannot have a "next level vertex", m_subd_point1 is a good data member to put first. m_subd_point1 points to the next level's vertex when this component has been subdivided using an algorithm like Catmull-Clark or Loop-Warren.

◆ Unset

const ON_SubDComponentBase ON_SubDComponentBase::Unset
static