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

#include <opennurbs_mesh.h>

Public Types

enum  : unsigned int {
  UnsetDensity = 0, MinimumUserInterfaceDensity = 1, MaximumUserInterfaceDensity = 5, MinimumAdaptiveDensity = 1,
  MinimumDensity = 0, ExtraCoarseDensity = 1, CoarseDensity = 2, MediumDensity = 3,
  FineDensity = 4, DefaultDensity = 4, ExtraFineDensity = 5, MaximumDensity = 6
}
 
enum  : unsigned int { AdaptiveDisplayMeshQuadMaximum = 512000 }
 
enum  Context : unsigned char { Context::Unknown = 0, Context::SubDToMesh = 1, Context::SubDToNURBS = 2 }
 

Public Member Functions

 ON_SubDDisplayParameters ()=default
 
 ON_SubDDisplayParameters (const ON_SubDDisplayParameters &)=default
 
 ~ON_SubDDisplayParameters ()=default
 
ON_SubDDisplayParameters::Context ContextForExperts () const
 
unsigned int DisplayDensity () const
 
unsigned int DisplayDensity (const class ON_SubD &subd) const
 
bool DisplayDensityIsAbsolute () const
 
bool DisplayDensityIsAdaptive () const
 
void Dump (class ON_TextLog &) const
 
unsigned char EncodeAsUnsignedChar () const
 
ON_SubDComponentLocation MeshLocation () const
 
ON_SubDDisplayParametersoperator= (const ON_SubDDisplayParameters &)=default
 
ON_ProgressReporterProgressReporter () const
 
const ON_Interval ProgressReporterInterval () const
 
bool Read (class ON_BinaryArchive &archive)
 
void SetAbsoluteDisplayDensity (unsigned int absolute_display_density)
 
void SetAdaptiveDisplayDensity (unsigned int adaptive_display_density)
 
void SetContextForExperts (ON_SubDDisplayParameters::Context context)
 
void SetDisplayDensity (unsigned int adaptive_display_density)
 
void SetMeshLocation (ON_SubDComponentLocation mesh_location)
 
void SetProgressReporter (ON_ProgressReporter *progress_reporter, ON_Interval progress_reporter_interval)
 
void SetTerminator (ON_Terminator *terminator)
 
ON_TerminatorTerminator () const
 TODO - split this class into two - what's above and one derived from that with what's below. More...
 
bool Write (class ON_BinaryArchive &archive) const
 

Static Public Member Functions

static unsigned int AbsoluteDisplayDensityFromSubD (unsigned adaptive_subd_display_density, const class ON_SubD &subd)
 
static unsigned int AbsoluteDisplayDensityFromSubDFaceCount (unsigned adaptive_subd_display_density, unsigned subd_face_count)
 
static const ON_SubDDisplayParameters CreateFromAbsoluteDisplayDensity (unsigned int absolute_subd_display_density)
 
static const ON_SubDDisplayParameters CreateFromDisplayDensity (unsigned int adaptive_subd_display_density)
 
static const ON_SubDDisplayParameters CreateFromMeshDensity (double normalized_mesh_density)
 
static const ON_SubDDisplayParameters DecodeFromUnsignedChar (unsigned char encoded_parameters)
 

Static Public Attributes

static const ON_SubDDisplayParameters Coarse
 
static const ON_SubDDisplayParameters Default
 
static const ON_SubDDisplayParameters Empty
 
static const ON_SubDDisplayParameters ExtraCoarse
 
static const ON_SubDDisplayParameters ExtraFine
 
static const ON_SubDDisplayParameters Fine
 
static const ON_SubDDisplayParameters Medium
 

Detailed Description

ON_SubDDisplayParameters

A collection of parameters that are passed to functions that calculate a various representations of ON_SubD objects.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum : unsigned int
Enumerator
UnsetDensity 

summary> Indicates the SubD display mesh density has not be set. /summary> summary> The minimum SubD display density that can be se in Rhino user interface is ExtraCoarseDensity (1). /summary>

MinimumUserInterfaceDensity 

summary> The maximum SubD display density that can be se in Rhino user interface is ExtraFineDensity (5). /summary>

MaximumUserInterfaceDensity 

summary> SubD display density values <= MinimumAdaptiveDensity will never be adaptively reduced. SubD display density values > MinimumAdaptiveDensity may be adaptively reduced to a value >= MinimumAdaptiveDensity. /summary>

MinimumAdaptiveDensity 

summary> Each SubD quad will generate 1 display mesh quads in a 1x1 grid. This density can only be used with SubDs where every face is a quad. User interface code never returns this density. /summary>

MinimumDensity 

summary> When interpreted as an absolute SubD display density, each SubD quad will generate 4 display mesh quads in a 2x2 grid and each SubD N-gon will generate N display mesh quads. Adaptive reductions do not apply to this density. This is the minimum SubD display density. /summary>

ExtraCoarseDensity 

summary> When interpreted as an absolute SubD display density, each SubD quad will generate 16 display mesh quads in a 4x4 grid and each SubD N-gon will generate N*4 display mesh quads. Adaptive reductions do not apply to this density. /summary>

CoarseDensity 

summary> When interpreted as an absolute SubD display density, each SubD quad will generate 64 display mesh quads in an 8x8 grid and each SubD N-gon will generate N*8 display mesh quads. When a SubD has more than 8000 faces, adaptive MediumDensity is reduced to CoarseDensity. /summary>

MediumDensity 

summary> When interpreted as an absolute SubD display density, each SubD quad will generate 256 display mesh quads in a 16x16 grid and each SubD N-gon will generate N*16 display mesh quads. When a SubD has more than 2000 faces, adaptive FineDensity is reduced to adaptive MediumDensity. /summary>

FineDensity 

summary> When interpreted as an absolute SubD display density, each SubD quad will generate 256 display mesh quads in a 16x16 grid and each SubD N-gon will generate N*16 display mesh quads. When a SubD has more than 2000 faces, adaptive DefaultDensity is reduced to adaptive MediumDensity. This is the default value for creating mesh approximations of SubD surface.
When treadted as an adaptive setting, it produces acceptable results for most SubDs. /summary>

DefaultDensity 

summary> When interpreted as an absolute SubD display density, each SubD quad will generate 1024 display mesh quads in a 32x32 grid and each SubD N-gon will generate N*32 display mesh quads. When a SubD has more than 500 faces, adaptive ExtraFineDensity is reduced to adaptive FineDensity. /summary>

ExtraFineDensity 

summary> When interpreted as an absolute SubD display density, each SubD quad will generate 4096 display mesh quads in a 64x64 grid and each SubD N-gon will generate N*64 display mesh quads. ON_SubDDisplayParameters.AdaptiveDensity() determines if the subd display density is treated adaptively or absolutely. This value creates ridiculously dense display meshes and should generally be avoided. No Rhino user interface will create this value. /summary>

MaximumDensity 

◆ anonymous enum

anonymous enum : unsigned int
Enumerator
AdaptiveDisplayMeshQuadMaximum 

When the SubD display density is adaptive (default), AdaptiveMeshQuadMaximum specifies the approximate number of display mesh quads to permit before reducing the SubD display mesh density. Approximate display mesh quad count = subd.FaceCount()*(4^subd_display_density). This enum value may change from release to release as rendering technology improves. Make sure your code works for values between 1024 and 134217728.

◆ Context

enum ON_SubDDisplayParameters::Context : unsigned char
strong
Enumerator
Unknown 

summary> Unknown, unspecified, or unset context. This is typical. /summary> summary> These parameters are being used to generate a quad mesh approximations of an ON_SubD. Low level meshing code copies input paramters and specifies this context when appropriate. /summary>

SubDToMesh 

summary> These parameters are being used to generate NURBS surface approximations of an ON_SubD. Low level conversion to NURB code copies input paramters and specifies this context when appropriate. /summary>

SubDToNURBS 

Constructor & Destructor Documentation

◆ ON_SubDDisplayParameters() [1/2]

ON_SubDDisplayParameters::ON_SubDDisplayParameters ( )
default

◆ ~ON_SubDDisplayParameters()

ON_SubDDisplayParameters::~ON_SubDDisplayParameters ( )
default

◆ ON_SubDDisplayParameters() [2/2]

ON_SubDDisplayParameters::ON_SubDDisplayParameters ( const ON_SubDDisplayParameters )
default

Member Function Documentation

◆ AbsoluteDisplayDensityFromSubD()

static unsigned int ON_SubDDisplayParameters::AbsoluteDisplayDensityFromSubD ( unsigned  adaptive_subd_display_density,
const class ON_SubD subd 
)
static

Parameters: adaptive_subd_display_density - [in] A value <= ON_SubDDisplayParameters::MaximumDensity. When in doubt, pass ON_SubDDisplayParameters::DefaultDensity. Invalid input values are treated as ON_SubDDisplayParameters::DefaultDensity. subd - [in] In the cases when the subd in question is not available, like user interface code that applies in general and to unknown SubDs, pass ON_SubD::Empty. Returns: The absolute SubD display density for subd. The absolute SubD display density is <= adaptive_subd_display_density and <= ON_SubDDisplayParameters::MaximumDensity.

◆ AbsoluteDisplayDensityFromSubDFaceCount()

static unsigned int ON_SubDDisplayParameters::AbsoluteDisplayDensityFromSubDFaceCount ( unsigned  adaptive_subd_display_density,
unsigned  subd_face_count 
)
static

Parameters: adaptive_subd_display_density - [in] A value <= ON_SubDDisplayParameters::MaximumDensity. When in doubt, pass ON_SubDDisplayParameters::DefaultDensity. Invalid input values are treated as ON_SubDDisplayParameters::DefaultDensity. subd_face_count - [in] Number of SubD faces. When subd_face_count = 0, adaptive_subd_display_density is returned. Returns: The absolute SubD display density for SubD with subd_face_count faces. The absolute SubD display density is <= adaptive_subd_display_density and <= ON_SubDDisplayParameters::MaximumDensity.

◆ ContextForExperts()

ON_SubDDisplayParameters::Context ON_SubDDisplayParameters::ContextForExperts ( ) const

Description: Low level mesh creation and ON_SubD to NURBS conversion code occasional looks at the context. Typically it is set in a local copy and no user of the top level ON_SubD SDK needs to be concerned about the context setting. This setting is not saved in 3dm archives and is ingnored by all compare functions.

◆ CreateFromAbsoluteDisplayDensity()

static const ON_SubDDisplayParameters ON_SubDDisplayParameters::CreateFromAbsoluteDisplayDensity ( unsigned int  absolute_subd_display_density)
static

Description: Use of absolute display density is strongly discouraged. SubDs can have a single face or millions of faces. Adaptive display meshing produces more desirable results in almost all cases. Parameters: absolute_subd_display_density - [in] A value <= ON_SubDDisplayParameters::MaximumDensity. When in doubt, pass ON_SubDDisplayParameters::DefaultDensity. Returns: A ON_SubDDisplayParameters that treats the display density value as a constant for all SubDs.

◆ CreateFromDisplayDensity()

static const ON_SubDDisplayParameters ON_SubDDisplayParameters::CreateFromDisplayDensity ( unsigned int  adaptive_subd_display_density)
static

Description: In most applications, the caller sets the mesh_density and leaves the other parameters set to the default values. Parameters: adaptive_subd_display_density - [in] A value <= ON_SubDDisplayParameters::MaximumDensity. When in doubt, pass ON_SubDDisplayParameters::DefaultDensity. Values < ON_SubDDisplayParameters::MinimumAdaptiveDensity are treated as N_SubDDisplayParameters::MinimumAdaptiveDensity. All other invalid input values are treated as ON_SubDDisplayParameters::DefaultDensity. Returns: A ON_SubDDisplayParameters with adaptive SubD display density.

◆ CreateFromMeshDensity()

static const ON_SubDDisplayParameters ON_SubDDisplayParameters::CreateFromMeshDensity ( double  normalized_mesh_density)
static

Description: This function creates ON_SubDDisplayParameters from a user interface "slider" like Rhino's simple mesh controls. Parameters: normalized_mesh_density - [in] A double between 0.0 and 1.0

The table below shows the correpondence between normalized_density and subd display density.

Mesh density percentage / normalized_mesh_density / subd display density 0% -> [0.0, ON_ZERO_TOLERANCE] -> 1 = adaptive MinimumUserInterfaceDensity 0% to 19% -> (ON_ZERO_TOLERANCE, 0.20) -> 2 = adaptive CoarseDensity 20% to 34% -> [0.20, 0.35) -> 3 = adaptive MediumDensity 35% to 75% -> [0.35, 0.75] -> 4 = adaptive FineDensity 76% to 99% -> (0.75, 1 - ON_ZERO_TOLERANCE) -> 5 = adaptive ExtraFineDensity 100% -> [1 - ON_ZERO_TOLERANCE, 1.0] -> 5 = adaptive MaximumUserInterfaceDensity

Invalid input -> adaptive DefaultDensity;

Returns: A valid ON_SubDDisplayParameters with the specified subd display denstity.

◆ DecodeFromUnsignedChar()

static const ON_SubDDisplayParameters ON_SubDDisplayParameters::DecodeFromUnsignedChar ( unsigned char  encoded_parameters)
static

◆ DisplayDensity() [1/2]

unsigned int ON_SubDDisplayParameters::DisplayDensity ( ) const
Deprecated:
Use DisplayDensity(subd)

◆ DisplayDensity() [2/2]

unsigned int ON_SubDDisplayParameters::DisplayDensity ( const class ON_SubD subd) const

Parameters: subd - [in] Used when the display density is adaptive and subd.FaceCount() > 0. Ignored when the display density is absolute or subd.FaceCount() = 0.

Returns: The absolute display density to use when creating display meshes for subd. When adaptive reduction is enabled, subd.FaceCount() is used to determine the appropriate display density.

Remarks: The chart below shows the relationship between the returned value and the number of display mesh quads a generated by 1 SubD quad.

return display mesh value quads 0 1 = 1x1 1 4 = 2x2 2 16 = 4x4 3 64 = 8x8
4 128 = 16x16 5 1,024 = 32x32 6 4,096 = 64x64

◆ DisplayDensityIsAbsolute()

bool ON_SubDDisplayParameters::DisplayDensityIsAbsolute ( ) const

Returns: True if the SubD display density setting is absolute. Remarks: this->DensityIsAdaptive() and this->DensityIsAbsolute() always return opposite bool values. Use the one that makes your code easiest to read and understand.

◆ DisplayDensityIsAdaptive()

bool ON_SubDDisplayParameters::DisplayDensityIsAdaptive ( ) const

Returns: True if the SubD display density setting is adaptive and approximate display mesh quad count is capped at ON_SubDDisplayParameters::AdaptiveDisplayMeshQuadMaximum. Remarks: this->DensityIsAdaptive() and this->DensityIsAbsolute() always return opposite bool values. Use the one that makes your code easiest to read and understand.

◆ Dump()

void ON_SubDDisplayParameters::Dump ( class ON_TextLog ) const

◆ EncodeAsUnsignedChar()

unsigned char ON_SubDDisplayParameters::EncodeAsUnsignedChar ( ) const

◆ MeshLocation()

ON_SubDComponentLocation ON_SubDDisplayParameters::MeshLocation ( ) const

Description: The MeshLocation() property determines if the mesh is on the SubD's control net or the SubD's surface.

◆ operator=()

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

◆ ProgressReporter()

ON_ProgressReporter* ON_SubDDisplayParameters::ProgressReporter ( ) const

◆ ProgressReporterInterval()

const ON_Interval ON_SubDDisplayParameters::ProgressReporterInterval ( ) const

◆ Read()

bool ON_SubDDisplayParameters::Read ( class ON_BinaryArchive archive)

◆ SetAbsoluteDisplayDensity()

void ON_SubDDisplayParameters::SetAbsoluteDisplayDensity ( unsigned int  absolute_display_density)

Description: In almast all cases, you are better off using SetAdaptiveDisplayDensity(). Parameters: absolute_display_density - [in] absolute_display_density <= ON_SubDDisplayParameters::MaximumDensity Remarks: The use of this setting

◆ SetAdaptiveDisplayDensity()

void ON_SubDDisplayParameters::SetAdaptiveDisplayDensity ( unsigned int  adaptive_display_density)

Description: Set an adaptive SubD display density that caps display mesh quad count at ON_SubDDisplayParameters::AdaptiveDisplayMeshQuadMaximum. Parameters: adaptive_display_density - [in] adaptive_display_density <= ON_SubDDisplayParameters::MaximumDensity Values <= ON_SubDDisplayParameters::MinimumAdaptiveDensity will never be adaptively reduced during display mesh creation. Remarks: The use of this setting

◆ SetContextForExperts()

void ON_SubDDisplayParameters::SetContextForExperts ( ON_SubDDisplayParameters::Context  context)

◆ SetDisplayDensity()

void ON_SubDDisplayParameters::SetDisplayDensity ( unsigned int  adaptive_display_density)

◆ SetMeshLocation()

void ON_SubDDisplayParameters::SetMeshLocation ( ON_SubDComponentLocation  mesh_location)

Description: The MeshLocation() property determines if the mesh is on the SubD's control net or the SubD's surface. Parameters: mesh_location - [in]

◆ SetProgressReporter()

void ON_SubDDisplayParameters::SetProgressReporter ( ON_ProgressReporter progress_reporter,
ON_Interval  progress_reporter_interval 
)

◆ SetTerminator()

void ON_SubDDisplayParameters::SetTerminator ( ON_Terminator terminator)

◆ Terminator()

ON_Terminator* ON_SubDDisplayParameters::Terminator ( ) const

TODO - split this class into two - what's above and one derived from that with what's below.

◆ Write()

bool ON_SubDDisplayParameters::Write ( class ON_BinaryArchive archive) const

Member Data Documentation

◆ Coarse

const ON_SubDDisplayParameters ON_SubDDisplayParameters::Coarse
static

Parameters for a course limit surface display mesh. SubD display density = adaptive ON_SubDDisplayParameters::CoarseDensity

◆ Default

const ON_SubDDisplayParameters ON_SubDDisplayParameters::Default
static

Parameters for the default limit surface display mesh. SubD display density = adaptive ON_SubDDisplayParameters::DefaultDensity

◆ Empty

const ON_SubDDisplayParameters ON_SubDDisplayParameters::Empty
static

◆ ExtraCoarse

const ON_SubDDisplayParameters ON_SubDDisplayParameters::ExtraCoarse
static

Parameters for a course limit surface display mesh. SubD display density = adaptive ON_SubDDisplayParameters::ExtraCoarseDensity

◆ ExtraFine

const ON_SubDDisplayParameters ON_SubDDisplayParameters::ExtraFine
static

Parameters for an extra fine limit surface display mesh. SubD display density = adaptive ON_SubDDisplayParameters::ExtraFineDensity

◆ Fine

const ON_SubDDisplayParameters ON_SubDDisplayParameters::Fine
static

Parameters for the default limit surface display mesh. Produces and acceptable rendering of the SubD Rhino logo. SubD display density = adaptive ON_SubDDisplayParameters::FineDensity (default)

◆ Medium

const ON_SubDDisplayParameters ON_SubDDisplayParameters::Medium
static

Parameters for a medium limit surface display mesh. SubD display density = adaptive ON_SubDDisplayParameters::MediumDensity Too crude for a quality rendering of the SubD Rhino logo.