| McNeel Wiki | |||||
| edit · print · help · all topics | |||||
Main Pages
Languages
| QuestionIs it possible to obtain the original points used when creating an interpolated curve using Rhino's InterpCrv command or RhinoScript's AddInterpCurveEx method? AnswerIf the curve has a degree of 3, then the answer is yes. Just get the curve's knots, or knot vector, and then evaluate each knot value. ExampleThe following example demonstrates how to extract an interpolated curve's original construction points.
Function ExtractInterpCrvPoints(curve)
' local variables
Dim points(), knots, i
' default result
ExtractInterpCrvPoints = Null
' verify the curve
If Not IsNull(curve) And Rhino.IsCurve(curve) Then
' verify the degree of the curve
If Rhino.CurveDegree(curve) = 3 Then
' get the curve's knots
knots = Rhino.CurveKnots(curve)
' verify the curve's knots
If IsArray(knots) Then
' evaluate the curve at each knot value
ReDim points(UBound(knots))
For i = 0 To UBound(knots)
points(i) = Rhino.EvaluateCurve(curve, knots(i))
Next
' cull any duplicate points
ExtractInterpCrvPoints = Rhino.CullDuplicatePoints(points)
End If
End If
End If
End Function
| ||||
| rename · changes · history · subscriptions · lost and found · references · file upload | |||||