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.
Constructors
Creates a sharpness with the same value at both ends.
Remarks: If sharpness is not valid, the result is Nan.
Parameters:
| sharpness (double) | Between 0.0 and MaximumValue, or CreaseValue. |
Creates a sharpness that varies from one end of the edge to the other.
Remarks: If either value is not valid, the result is Nan. Passing CreaseValue for both values gives Crease.
Parameters:
| sharpness0 (double) | Sharpness at the start of the edge, between 0.0 and MaximumValue. |
| sharpness1 (double) | Sharpness at the end of the edge, between 0.0 and MaximumValue. |
Creates a sharpness that varies from one end of the edge to the other.
Remarks: If either value is not valid, the result is Nan.
Parameters:
| sharpnessInterval (Interval) | Sharpness at the start and end of the edge. Both values must be between 0.0 and MaximumValue. |
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 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
public static SubDEdgeSharpness[] CreateEdgeChainSharpness(Interval chainSharpnessRange, int edgeCount)
Builds a sequence of evenly changing sharpnesses for the edges of a chain.
Gets the sharpness at the start or the end of the edge.
Parameters:
| endIndex (int) | 0 for the start of the edge, 1 for the end. |
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.
Parameters:
| s0 (SubDEdgeSharpness) | The sharpness of the first edge. |
| s1 (SubDEdgeSharpness) | 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).
Parameters:
| s0 (SubDEdgeSharpness) | The sharpness of the first edge. |
| s1 (SubDEdgeSharpness) | The sharpness of the second edge. |
Determines whether an object is a sharpness with the same end values as this one.
Parameters:
| obj (object) | The object to compare with. |
Overrides: ValueType.Equals
Determines whether this sharpness has the same end values as another one.
Parameters:
| other (SubDEdgeSharpness) | The sharpness to compare with. |
Determines whether two sharpnesses have the same Trend and meet with the same value.
Parameters:
| s0 (SubDEdgeSharpness) | The sharpness of the first edge. |
| s1 (SubDEdgeSharpness) | 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.
Parameters:
| percentage (double) | Between 0.0 and 100.0, or double.MaxValue for a crease. |
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.
Parameters:
| percentage0 (double) | Percentage at the start of the edge, between 0.0 and 100.0, or double.MaxValue for a crease. |
| percentage1 (double) | 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.
Parameters:
| percentageInterval (Interval) | 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).
Gets a hash code for this sharpness.
Overrides: ValueType.GetHashCode
Determines whether a value can be used as an edge end sharpness.
Parameters:
| candidateValue (double) | The value to check. |
| creaseResult (bool) | 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.
Verifies that sharpness is between 0.0 and MaximumValue, and snaps it to an integer when it is within Tolerance of one.
Parameters:
| sharpness (double) | The value to sanitize. |
Returns: A usable sharpness value, or 0.0 if sharpness is not valid.
Converts a normalized slider value to an edge end sharpness value.
Parameters:
| normalizedSliderValue (double) | Between 0.0 and 1.0. |
Returns: normalizedSliderValue scaled to the range 0.0 to MaximumValue, or NaN if it is out of range.
public static double SharpnessFromSliderValue(Interval sliderDomain, double sliderValue, double invalidInputResult)
Converts a user facing slider value to an edge end sharpness value.
Parameters:
| sliderDomain (Interval) | The non empty domain of the slider, often Interval.ZeroToOne. |
| sliderValue (double) | A value in sliderDomain. sliderDomain.T0 maps to 0.0 and sliderDomain.T1 maps to MaximumValue. |
| invalidInputResult (double) | The value to return when the input is not valid. |
Gets the sharpness this edge would have after one subdivision.
Converts a sharpness value to a percentage between 0.0 and 100.0.
Parameters:
| sharpness (double) | Between 0.0 and MaximumValue, or CreaseValue. |
| creasePercentage (double) | 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.
Parameters:
| orderMinToMax (bool) | 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.
Parameters:
| sharpness (double) | Between 0.0 and MaximumValue, or CreaseValue. |
Returns: A number followed by a percent sign, "crease" for CreaseValue, or a warning sign if sharpness is not valid.
Returns a string that represents this sharpness as a percentage.
Overrides: ValueType.ToString
Gets the union of two sharpness ranges, ignoring the ones that are zero, a crease, or not valid.
Parameters:
| sharpness0 (SubDEdgeSharpness) | The first sharpness. |
| sharpness1 (SubDEdgeSharpness) | The second sharpness. |
Returns: The union of the nonzero valid inputs, or Smooth if there are none.
[CLSCompliant(false)]
public static double VertexSharpness(SubDVertexTag vertexTag, double interiorCreaseVertexSharpness, uint sharpEdgeEndCount, double maximumEdgeEndSharpness)
Calculates the sharpness of a vertex from the sharp edges attached to it. Vertices tagged as corners always have a sharpness of 0.0.
Parameters:
| vertexTag (SubDVertexTag) | The vertex tag. |
| interiorCreaseVertexSharpness (double) | 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 (uint) | The number of sharp edges at the vertex whose sharpness at this vertex is nonzero. |
| maximumEdgeEndSharpness (double) | 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. |