Rhino C++ API
8.14
|
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 |
| |
double | MaximumEndSharpness () const |
Return the maximum of the sharpness interval. More... | |
double | MinimumEndSharpness () const |
Return the minimum of the sharpness interval. More... | |
ON_SubDEdgeSharpness & | operator= (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... | |
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.
|
default |
|
default |
|
default |
double ON_SubDEdgeSharpness::Average | ( | ) | const |
Return the average of the sharpness interval.
double ON_SubDEdgeSharpness::Delta | ( | ) | const |
double ON_SubDEdgeSharpness::EndSharpness | ( | int | end_index | ) | const |
Get the sharpness at the start or end.
end_index | 0 or 1. |
|
static |
Determine if edges are adjacent, have the same sharpness trend, and equal adjacent sharpness values.
eptr0 | |
eptr1 |
|
static |
Determine if sharpnesses have the same delta and equal adjacent end sharpness values.
s0 | |
s1 |
|
static |
Determine if edges are adjacent and have equal adjacent sharpness values.
eptr0 | |
eptr1 |
|
static |
Determine if sharpnesses have equal adjacent end sharpness values.
s0 | |
s1 |
|
static |
Determine if edges are adjacent, have the same sharpness trend, and equal adjacent sharpness values.
eptr0 | |
eptr1 |
|
static |
Determine if sharpnesses have the same trend and equal adjacent end sharpness values.
s0 | |
s1 |
|
static |
Create a constant ON_SubDEdgeSharpness;
sharpness | 0 <= sharpness <= ON_SubDEdgeSharpness::MaximumValue |
|
static |
Create a variable ON_SubDEdgeSharpness;
sharpness_interval | 0 <= sharpness0 <= ON_SubDEdgeSharpness::MaximumValue |
|
static |
Create a variable ON_SubDEdgeSharpness;
sharpness0 | 0 <= sharpness0 <= ON_SubDEdgeSharpness::MaximumValue |
sharpness1 | 0 <= sharpness1 <= ON_SubDEdgeSharpness::MaximumValue |
bool ON_SubDEdgeSharpness::IsConstant | ( | ) | const |
bool ON_SubDEdgeSharpness::IsConstant | ( | bool | bCreaseResult | ) | const |
bCreaseResult | Value to return when this is equal to ON_SubDEdgeSharpness::Crease. |
|
static |
Determine if all the input edges have idential constant sharpeness.
edges | |
bCreaseResult | Result to return if all the edges are creases. |
|
static |
Determine if all the input edges have idential constant sharpeness.
edge_count | |
edges | |
bCreaseResult | Result to return if all the edges are creases. |
bool ON_SubDEdgeSharpness::IsCrease | ( | ) | const |
bool ON_SubDEdgeSharpness::IsCreaseOrSharp | ( | ) | const |
bool ON_SubDEdgeSharpness::IsDecreasing | ( | ) | const |
bool ON_SubDEdgeSharpness::IsIncreasing | ( | ) | const |
bool ON_SubDEdgeSharpness::IsNotValid | ( | ) | const |
bool ON_SubDEdgeSharpness::IsNotValid | ( | bool | bCreaseResult | ) | const |
bCreaseResult | Value to return when this is equal to ON_SubDEdgeSharpness::Crease. |
bool ON_SubDEdgeSharpness::IsSharp | ( | ) | const |
bool ON_SubDEdgeSharpness::IsValid | ( | ) | const |
bool ON_SubDEdgeSharpness::IsValid | ( | bool | bCreaseResult | ) | const |
bCreaseResult | Value to return when this is equal to ON_SubDEdgeSharpness::Crease. |
|
static |
Determine if candidate_value is a valid edge end sharpness value.
candidate_value | value to check |
bCreaseResult | Value to return when ON_SubDEdgeSharpness::CreaseValue == candidate_value |
bool ON_SubDEdgeSharpness::IsVariable | ( | ) | const |
bool ON_SubDEdgeSharpness::IsZero | ( | ) | const |
double ON_SubDEdgeSharpness::MaximumEndSharpness | ( | ) | const |
Return the maximum of the sharpness interval.
double ON_SubDEdgeSharpness::MinimumEndSharpness | ( | ) | const |
Return the minimum of the sharpness interval.
|
default |
double ON_SubDEdgeSharpness::operator[] | ( | int | end_index | ) | const |
Get the edge sharpness at the start or end.
<param name="end_index"0 or 1.
const ON_SubDEdgeSharpness ON_SubDEdgeSharpness::Reversed | ( | ) | const |
|
static |
Verify 0 <= sharpness <= ON_SubDEdgeSharpness::MaximumValue and return an integer value when the input sharpenss is within ON_SubDEdgeSharpness::Tolerance of an integer.
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.
sharpness | |
invalid_input_result | Value returned when the sharpness parameter is invalid. |
|
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].
chain_sharpness_range | Beginning and ending sharpnesses. |
edge_count | Number of edges in the chain. |
chain_edge_sharpness | The list of sharpnesses is returned here. |
|
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].
chain_sharpness_range | Beginning and ending sharpnesses. |
edge_count | Number of edges in the chain. |
chain_edge_sharpness | The list of sharpnesses is returned here. chain_edge_sharpness[] must have a capacity >= edge_count. |
|
static |
Convert a user facing slider value to a SubD edge end sharpness value.
slider_domain | Non empty slider domain. (Often ON_Interval::ZeroToOne.) |
normalized_slider_value | 0 <= normalized_slider_value <= 1. |
invalid_input_result | Value to return if the input is not valid. |
|
static |
Convert a user facing slider value to a SubD edge end sharpness value.
slider_domain | Non empty slider domain. (Often ON_Interval::ZeroToOne.) |
slider_value | A value in the slider_domain. slider_domain[0] returns 0.0. slider_domain[1] returns ON_SubDEdgeSharpness::MaximumValue. |
invalid_input_result | Value to return if the input is not valid. |
const ON_SubDEdgeSharpness ON_SubDEdgeSharpness::Subdivided | ( | int | end_index | ) | const |
Sharpness value for a subdivided edge.
<param name="end_index"0 or 1.
|
static |
Convert sharpness to a percentage from 0 to 100.0. This is useful in user interface code that experesses sharpness in percentages.
sharpness | |
crease_percentage |
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.
bOrderMinToMax | If 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)%. |
|
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.
sharpness |
int ON_SubDEdgeSharpness::Trend | ( | ) | const |
|
static |
Return a sharpness interval that is the union of the nonzero input sharpness intervals.
a | |
b |
|
static |
Calculate the vertex sharpness from the attached sharp edge information. Note that vertices with a corner tag always have zero sharpness.
vertex_tag | The 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_sharpness | If 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_count | Number of sharp edges attached to the vertex that have nonzero end sharpness at the vertex. |
maximum_edge_sharpness_at_vertex | The largest sharp edge end sharpness at the vertex. |
|
static |
|
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.
|
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.
|
static |
An edge sharpness with constant value ON_SubDEdgeSharpness::MaximumValue. This is the maximum sharpness that can be applied to an edge.
|
static |
ON_SubDEdgeSharpness::MaximumValue = 4. SubD edge sharpness values are <= ON_SubDEdgeSharpness::MaximumValue.
|
static |
An edge sharpness with both end values = ON_DBL_QNAN.
|
static |
An edge sharpness with constant value 0.0.
|
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.
|
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.