parametric lace_prototyping

081105_lace edge detail

081105_study model details


081112_pattern test

pseudo code:

1) select pattern for recursive subdivision

2) select point(s) to initialize distance based recursion

3) assign fall off distance from point

4) subdivide pattern based on distance from point(s) & length of curves in the pattern.

and the (work in progress) rhinoscript…

Option Explicit
‘Script written by heath west & mark bearak
‘Script version 11 November 2008 13:57:37

Call distanceBasedRecursion()
Sub distanceBasedRecursion()
Dim triangle
Dim arrtriangle : arrtriangle = Rhino.GetObjects(“select the triangles”,8)
Dim arrLoc : arrLoc = Rhino.GetObjects (“select the points”,1)

Rhino.EnableRedraw False
For Each triangle In arrtriangle
Rhino.EnableRedraw True
End Sub

Function subdivideTriangle(triangle)

Dim triangleLength, vertexPts, i, centerPt, triangleCrv, srfParam, srfNormal, arrTri, arrAttPt, arrCrvCnt, dblDist, arrpts, arrLoc()
arrTri = Rhino.DuplicateSurfaceBorder (triangle)

For Each triangleCrv In arrTri
triangleLength = Rhino.CurveLength(triangleCrv)
‘arrAttPt = Rhino.PointCoordinates(arrLoc(0))
arrCrvCnt = Rhino.CurveAreaCentroid (triangleCrv)
‘dblDist = Rhino.Distance (arrCrvCnt(0),arrAttPt)
‘dblDist = dblDist/2.1
Dim intPts : intPts = 30
arrpts = Rhino.DivideCurve (triangleCrv,intPts)

If (triangleLength > 3.5) Then
centerPt = rhino.CurveAreaCentroid(triangleCrv)

srfParam = Rhino.SurfaceClosestPoint(triangle, centerPt(0))
srfNormal = Rhino.SurfaceNormal(triangle, srfParam)
vertexPts = Rhino.PolylineVertices(triangleCrv)

Dim midpt0, midpt1, midpt2, triangle0, triangle1, triangle2, triangle3
midPt0 = Array(((vertexPts(1)(0) + vertexPts(0)(0)))/2, ((vertexPts(1)(1) + vertexPts(0)(1)))/2, ((vertexPts(1)(2) + vertexPts(0)(2)))/2)
midPt1 = Array(((vertexPts(2)(0) + vertexPts(1)(0)))/2, ((vertexPts(2)(1) + vertexPts(1)(1)))/2, ((vertexPts(2)(2) + vertexPts(1)(2)))/2)
midPt2 = Array(((vertexPts(0)(0) + vertexPts(2)(0)))/2, ((vertexPts(0)(1) + vertexPts(2)(1)))/2, ((vertexPts(0)(2) + vertexPts(2)(2)))/2)

srfNormal = Rhino.VectorUnitize(srfNormal)
srfNormal = Rhino.VectorScale(srfNormal, triangleLength * 0.00)

midPt0 = Rhino.VectorAdd(midPt0, srfNormal)
midPt1 = Rhino.VectorAdd(midPt1, srfNormal)
midPt2 = Rhino.VectorAdd(midPt2, srfNormal)

triangle0 = Rhino.AddSrfPt(Array(vertexPts(0), midPt0, midPt2))
triangle1 = Rhino.AddSrfPt(Array(vertexPts(1), midPt1, midPt0))
triangle2 = Rhino.AddSrfPt(Array(vertexPts(2), midPt2, midPt1))
triangle3 = Rhino.AddSrfPt(Array(midPt0, midPt1, midPt2, midPt0))

subdivideTriangle triangle0
subdivideTriangle triangle1
subdivideTriangle triangle2
subdivideTriangle triangle3 ‘comment out this line to produce a sierpiński triangle

Rhino.DeleteObjects(Array(triangle, triangleCrv))
End If
End Function

Function RandomNumber(nMin, nMax)

RandomNumber = Null

If Not IsNumeric(nMin) Then Exit Function
If Not IsNumeric(nMax) Then Exit Function

If nMin >= nMax Then Exit Function

RandomNumber = Int((nMax – nMin + 1) * Rnd + nMin)

End Function


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s