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

SubDEdgeSharpness

#Since v8.36
Creates a sharpness with the same value at both ends.
public SubDEdgeSharpness(
sharpness
Between 0.0 and MaximumValue, or CreaseValue.
)
Remarks: If sharpness is not valid, the result is Nan.

SubDEdgeSharpness

#Since v8.36
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.

SubDEdgeSharpness

#Since v8.36
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

CreaseValue

#Since v8.36
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.
public const double CreaseValue = 5

MaximumValue

#Since v8.36
The largest valid sharpness value, 4.0. Valid SubD edge sharpness values are between 0.0 and MaximumValue.
public const double MaximumValue = 4

SmoothValue

#Since v8.36
The sharpness value of a smooth edge, 0.0.
public const double SmoothValue = 0

Tolerance

#Since v8.36
If a sharpness is within Tolerance of an integer value, it is snapped to that integer value. See Sanitize(double).
public const double Tolerance = 0.01

Properties

Average

#Since v8.36
Gets the average of the two end sharpness values.
public double Average { get; }

Crease

#Since v8.36
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.
public static SubDEdgeSharpness Crease { get; }

Delta

#Since v8.36
Gets EndSharpness(1) - EndSharpness(0), or NaN if this is neither valid nor a crease.
public double Delta { get; }

IsConstant

#Since v8.36
Gets true if both ends have the same valid sharpness value. Crease and Nan are both false; see IsConstantOrCrease.
public bool IsConstant { get; }

IsConstantOrCrease

#Since v8.36
Gets true if both ends have the same valid sharpness value, or if this is Crease.
public bool IsConstantOrCrease { get; }

IsCrease

#Since v8.36
Gets true if this is Crease.
public bool IsCrease { get; }

IsCreaseOrSharp

#Since v8.36
Gets (IsCrease || IsSharp).
public bool IsCreaseOrSharp { get; }

IsDecreasing

#Since v8.36
Gets true if EndSharpness(0) is greater than EndSharpness(1).
public bool IsDecreasing { get; }

IsIncreasing

#Since v8.36
Gets true if EndSharpness(0) is less than EndSharpness(1).
public bool IsIncreasing { get; }

IsNotValid

#Since v8.36
Gets the opposite of IsValid. Crease and Nan are both true.
public bool IsNotValid { get; }

IsNotValidNorCrease

#Since v8.36
Gets the opposite of IsValidOrCrease. Nan is true and Crease is false.
public bool IsNotValidNorCrease { get; }

IsSharp

#Since v8.36
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.
public bool IsSharp { get; }

IsValid

#Since v8.36
Gets true if both ends are between 0.0 and MaximumValue. Crease and Nan are both false; see IsValidOrCrease.
public bool IsValid { get; }

IsValidOrCrease

#Since v8.36
Gets true if both ends are between 0.0 and MaximumValue, or if this is Crease.
public bool IsValidOrCrease { get; }

IsVariable

#Since v8.36
Gets true if this is valid and the two ends differ. Crease and Nan are both false.
public bool IsVariable { get; }

IsZero

#Since v8.36
Gets true if both ends are 0.0, which is the sharpness of a smooth edge.
public bool IsZero { get; }

Maximum

#Since v8.36
A sharpness of MaximumValue at both ends. This is the sharpest an edge can be without being a crease.
public static SubDEdgeSharpness Maximum { get; }

MaximumEndSharpness

#Since v8.36
Gets the larger of the two end sharpness values.
public double MaximumEndSharpness { get; }

MinimumEndSharpness

#Since v8.36
Gets the smaller of the two end sharpness values.
public double MinimumEndSharpness { get; }

Nan

#Since v8.36
A sharpness whose ends are both NaN. This is what the factory methods return when their input is not valid.
public static SubDEdgeSharpness Nan { get; }

Smooth

#Since v8.36
A sharpness of 0.0 at both ends, which is what a smooth edge has. This is also the default value of a SubDEdgeSharpness.
public static SubDEdgeSharpness Smooth { get; }

Trend

#Since v8.36
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.
public int Trend { get; }

Indexers

this[]

#Since v8.36
Gets the sharpness at the start or the end of the edge.
public double this[
endIndex
0 for the start of the edge, 1 for the end.
] { get; }
The sharpness, or NaN if endIndex is out of range.

Methods

CreateEdgeChainSharpness

#Since v8.36
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.
)
One sharpness per edge, or an empty array if the input is not valid.

EndSharpness

#Since v8.36
Gets the sharpness at the start or the end of the edge.
public double EndSharpness(
endIndex
0 for the start of the edge, 1 for the end.
)
The sharpness, or NaN if endIndex is out of range.

EqualDelta

#Since v8.36
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.
)

EqualEndSharpness

#Since v8.36
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.
)

Equals

#Since v8.36
Determines whether an object is a sharpness with the same end values as this one.
public override bool Equals(
obj
The object to compare with.
)
ValueType.Equals

Equals

#Since v8.36
Determines whether this sharpness has the same end values as another one.
public bool Equals(
other
The sharpness to compare with.
)

EqualTrend

#Since v8.36
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.
)

FromConstantPercentage

#Since v8.36
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.
public static SubDEdgeSharpness FromConstantPercentage(
percentage
Between 0.0 and 100.0, or double.MaxValue for a crease.
)
A sharpness with constant value (percentage * MaximumValue / 100.0), Crease if percentage is double.MaxValue, or Nan if percentage is out of range.

FromIntervalPercentage

#Since v8.36
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.
)
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.

FromIntervalPercentage

#Since v8.36
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.
)

GetHashCode

#Since v8.36
Gets a hash code for this sharpness.
public override int GetHashCode()

IsValidValue

#Since v8.36
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.
)

Reversed

#Since v8.36
Gets this sharpness with its two end values swapped.
public SubDEdgeSharpness Reversed()

Sanitize

#Since v8.36
Verifies that sharpness is between 0.0 and MaximumValue, and snaps it to an integer when it is within Tolerance of one.
public static double Sanitize(
sharpness,
The value to sanitize.
invalidInputResult
The value to return when sharpness is not valid.
)
A usable sharpness value, or invalidInputResult if sharpness is not valid.

Sanitize

#Since v8.36
Verifies that sharpness is between 0.0 and MaximumValue, and snaps it to an integer when it is within Tolerance of one.
public static double Sanitize(
sharpness
The value to sanitize.
)
A usable sharpness value, or 0.0 if sharpness is not valid.

SharpnessFromNormalizedValue

#Since v8.36
Converts a normalized slider value to an edge end sharpness value.
public static double SharpnessFromNormalizedValue(
normalizedSliderValue
Between 0.0 and 1.0.
)
normalizedSliderValue scaled to the range 0.0 to MaximumValue, or NaN if it is out of range.

SharpnessFromSliderValue

#Since v8.36
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.
)

Subdivided

#Since v8.36
Gets the sharpness this edge would have after one subdivision.
public SubDEdgeSharpness Subdivided(
endIndex
0 for the start of the edge, 1 for the end.
)
The subdivided sharpness, or Smooth if endIndex is out of range.

ToPercentage

#Since v8.36
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.
)
100.0 * sharpness / MaximumValue, creasePercentage for CreaseValue, or NaN if sharpness is not valid.

ToPercentageText

#Since v8.36
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)%.
)

ToPercentageText

#Since v8.36
Describes a single end sharpness value as a percentage, for user interface code.
public static string ToPercentageText(
sharpness
Between 0.0 and MaximumValue, or CreaseValue.
)
A number followed by a percent sign, "crease" for CreaseValue, or a warning sign if sharpness is not valid.

ToString

#Since v8.36
Returns a string that represents this sharpness as a percentage.
public override string ToString()

Union

#Since v8.36
Gets the union of two sharpness ranges, ignoring the ones that are zero, a crease, or not valid.
public static SubDEdgeSharpness Union(
sharpness0,
The first sharpness.
sharpness1
The second sharpness.
)
The union of the nonzero valid inputs, or Smooth if there are none.

VertexSharpness

#Since v8.36
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.
)
The sharpness to use when subdividing the vertex.

Operators

OperationResultDescription
SubDEdgeSharpness==SubDEdgeSharpnessboolDetermines whether two sharpnesses have the same end values.
SubDEdgeSharpness!=SubDEdgeSharpnessboolDetermines whether two sharpnesses have different end values.