(n)certainties – Columbia – Fall 2008

Diggin’ on hell’s door

October 8, 2008 · Leave a Comment

Option Explicit
‘Script written by Ado

Call Main()
Sub Main()

‘Dim strSrf : strSrf = Rhino.GetObject(“closed surface”,16)

Dim arrPtSeed : arrPtSeed = Rhino.GetObject(“Base Point”,1)
arrPtSeed = Rhino.PointCoordinates(arrPtSeed)

Dim n : n = 1000 ‘Rhino.GetInteger(“nr of points”, 10)

” SPEED:
‘Dim bbox : bbox = Rhino.BoundingBox(strSrf)
Dim min : min = -500 ‘Rhino.Distance(bbox(0),bbox(6))/8
Dim max : max = 500′ Rhino.Distance(bbox(0),bbox(6))/4

Dim i, k : k = 1 : i = 0
Dim arrPt
Dim arrPtsCollect()

ReDim Preserve arrPtsCollect(0)
arrPtsCollect(0) = arrPtSeed

Do Until k = n+1

arrPt = array(arrPtSeed(0)+arbitraryValue(min, max),_
arrPtSeed(1) + arbitraryValue(min, max),_
arrPtSeed(2)- abs(arbitraryValue(min, max)))

Dim arrPtNeighBor : arrPtneighbor = shortestPt(arrPtsCollect, arrPt)
Call rhino.AddLine(arrPt, arrPtNeighBor)

ReDim Preserve arrPtsCollect(k)
arrPtsCollect(k) = arrPt
k = k + 1

Loop

Dim strCrv : strCrv = rhino.AddInterpCurve(arrPtsCollect)
Call rhino.ObjectColor(strcrv, vbred)

End Sub

Function shortestPt(arrPtsCollection, arrPtTest)
Dim i
Dim dblDistMin : dblDistMin = 100000000
For i = 0 To UBound(arrPtsCollection)
Dim dblDist : dblDist = rhino.Distance(arrPtTest, arrPtsCollection(i))
If dbldist 0 Then
If dblDist < dblDistMin Then
dblDistMin = dblDist
shortestPt = arrPtsCollection(i)
End If
End If
Next
End Function


One more of the series… this one is almost working… i guess what i wanted is to have different possibilities to explore boundary populations, starting from surfaces to go to closed lines and finally redefine those conditions in the polysurfaces.

Digging algorithm

Digging algorithm

Categories: Adolfo Nadal

0 responses so far ↓

  • There are no comments yet...Kick things off by filling out the form below.

Leave a Comment