Rhino C++ API  8.13
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
ON_SubDEdgeSharpness Class Reference

ON_SubDHash provides a simple way to save a SubD's vertex, edge, and face SHA1 hashes. Typically it is used when a calculation needs to know if the current SubD has is geometrically identical to a previous SubD. When speed is not important, comparing the current value of ON_SubD::GeometryHash() to a previously save value of ON_SubD::GeometryHash() is functionally identical but typically much slower when the SubDs are different. More...

#include <opennurbs_subd.h>

Public Member Functions

 ON_SubDEdgeSharpness ()=default
 
 ON_SubDEdgeSharpness (const ON_SubDEdgeSharpness &)=default
 
 ~ON_SubDEdgeSharpness ()=default
 
double Average () const
 Return the average of the sharpness interval. More...
 
double Delta () const
 
double EndSharpness (int end_index) const
 Get the sharpness at the start or end. More...
 
bool IsConstant () const
 
bool IsConstant (bool bCreaseResult) const
 
bool IsCrease () const
 
bool IsCreaseOrSharp () const
 
bool IsDecreasing () const
 
bool IsIncreasing () const
 
bool IsNotValid () const
 
bool IsNotValid (bool bCreaseResult) const
 
bool IsSharp () const
 
bool IsValid () const
 
bool IsValid (bool bCreaseResult) const
 
bool IsVariable () const
 
bool IsZero () const
 
Returns
True if the sharpness is zero.
More...
 
double MaximumEndSharpness () const
 Return the maximum of the sharpness interval. More...
 
double MinimumEndSharpness () const
 Return the minimum of the sharpness interval. More...
 
ON_SubDEdgeSharpnessoperator= (const ON_SubDEdgeSharpness &)=default
 
double operator[] (int end_index) const
 Get the edge sharpness at the start or end. More...
 
const ON_SubDEdgeSharpness Reversed () const
 
const ON_SubDEdgeSharpness Subdivided (int end_index) const
 Sharpness value for a subdivided edge. More...
 
const ON_wString ToPercentageText (bool bOrderMinToMax) const
 Create a text string describing the sharpness as a percentage. If the sharpness is constant, and single percentage is returned. If the sharpness is variable, percentage range returned. If the sharpness is not valid, a warning sign is returned. More...
 
int Trend () const
 

Static Public Member Functions

static bool EqualDelta (const class ON_SubDEdgePtr &eptr0, const class ON_SubDEdgePtr &eptr1)
 Determine if edges are adjacent, have the same sharpness trend, and equal adjacent sharpness values. More...
 
static bool EqualDelta (ON_SubDEdgeSharpness s0, ON_SubDEdgeSharpness s1)
 
static bool EqualEndSharpness (const class ON_SubDEdgePtr &eptr0, const class ON_SubDEdgePtr &eptr1)
 Determine if edges are adjacent and have equal adjacent sharpness values. More...
 
static bool EqualEndSharpness (ON_SubDEdgeSharpness s0, ON_SubDEdgeSharpness s1)
 
static bool EqualTrend (const class ON_SubDEdgePtr &eptr0, const class ON_SubDEdgePtr &eptr1)
 Determine if edges are adjacent, have the same sharpness trend, and equal adjacent sharpness values. More...
 
static bool EqualTrend (ON_SubDEdgeSharpness s0, ON_SubDEdgeSharpness s1)
 
static const ON_SubDEdgeSharpness FromConstant (double sharpness)
 Create a constant ON_SubDEdgeSharpness; More...
 
static const ON_SubDEdgeSharpness FromInterval (const class ON_Interval &sharpness_interval)
 Create a variable ON_SubDEdgeSharpness; More...
 
static const ON_SubDEdgeSharpness FromInterval (double sharpness0, double sharpness1)
 Create a variable ON_SubDEdgeSharpness; More...
 
static bool IsConstant (const ON_SimpleArray< ON_SubDEdgePtr > &edges, bool bCreaseResult)
 Determine if all the input edges have idential constant sharpeness. More...
 
static bool IsConstant (size_t edge_count, const ON_SubDEdgePtr *edges, bool bCreaseResult)
 Determine if all the input edges have idential constant sharpeness. More...
 
static bool IsValidValue (double candidate_value, bool bCreaseResult)
 Determine if candidate_value is a valid edge end sharpness value. More...
 
static double Sanitize (double sharpness)
 Verify 0 <= sharpness <= ON_SubDEdgeSharpness::MaximumValue and return an integer value when the input sharpenss is within ON_SubDEdgeSharpness::Tolerance of an integer. More...
 
static double Sanitize (double sharpness, double invalid_input_result)
 Verify 0 <= sharpness <= ON_SubDEdgeSharpness::MaximumValue and return an integer value when the input sharpenss is within ON_SubDEdgeSharpness::Tolerance of an integer. More...
 
static unsigned SetEdgeChainSharpness (ON_Interval chain_sharpness_range, unsigned edge_count, ON_SimpleArray< ON_SubDEdgeSharpness > &chain_edge_sharpness)
 Set chain_edge_sharpness to a sequence of evenly changing sharpnesses beginning with chain_sharpness_range[0] and ending with chain_sharpness_range[1]. More...
 
static unsigned SetEdgeChainSharpness (ON_Interval chain_sharpness_range, unsigned edge_count, ON_SubDEdgeSharpness *chain_edge_sharpness)
 Set chain_edge_sharpness to a sequence of evenly changing sharpnesses beginning with chain_sharpness_range[0] and ending with chain_sharpness_range[1]. More...
 
static double SharpnessFromNormalizedValue (double normalized_slider_value)
 Convert a user facing slider value to a SubD edge end sharpness value. More...
 
static double SharpnessFromSliderValue (ON_Interval slider_domain, double slider_value, double invalid_input_result)
 Convert a user facing slider value to a SubD edge end sharpness value. More...
 
static double ToPercentage (double sharpness, double crease_percentage)
 Convert sharpness to a percentage from 0 to 100.0. This is useful in user interface code that experesses sharpness in percentages. More...
 
static const ON_wString ToPercentageText (double sharpness)
 Create a text string describing the sharpness as a percentage. This is useful in user interface code that expresses sharpness in percentages. If 0 <= sharpness <= ON_SubDEdgeSharpness::MaximumValue, valid, a number followed by a percent sign is returned. If sharpness = ON_SubDEdgeSharpness::CreaseValue, "crease" is returned. If the sharpness is not valid, a warning sign is returned. More...
 
static const ON_SubDEdgeSharpness Union (const ON_SubDEdgeSharpness &a, const ON_SubDEdgeSharpness &b)
 Return a sharpness interval that is the union of the nonzero input sharpness intervals. More...
 
static double VertexSharpness (ON_SubDVertexTag vertex_tag, double interior_crease_vertex_sharpness, unsigned sharp_edge_end_count, double maximum_edge_sharpness_at_vertex)
 Calculate the vertex sharpness from the attached sharp edge information. Note that vertices with a corner tag always have zero sharpness. More...
 
static double VertexSharpness (ON_SubDVertexTag vertex_tag, unsigned sharp_edge_end_count, double maximum_edge_end_sharpness)
 

Static Public Attributes

static const ON_SubDEdgeSharpness Crease
 An edge sharpness with both end values = ON_SubDEdgeSharpness::CreaseValue. This value is not a valid sharpness value for a sharp edge (A sharp edge a smooth edge with nonzero sharpness). When working with edges, it is sometimes convenient to have an ON_SubDEdgeSharpness value that indicated the edge is a crease. ON_SubDEdgeSharpness::Crease is used for this purpose. More...
 
static const double CreaseValue
 ON_SubDEdgeSharpness::CreaseValue = ON_SubDEdgeSharpness::MaximumValue + 1. Valid SubD edge sharpness values are <= ON_SubDEdgeSharpness::MaximumValue. This value is used when it is convenient to use and ON_SubDEdgeSharpness to indicate an edge has a crease tag. Edges with crease tags always have a sharpness property of ON_SubDEdgeSharpness::Smooth. More...
 
static const ON_SubDEdgeSharpness Maximum
 An edge sharpness with constant value ON_SubDEdgeSharpness::MaximumValue. This is the maximum sharpness that can be applied to an edge. More...
 
static const double MaximumValue
 ON_SubDEdgeSharpness::MaximumValue = 4. SubD edge sharpness values are <= ON_SubDEdgeSharpness::MaximumValue. More...
 
static const ON_SubDEdgeSharpness Nan
 An edge sharpness with both end values = ON_DBL_QNAN. More...
 
static const ON_SubDEdgeSharpness Smooth
 An edge sharpness with constant value 0.0. More...
 
static const double SmoothValue
 ON_SubDEdgeSharpness::SmoothValue = 0.0. Valid SubD edge sharpness values are <= ON_SubDEdgeSharpness::MaximumValue. Smooth edges have a sharpness property of ON_SubDEdgeSharpness::Smooth. More...
 
static const double Tolerance
 ON_SubDEdgeSharpness::Tolerance = 0.01 If an edge has sharpness within ON_SubDEdgeSharpness::Tolerance of an integer value, the sharpness is set to that integer value. More...
 

Detailed Description

ON_SubDHash provides a simple way to save a SubD's vertex, edge, and face SHA1 hashes. Typically it is used when a calculation needs to know if the current SubD has is geometrically identical to a previous SubD. When speed is not important, comparing the current value of ON_SubD::GeometryHash() to a previously save value of ON_SubD::GeometryHash() is functionally identical but typically much slower when the SubDs are different.

Constructor & Destructor Documentation

◆ ON_SubDEdgeSharpness() [1/2]

ON_SubDEdgeSharpness::ON_SubDEdgeSharpness ( )
default

◆ ~ON_SubDEdgeSharpness()

ON_SubDEdgeSharpness::~ON_SubDEdgeSharpness ( )
default

◆ ON_SubDEdgeSharpness() [2/2]

ON_SubDEdgeSharpness::ON_SubDEdgeSharpness ( const ON_SubDEdgeSharpness )
default

Member Function Documentation

◆ Average()

double ON_SubDEdgeSharpness::Average ( ) const

Return the average of the sharpness interval.

Returns
0.5*(sharpness[0]+sharpness[1])

◆ Delta()

double ON_SubDEdgeSharpness::Delta ( ) const
Returns
If IsValid() or IsCrease() is true, then EndSharpness(1) - EndSharpness(0) is returned. Otherwise ON_DBL_QNAN is returned.

◆ EndSharpness()

double ON_SubDEdgeSharpness::EndSharpness ( int  end_index) const

Get the sharpness at the start or end.

Parameters
end_index0 or 1.
Returns
Sharpness or ON_DBL_QNAN if end_index is out of range.

◆ EqualDelta() [1/2]

static bool ON_SubDEdgeSharpness::EqualDelta ( const class ON_SubDEdgePtr eptr0,
const class ON_SubDEdgePtr eptr1 
)
static

Determine if edges are adjacent, have the same sharpness trend, and equal adjacent sharpness values.

Parameters
eptr0
eptr1
Returns
If the edges have the same tag, eptr0.RelativeVertex(1) = eptr1.RelativeVertex(0), and then ON_SubDEdgeSharpness::EqualDelta(eptr0.RelativeSharpness(),eptr1.RelativeSharpness()) is returned. Otherwise false is returned.

◆ EqualDelta() [2/2]

static bool ON_SubDEdgeSharpness::EqualDelta ( ON_SubDEdgeSharpness  s0,
ON_SubDEdgeSharpness  s1 
)
static

Determine if sharpnesses have the same delta and equal adjacent end sharpness values.

Parameters
s0
s1
Returns
If s0.Delta() = s1.Delta() and s0.EndSharpness(1) == s1.EndSharpness(0), then true is returned. Otherwise false is returned.

◆ EqualEndSharpness() [1/2]

static bool ON_SubDEdgeSharpness::EqualEndSharpness ( const class ON_SubDEdgePtr eptr0,
const class ON_SubDEdgePtr eptr1 
)
static

Determine if edges are adjacent and have equal adjacent sharpness values.

Parameters
eptr0
eptr1
Returns
If the edges have the same tag, eptr0.RelativeVertex(1) = eptr1.RelativeVertex(0), and then ON_SubDEdgeSharpness::EqualEndSharpness(eptr0.RelativeSharpness(),eptr1.RelativeSharpness()) is returned. Otherwise false is returned.

◆ EqualEndSharpness() [2/2]

static bool ON_SubDEdgeSharpness::EqualEndSharpness ( ON_SubDEdgeSharpness  s0,
ON_SubDEdgeSharpness  s1 
)
static

Determine if sharpnesses have equal adjacent end sharpness values.

Parameters
s0
s1
Returns
If s0.EndSharpness(1) == s1.EndSharpness(0), then true is returned. Otherwise false is returned.

◆ EqualTrend() [1/2]

static bool ON_SubDEdgeSharpness::EqualTrend ( const class ON_SubDEdgePtr eptr0,
const class ON_SubDEdgePtr eptr1 
)
static

Determine if edges are adjacent, have the same sharpness trend, and equal adjacent sharpness values.

Parameters
eptr0
eptr1
Returns
If the edges have the same tag, eptr0.RelativeVertex(1) = eptr1.RelativeVertex(0), and then ON_SubDEdgeSharpness::EqualTrend(eptr0.RelativeSharpness(),eptr1.RelativeSharpness()) is returned. Otherwise false is returned.

◆ EqualTrend() [2/2]

static bool ON_SubDEdgeSharpness::EqualTrend ( ON_SubDEdgeSharpness  s0,
ON_SubDEdgeSharpness  s1 
)
static

Determine if sharpnesses have the same trend and equal adjacent end sharpness values.

Parameters
s0
s1
Returns
If s0.Trend() = s1.Trend() and s0.EndSharpness(1) == s1.EndSharpness(0), then true is returned. Otherwise false is returned.

◆ FromConstant()

static const ON_SubDEdgeSharpness ON_SubDEdgeSharpness::FromConstant ( double  sharpness)
static

Create a constant ON_SubDEdgeSharpness;

Parameters
sharpness0 <= sharpness <= ON_SubDEdgeSharpness::MaximumValue
Returns
If the input values is valid, an ON_SubDEdgeSharpness with constant value sharpness is returned. If the input vaue is ON_SubDEdgeSharpness::CreaseValue, ON_SubDEdgeSharpness::Crease is returned. Otherwise ON_SubDEdgeSharpness::Nan is returned.

◆ FromInterval() [1/2]

static const ON_SubDEdgeSharpness ON_SubDEdgeSharpness::FromInterval ( const class ON_Interval sharpness_interval)
static

Create a variable ON_SubDEdgeSharpness;

Parameters
sharpness_interval0 <= sharpness0 <= ON_SubDEdgeSharpness::MaximumValue
Returns
If the interval's values are valid, an edge sharpness with start value sharpness_interval[0] and end value sharpness_interval[1] is returned. If both sharpness_interval[] values are ON_SubDEdgeSharpness::CreaseValue, ON_SubDEdgeSharpness::Crease::Crease is returned. Otherwise ON_SubDEdgeSharpness::Nan is returned.

◆ FromInterval() [2/2]

static const ON_SubDEdgeSharpness ON_SubDEdgeSharpness::FromInterval ( double  sharpness0,
double  sharpness1 
)
static

Create a variable ON_SubDEdgeSharpness;

Parameters
sharpness00 <= sharpness0 <= ON_SubDEdgeSharpness::MaximumValue
sharpness10 <= sharpness1 <= ON_SubDEdgeSharpness::MaximumValue
Returns
If both input values are valid, an edge sharpness with start value sharpness0 and end value sharpness1 is returned. If both input values are ON_SubDEdgeSharpness::CreaseValue, ON_SubDEdgeSharpness::Crease::Crease is returned. Otherwise ON_SubDEdgeSharpness::Nan is returned.

◆ IsConstant() [1/4]

bool ON_SubDEdgeSharpness::IsConstant ( ) const
Returns
If the sharpness value is valid and contant, returns true. Otherwise returns false. Note that ON_SubDEdgeSharpness::Crease.IsConstant() and ON_SubDEdgeSharpness::Nan.IsConstant() are both false. /returns>

◆ IsConstant() [2/4]

bool ON_SubDEdgeSharpness::IsConstant ( bool  bCreaseResult) const
Parameters
bCreaseResultValue to return when this is equal to ON_SubDEdgeSharpness::Crease.
Returns
If this is equal to ON_SubDEdgeSharpness::Crease, returns bCreaseResult. If the sharpness value is valid and contant, returns true. Otherwise returns false.

◆ IsConstant() [3/4]

static bool ON_SubDEdgeSharpness::IsConstant ( const ON_SimpleArray< ON_SubDEdgePtr > &  edges,
bool  bCreaseResult 
)
static

Determine if all the input edges have idential constant sharpeness.

Parameters
edges
bCreaseResultResult to return if all the edges are creases.
Returns
True if all edges have identical constant sharpness.

◆ IsConstant() [4/4]

static bool ON_SubDEdgeSharpness::IsConstant ( size_t  edge_count,
const ON_SubDEdgePtr edges,
bool  bCreaseResult 
)
static

Determine if all the input edges have idential constant sharpeness.

Parameters
edge_count
edges
bCreaseResultResult to return if all the edges are creases.
Returns
True if all edges have identical constant sharpness.

◆ IsCrease()

bool ON_SubDEdgeSharpness::IsCrease ( ) const
Returns
If the sharpness value is (ON_SubDEdgeSharpness::CreaseValue,ON_SubDEdgeSharpness::CreaseValue), returns true. Otherwise false is returned. In particular, ON_SubDEdgeSharpness::Crease.IsCrease() is true and all other values return false.

◆ IsCreaseOrSharp()

bool ON_SubDEdgeSharpness::IsCreaseOrSharp ( ) const
Returns
(IsCrease() || IsSharp())

◆ IsDecreasing()

bool ON_SubDEdgeSharpness::IsDecreasing ( ) const
Returns
If EndSharpness(0) < EndSharpness(1), true is returned. Otherwise false is returned.

◆ IsIncreasing()

bool ON_SubDEdgeSharpness::IsIncreasing ( ) const
Returns
If EndSharpness(0) > EndSharpness(1), true is returned. Otherwise false is returned.

◆ IsNotValid() [1/2]

bool ON_SubDEdgeSharpness::IsNotValid ( ) const
Returns
Returns the opposite of IsValid(). Note that ON_SubDEdgeSharpness::Crease.IsNotValid() and ON_SubDEdgeSharpness::Nan.IsNotValid() are both true.

◆ IsNotValid() [2/2]

bool ON_SubDEdgeSharpness::IsNotValid ( bool  bCreaseResult) const
Parameters
bCreaseResultValue to return when this is equal to ON_SubDEdgeSharpness::Crease.
Returns
If this is equal to ON_SubDEdgeSharpness::Crease, returns bCreaseResult. Otherwise returns the opposite of IsValid().

◆ IsSharp()

bool ON_SubDEdgeSharpness::IsSharp ( ) const
Returns
If both end sharpness values are >= 0 and <= ON_SubDEdgeSharpness::MaximumValue and at least one end sharpness value is > 0, returns true. Otherwise returns false. Note that ON_SubDEdgeSharpness::Crease.IsSharp() and ON_SubDEdgeSharpness::Nan.IsSharp() are both false;

◆ IsValid() [1/2]

bool ON_SubDEdgeSharpness::IsValid ( ) const
Returns
If both end sharpness values are >= 0 and <= ON_SubDEdgeSharpness::MaximumValue, returns true. Note that ON_SubDEdgeSharpness::Crease.IsValid() and ON_SubDEdgeSharpness::Nan.IsValid() are both false.

◆ IsValid() [2/2]

bool ON_SubDEdgeSharpness::IsValid ( bool  bCreaseResult) const
Parameters
bCreaseResultValue to return when this is equal to ON_SubDEdgeSharpness::Crease.
Returns
If both end sharpness values are >= 0 and <= ON_SubDEdgeSharpness::MaximumValue, returns true. If this is equal to ON_SubDEdgeSharpness::Crease, returns bCreaseResult. Otherwise returns false.

◆ IsValidValue()

static bool ON_SubDEdgeSharpness::IsValidValue ( double  candidate_value,
bool  bCreaseResult 
)
static

Determine if candidate_value is a valid edge end sharpness value.

Parameters
candidate_valuevalue to check
bCreaseResultValue to return when ON_SubDEdgeSharpness::CreaseValue == candidate_value
Returns

◆ IsVariable()

bool ON_SubDEdgeSharpness::IsVariable ( ) const
Returns
True if the sharpness value is valid and variable. Note that ON_SubDEdgeSharpness::Crease.IsVariable() and ON_SubDEdgeSharpness::Nan.IsVariable() are both false.

◆ IsZero()

bool ON_SubDEdgeSharpness::IsZero ( ) const

Returns
True if the sharpness is zero.

◆ MaximumEndSharpness()

double ON_SubDEdgeSharpness::MaximumEndSharpness ( ) const

Return the maximum of the sharpness interval.

Returns
The maximum of the sharpness interval

◆ MinimumEndSharpness()

double ON_SubDEdgeSharpness::MinimumEndSharpness ( ) const

Return the minimum of the sharpness interval.

Returns
The minimum of the sharpness interval

◆ operator=()

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

◆ operator[]()

double ON_SubDEdgeSharpness::operator[] ( int  end_index) const

Get the edge sharpness at the start or end.

<param name="end_index"0 or 1.

Returns
EndSharpness(end_index).

◆ Reversed()

const ON_SubDEdgeSharpness ON_SubDEdgeSharpness::Reversed ( ) const

◆ Sanitize() [1/2]

static double ON_SubDEdgeSharpness::Sanitize ( double  sharpness)
static

Verify 0 <= sharpness <= ON_SubDEdgeSharpness::MaximumValue and return an integer value when the input sharpenss is within ON_SubDEdgeSharpness::Tolerance of an integer.

Parameters
sharpness
Returns
SubD edge sharpness value that makes sense or 0.0 if the input sharpness is invalid.

◆ Sanitize() [2/2]

static double ON_SubDEdgeSharpness::Sanitize ( double  sharpness,
double  invalid_input_result 
)
static

Verify 0 <= sharpness <= ON_SubDEdgeSharpness::MaximumValue and return an integer value when the input sharpenss is within ON_SubDEdgeSharpness::Tolerance of an integer.

Parameters
sharpness
invalid_input_resultValue returned when the sharpness parameter is invalid.
Returns
SubD edge sharpness value that makes sense.

◆ SetEdgeChainSharpness() [1/2]

static unsigned ON_SubDEdgeSharpness::SetEdgeChainSharpness ( ON_Interval  chain_sharpness_range,
unsigned  edge_count,
ON_SimpleArray< ON_SubDEdgeSharpness > &  chain_edge_sharpness 
)
static

Set chain_edge_sharpness to a sequence of evenly changing sharpnesses beginning with chain_sharpness_range[0] and ending with chain_sharpness_range[1].

Parameters
chain_sharpness_rangeBeginning and ending sharpnesses.
edge_countNumber of edges in the chain.
chain_edge_sharpnessThe list of sharpnesses is returned here.
Returns
If the sharpness is constant, 1 is returned. If the sharpness varies from edge to edge, edge_count is returned. Otherwise 0 is returned.

◆ SetEdgeChainSharpness() [2/2]

static unsigned ON_SubDEdgeSharpness::SetEdgeChainSharpness ( ON_Interval  chain_sharpness_range,
unsigned  edge_count,
ON_SubDEdgeSharpness chain_edge_sharpness 
)
static

Set chain_edge_sharpness to a sequence of evenly changing sharpnesses beginning with chain_sharpness_range[0] and ending with chain_sharpness_range[1].

Parameters
chain_sharpness_rangeBeginning and ending sharpnesses.
edge_countNumber of edges in the chain.
chain_edge_sharpnessThe list of sharpnesses is returned here. chain_edge_sharpness[] must have a capacity >= edge_count.
Returns
If the sharpness is constant, 1 is returned. If the sharpness varies from edge to edge, edge_count is returned. Otherwise 0 is returned.

◆ SharpnessFromNormalizedValue()

static double ON_SubDEdgeSharpness::SharpnessFromNormalizedValue ( double  normalized_slider_value)
static

Convert a user facing slider value to a SubD edge end sharpness value.

Parameters
slider_domainNon empty slider domain. (Often ON_Interval::ZeroToOne.)
normalized_slider_value0 <= normalized_slider_value <= 1.
invalid_input_resultValue to return if the input is not valid.
Returns
If 0 <= normalized_slider_value <= 1, the normalized slider value converted to an ON_SubDEdge sharpness value from 0 to ON_SubDEdgeSharpness::MaximumValue. Otherwise, ON_DBL_QNAN is returned.

◆ SharpnessFromSliderValue()

static double ON_SubDEdgeSharpness::SharpnessFromSliderValue ( ON_Interval  slider_domain,
double  slider_value,
double  invalid_input_result 
)
static

Convert a user facing slider value to a SubD edge end sharpness value.

Parameters
slider_domainNon empty slider domain. (Often ON_Interval::ZeroToOne.)
slider_valueA value in the slider_domain. slider_domain[0] returns 0.0. slider_domain[1] returns ON_SubDEdgeSharpness::MaximumValue.
invalid_input_resultValue to return if the input is not valid.
Returns
The slider value converted to an ON_SubDEdge sharpness value.

◆ Subdivided()

const ON_SubDEdgeSharpness ON_SubDEdgeSharpness::Subdivided ( int  end_index) const

Sharpness value for a subdivided edge.

<param name="end_index"0 or 1.

Returns
Subdivided sharpness or ON_SubDEdgeSharpness::Smooth if index is out of range.

◆ ToPercentage()

static double ON_SubDEdgeSharpness::ToPercentage ( double  sharpness,
double  crease_percentage 
)
static

Convert sharpness to a percentage from 0 to 100.0. This is useful in user interface code that experesses sharpness in percentages.

Parameters
sharpness
crease_percentage
Returns
If 0 <= sharpness <= ON_SubDEdgeSharpness::MaximumValue, then 100.0*sharpness/ON_SubDEdgeSharpness::MaximumValue is returned. If sharpness = ON_SubDEdgeSharpness::CreaseValue, then crease_percentage is returned. Otherwise ON_DBL_QNAN is returned.

◆ ToPercentageText() [1/2]

const ON_wString ON_SubDEdgeSharpness::ToPercentageText ( bool  bOrderMinToMax) const

Create a text string describing the sharpness as a percentage. If the sharpness is constant, and single percentage is returned. If the sharpness is variable, percentage range returned. If the sharpness is not valid, a warning sign is returned.

Parameters
bOrderMinToMaxIf the sharpness is not constant and bOrderMinToMax is true, then the string has the format min%-max%. If the sharpness is not constant and bOrderMinToMax is false, then the string has the format EndSharpness(0)%-EndSharpness(1)%.
Returns
A string describing the sharpness as a percentage range.

◆ ToPercentageText() [2/2]

static const ON_wString ON_SubDEdgeSharpness::ToPercentageText ( double  sharpness)
static

Create a text string describing the sharpness as a percentage. This is useful in user interface code that expresses sharpness in percentages. If 0 <= sharpness <= ON_SubDEdgeSharpness::MaximumValue, valid, a number followed by a percent sign is returned. If sharpness = ON_SubDEdgeSharpness::CreaseValue, "crease" is returned. If the sharpness is not valid, a warning sign is returned.

Parameters
sharpness
Returns

◆ Trend()

int ON_SubDEdgeSharpness::Trend ( ) const
Returns
If EndSharpness(0) < EndSharpness(1), +1 is returned. If EndSharpness(0) > EndSharpness(1), -1 is returned. If EndSharpness(0) = EndSharpness(1), 0 is returned. Otherwise ON_UNSET_INT_INDEX is returned.

◆ Union()

static const ON_SubDEdgeSharpness ON_SubDEdgeSharpness::Union ( const ON_SubDEdgeSharpness a,
const ON_SubDEdgeSharpness b 
)
static

Return a sharpness interval that is the union of the nonzero input sharpness intervals.

Parameters
a
b
Returns
If an input parameter is ON_SubDEdgeSharpness::Smooth, ON_SubDEdgeSharpness::Crease, or ON_SubDEdgeSharpness::Nan, then that parameter it is ignored. The returned interval is the union of the nonzero valid input intervals. If no input intervals are nonzero, then ON_SubDEdgeSharpness::Smooth is returned. Either the returned sharpness is ON_SubDEdgeSharpness::Smooth or has 0.0 < sharpness[0] <= sharpness[1] <= ON_SubDEdgeSharpness::MaximumValue.

◆ VertexSharpness() [1/2]

static double ON_SubDEdgeSharpness::VertexSharpness ( ON_SubDVertexTag  vertex_tag,
double  interior_crease_vertex_sharpness,
unsigned  sharp_edge_end_count,
double  maximum_edge_sharpness_at_vertex 
)
static

Calculate the vertex sharpness from the attached sharp edge information. Note that vertices with a corner tag always have zero sharpness.

Parameters
vertex_tagThe vertex tag (smooth, crease, dart, corner). For smooth, crease, and dart, this is used to determine the number of attached crease edges. COrner vertices always have sharpness = 0.
interior_crease_vertex_sharpnessIf the original source of the vertex is an interior crease vertex (vertex_tag = ON_SubDVertexTag::Crease, 2 sectors, EdgeCount() = FaceCount() >= 2), then interior_crease_vertex_sharpness is the maximum edge sharpness at the vertex's end of all smooth edges from both sectors. This paramter is important in special situations that occur in low level SubD evaluation code where information from only one sector is present. In all other cases, this value doesn't matter as long as interior_crease_vertex_sharpness <= maximum_edge_sharpness_at_vertex. When in doubt pass 0.0 or ON_DBL_QNAN.
sharp_edge_end_countNumber of sharp edges attached to the vertex that have nonzero end sharpness at the vertex.
maximum_edge_sharpness_at_vertexThe largest sharp edge end sharpness at the vertex.
Returns
The vertex sharpness value to use when subdividing the vertex.

◆ VertexSharpness() [2/2]

static double ON_SubDEdgeSharpness::VertexSharpness ( ON_SubDVertexTag  vertex_tag,
unsigned  sharp_edge_end_count,
double  maximum_edge_end_sharpness 
)
static
Deprecated:
Use the version with an interior_crease_vertex_sharpness parameter.

Member Data Documentation

◆ Crease

const ON_SubDEdgeSharpness ON_SubDEdgeSharpness::Crease
static

An edge sharpness with both end values = ON_SubDEdgeSharpness::CreaseValue. This value is not a valid sharpness value for a sharp edge (A sharp edge a smooth edge with nonzero sharpness). When working with edges, it is sometimes convenient to have an ON_SubDEdgeSharpness value that indicated the edge is a crease. ON_SubDEdgeSharpness::Crease is used for this purpose.

◆ CreaseValue

const double ON_SubDEdgeSharpness::CreaseValue
static

ON_SubDEdgeSharpness::CreaseValue = ON_SubDEdgeSharpness::MaximumValue + 1. Valid SubD edge sharpness values are <= ON_SubDEdgeSharpness::MaximumValue. This value is used when it is convenient to use and ON_SubDEdgeSharpness to indicate an edge has a crease tag. Edges with crease tags always have a sharpness property of ON_SubDEdgeSharpness::Smooth.

◆ Maximum

const ON_SubDEdgeSharpness ON_SubDEdgeSharpness::Maximum
static

An edge sharpness with constant value ON_SubDEdgeSharpness::MaximumValue. This is the maximum sharpness that can be applied to an edge.

◆ MaximumValue

const double ON_SubDEdgeSharpness::MaximumValue
static

◆ Nan

const ON_SubDEdgeSharpness ON_SubDEdgeSharpness::Nan
static

An edge sharpness with both end values = ON_DBL_QNAN.

◆ Smooth

const ON_SubDEdgeSharpness ON_SubDEdgeSharpness::Smooth
static

An edge sharpness with constant value 0.0.

◆ SmoothValue

const double ON_SubDEdgeSharpness::SmoothValue
static

ON_SubDEdgeSharpness::SmoothValue = 0.0. Valid SubD edge sharpness values are <= ON_SubDEdgeSharpness::MaximumValue. Smooth edges have a sharpness property of ON_SubDEdgeSharpness::Smooth.

◆ Tolerance

const double ON_SubDEdgeSharpness::Tolerance
static

ON_SubDEdgeSharpness::Tolerance = 0.01 If an edge has sharpness within ON_SubDEdgeSharpness::Tolerance of an integer value, the sharpness is set to that integer value.