# Differences

This shows you the differences between two versions of the page.

 — developer:scriptsamples:knotmultiplicity [2015/09/14] (current) Line 1: Line 1: + ====== Knot Multiplicity ====== + > **Developer:​** //​[[developer:​rhinoscript|RhinoScript]]//​ + > **Summary:​** //​Determining curve and surface knot multiplicity.//​ + ===== Question ===== + Is there a way to mark or locate fully-multiple knots? + + ===== Answer ===== + The number of times a knot value is duplicated is called the knot’s multiplicity. A knot value is said to be a full-multiplicity knot if it is duplicated degree many times. + + + ===== Example ===== + The following example function demonstrates one way of determining a knot's multiplicity. + + ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''​ + ' Description:​ + ' ​  ​Calculates the multiplicity of a knot. + ' Parameters: + ' ​  knots - an array of knot values + ' ​  ​knot_index - the index of the knot to determine multiplicity + ' Returns: + ' ​  The multiplicity if successful + ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''​ + Function KnotMultiplicity(knots,​ knot_index) + ​ + Dim knot_count, mult, index, t + ​ + index = knot_index + knot_count = UBound(knots) + ​ + If (index < 0 Or index > knot_count) Then + KnotMultiplicity = Null + Exit Function + End If + ​ + t = knots(index) + mult = 1 + ​ + Do While (index < knot_count) + If (knots(index + 1) - t) > 1.0e-12 Then Exit Do + index = index + 1 + mult = mult + 1 + Loop + ​ + KnotMultiplicity = mult + ​ + End Function + ​ + + To see an example of this function in use, download the following script file: + {{:​developer:​scriptsamples:​markfullymultipleknots.zip|}} + + \\ + + {{tag>​Developer RhinoScript}} 