This rhinoscript takes a series of points selected in sequence and creates a bezier curve using the geometric method of construction. Rendering both the final bezier curve as well as the construction lines used to produce this curve. These curves produce a beautiful spatial fabric in visualizing the geometric structure beneath. A more detailed/ animated reference of this method of construction can be found at Wikipedia
Rhino Script
Option Explicit 'Script written by <David Mans> 'Script copyrighted by <Neoarchaic Design> 'Script version Tuesday, July 21, 2009 7:50:34 PM Call Main() Sub Main() Dim arrPoints,intSamples Do arrPoints = Rhino.GetObjects("Select at Least 3 Points", 1,, True) If isNull(arrPoints) Then Exit Sub If uBound(arrPoints) > 1 Then Exit Do End If Loop intSamples = Rhino.GetReal("Samples", 10, 1) If isNull(intSamples) Then Exit Sub Dim i, arrPts(),arrOutput ReDim arrPts(uBound(arrPoints)) For i = 0 To uBound(arrPoints) Step 1 arrPts(i) = Rhino.PointCoordinates(arrPoints(i)) Next Call Rhino.EnableRedraw(False) arrOutput = bezierConstructor(arrPts, intSamples) Call Rhino.AddInterpCurve(arrOutput(0)) Call Rhino.ObjectColor(arrOutput(1), RGB(255, 0, 0)) Call Rhino.EnableRedraw(True) End Sub Function bezierConstructor(arrPts, intSamples) bezierConstructor = Null Dim i, j, k, r, s, t Dim arrOutput(), arrOutputs(), arrStore, arrTemp, arrLines(),arrSet() r = 0 k = 1 ReDim arrOutput(0),arrOutputs(0) arrOutput(0) = arrPts(0) For i = 1 To uBound(arrPts) Step 1 ReDim Preserve arrLines(r),arrOutputs(r) arrLines(r) = Rhino.AddLine(arrPts(i - 1), arrPts(i)) arrOutputs(r) = arrLines(r) r = r + 1 Next t = r arrStore = arrLines For i = 1 To intSamples - 1 Step 1 r = 0 s = 0 arrTemp = arrStore Do If r = 1 Then ReDim Preserve arrOutput(k) arrOutput(k) = curveParameter(arrTemp(0), i * (1 / intSamples)) k = k + 1 Exit Do End If r = 0 ReDim Preserve arrSet(s) arrSet(s) = arrTemp ReDim arrLines(0) For j = 1 To ubound(arrSet(s)) Step 1 ReDim Preserve arrLines(r), arrOutputs(t) arrLines(r) = Rhino.AddLine(curveParameter(arrSet(s)(j - 1), i * (1 / intSamples)), curveParameter(arrSet(s)(j), i * (1 / intSamples))) arrOutputs(t) = arrLines(r) t = t + 1 r = r + 1 Next arrTemp = arrLines s = s + 1 Loop Next ReDim Preserve arrOutput(k) arrOutput(k) = arrPts(uBound(arrPts)) bezierConstructor = array(arrOutput, arrOutputs) End Function Function curveParameter(strCurve, dblParameter) curveParameter = Null Dim cDom,arrPoint cDom = Rhino.CurveDomain(strCurve) arrPoint = Rhino.EvaluateCurve(strCurve, cDom(0) + dblParameter * (cDom(1) - cDom(0))) curveParameter = arrPoint End Function