SubDEdgeSharpness
References[StructLayout(LayoutKind.Sequential, Pack = 4, Size = 8)]
[DebuggerDisplay("{m_sharpness0}, {m_sharpness1}")]
public struct SubDEdgeSharpness : IEquatable<SubDEdgeSharpness>
Sharpness values for the two ends of a SubD edge.
A sharp SubD edge is an edge where the limit surface makes a tighter "fillet radius" around the edge than a smooth edge would, while still staying smooth, unlike a crease edge. It is achieved by applying the crease edge subdivision rules for the number of subdivisions given by the sharpness value, and the smooth edge subdivision rules after that. Sharpness can differ at the two ends of an edge.
Remarks: This is a value type wrapping two floats, and the default value is Smooth. It is passed to and from the unmanaged library by value.
See Also: SubDEdge.Sharpness
Constructors
Creates a sharpness with the same value at both ends.
Remarks: If sharpness is not valid, the result is Nan.
Creates a sharpness that varies from one end of the edge to the other.
public SubDEdgeSharpness()
sharpness0,
Sharpness at the start of the edge, between 0.0 and MaximumValue.
sharpness1
Sharpness at the end of the edge, between 0.0 and MaximumValue.
Remarks: If either value is not valid, the result is Nan. Passing CreaseValue for both values gives Crease.
Creates a sharpness that varies from one end of the edge to the other.
public SubDEdgeSharpness()
sharpnessInterval
Sharpness at the start and end of the edge. Both values must be between 0.0 and MaximumValue.
Remarks: If either value is not valid, the result is Nan.
Fields
The value used to indicate that an edge is a crease, MaximumValue + 1.0. This is deliberately not a valid sharpness value: a crease edge is not a sharp edge. It exists because it is often convenient to use a single value to describe both.
The largest valid sharpness value, 4.0. Valid SubD edge sharpness values are between 0.0 and MaximumValue.
The sharpness value of a smooth edge, 0.0.
If a sharpness is within Tolerance of an integer value, it is snapped to that integer value. See Sanitize(double).
Properties
A sharpness of CreaseValue at both ends, used to indicate that an edge is a crease rather than a sharp edge. IsValid is false for this value; see IsValidOrCrease.
Gets EndSharpness(1) - EndSharpness(0), or NaN if this is neither valid nor a crease.
Gets true if both ends have the same valid sharpness value. Crease and Nan are both false; see IsConstantOrCrease.
Gets true if both ends have the same valid sharpness value, or if this is Crease.
Gets true if EndSharpness(0) is greater than EndSharpness(1).
Gets true if EndSharpness(0) is less than EndSharpness(1).
Gets true if both ends are valid and at least one is greater than 0.0. Crease and Nan are both false: a crease edge is not a sharp edge.
Gets true if both ends are between 0.0 and MaximumValue. Crease and Nan are both false; see IsValidOrCrease.
Gets true if both ends are between 0.0 and MaximumValue, or if this is Crease.
Gets true if both ends are 0.0, which is the sharpness of a smooth edge.
A sharpness of MaximumValue at both ends. This is the sharpest an edge can be without being a crease.
Gets the larger of the two end sharpness values.
Gets the smaller of the two end sharpness values.
A sharpness whose ends are both NaN. This is what the factory methods return when their input is not valid.
A sharpness of 0.0 at both ends, which is what a smooth edge has. This is also the default value of a SubDEdgeSharpness.
Gets +1 if the sharpness increases along the edge, -1 if it decreases, and 0 if it is constant. Returns RhinoMath.UnsetIntIndex if this is not valid.
Indexers
Methods
Builds a sequence of evenly changing sharpnesses for the edges of a chain.
public static SubDEdgeSharpness[] CreateEdgeChainSharpness()
chainSharpnessRange,
The sharpness at the start of the chain and at the end of the chain.
edgeCount
The number of edges in the chain.
Returns: One sharpness per edge, or an empty array if the input is not valid.
Gets the sharpness at the start or the end of the edge.
Returns: The sharpness, or NaN if endIndex is out of range.
Determines whether two sharpnesses have the same Delta and meet with the same value.
public static bool EqualDelta()
s0,
The sharpness of the first edge.
s1
The sharpness of the second edge.
Determines whether two sharpnesses meet with the same value, that is, whether s0.EndSharpness(1) equals s1.EndSharpness(0).
public static bool EqualEndSharpness()
s0,
The sharpness of the first edge.
s1
The sharpness of the second edge.
Determines whether an object is a sharpness with the same end values as this one.
Overrides: ValueType.Equals
Determines whether this sharpness has the same end values as another one.
Determines whether two sharpnesses have the same Trend and meet with the same value.
public static bool EqualTrend()
s0,
The sharpness of the first edge.
s1
The sharpness of the second edge.
Creates a sharpness with the same value at both ends, from a percentage. This is useful in user interface code that expresses sharpness as a percentage.
Returns: A sharpness with constant value (percentage * MaximumValue / 100.0), Crease if percentage is double.MaxValue, or Nan if percentage is out of range.
Creates a sharpness that varies from one end of the edge to the other, from percentages. This is useful in user interface code that expresses sharpness as a percentage.
public static SubDEdgeSharpness FromIntervalPercentage()
percentage0,
Percentage at the start of the edge, between 0.0 and 100.0, or double.MaxValue for a crease.
percentage1
Percentage at the end of the edge, between 0.0 and 100.0, or double.MaxValue for a crease.
Returns: A sharpness running from (percentage0 * MaximumValue / 100.0) to (percentage1 * MaximumValue / 100.0), Crease if both percentages are double.MaxValue, or Nan otherwise. An edge is either a crease or it is not, so mixing double.MaxValue with a percentage gives Nan.
Creates a sharpness that varies from one end of the edge to the other, from percentages. This is useful in user interface code that expresses sharpness as a percentage.
public static SubDEdgeSharpness FromIntervalPercentage()
percentageInterval
Percentages at the start and end of the edge, each between 0.0 and 100.0, or double.MaxValue for a crease.
Returns: See FromIntervalPercentage(double, double).
Determines whether a value can be used as an edge end sharpness.
public static bool IsValidValue()
candidateValue,
The value to check.
creaseResult
The value to return when candidateValue is CreaseValue.
Gets this sharpness with its two end values swapped.
Verifies that sharpness is between 0.0 and MaximumValue, and snaps it to an integer when it is within Tolerance of one.
Returns: A usable sharpness value, or invalidInputResult if sharpness is not valid.
Verifies that sharpness is between 0.0 and MaximumValue, and snaps it to an integer when it is within Tolerance of one.
Returns: A usable sharpness value, or 0.0 if sharpness is not valid.
Converts a normalized slider value to an edge end sharpness value.
Returns: normalizedSliderValue scaled to the range 0.0 to MaximumValue, or NaN if it is out of range.
Converts a user facing slider value to an edge end sharpness value.
public static double SharpnessFromSliderValue()
sliderDomain,
The non empty domain of the slider, often Interval.ZeroToOne.
sliderValue,
A value in sliderDomain. sliderDomain.T0 maps to 0.0 and sliderDomain.T1 maps to MaximumValue.
invalidInputResult
The value to return when the input is not valid.
Gets the sharpness this edge would have after one subdivision.
Returns: The subdivided sharpness, or Smooth if endIndex is out of range.
Converts a sharpness value to a percentage between 0.0 and 100.0.
public static double ToPercentage()
sharpness,
Between 0.0 and MaximumValue, or CreaseValue.
creasePercentage
The value to return when sharpness is CreaseValue.
Returns: 100.0 * sharpness / MaximumValue, creasePercentage for CreaseValue, or NaN if sharpness is not valid.
Describes this sharpness as a percentage, for user interface code. A constant sharpness gives a single percentage, a variable one gives a range, and an invalid one gives a warning sign.
public string ToPercentageText()
orderMinToMax
If true, a variable sharpness is formatted as min%-max%. If false, it is formatted as EndSharpness(0)%-EndSharpness(1)%.
Describes a single end sharpness value as a percentage, for user interface code.
Returns: A number followed by a percent sign, "crease" for CreaseValue, or a warning sign if sharpness is not valid.
Gets the union of two sharpness ranges, ignoring the ones that are zero, a crease, or not valid.
Returns: The union of the nonzero valid inputs, or Smooth if there are none.
Calculates the sharpness of a vertex from the sharp edges attached to it. Vertices tagged as corners always have a sharpness of 0.0.
[CLSCompliant(false)]
public static double VertexSharpness()
vertexTag,
The vertex tag.
interiorCreaseVertexSharpness,
Only meaningful for an interior crease vertex, where it is the largest sharpness at this vertex over the smooth edges of both sectors. This matters in low level SubD evaluation code that only has information about one sector. When in doubt, pass 0.0.
sharpEdgeEndCount,
The number of sharp edges at the vertex whose sharpness at this vertex is nonzero.
maximumEdgeEndSharpness
The largest sharp edge end sharpness at the vertex.
Returns: The sharpness to use when subdividing the vertex.
Operators
| Operation | Result | Description | ||
|---|---|---|---|---|
| SubDEdgeSharpness | == | SubDEdgeSharpness | bool | Determines whether two sharpnesses have the same end values. |
| SubDEdgeSharpness | != | SubDEdgeSharpness | bool | Determines whether two sharpnesses have different end values. |