27.3.09
phyllotaxis pavilion 02
this is another evolution in my pavilion project.
i used two Fibonacci's number (13 and 21) different from previous experiment, in this way i could obtain smaller panels that make more evident the modulation of holes.
i modified the tubolar shape, so in the middle of the generator curve the pavilion section is more similar to an ellipse than a circle.
to obtain a more standardized shape of the triangular panel (in previous experiments they are more stretched in pavilion extremes), generator curve is not divided in equal part but division lenght change with the distance from an attractor point (which influences pavilion radius also).
for this pavilion i created a double membrane, it's thicker near the ground (to be more resistant) and became thinner going to the top. the modulation of holes is achieved by an attractor point placed near the middle of the curve generator.
Option Explicit
'Script written by andrea bugli
' "SHIFT" http://andbug.blogspot.com
'Script version venerdì 6 marzo 2009 19.54.31
Call pavilion02triangular
Sub pavilion02triangular
Call rhino.enableredraw(False)
Dim strBpts,arrcircle
Dim strcurve: strcurve = rhino.GetObject("select a curve", 4, True, True)
Dim domain: domain = rhino.CurveDomain(strCurve)
Dim domPt(), distPt, intcount
intcount = 0
Dim ptparam1: ptparam1 = rhino.GetObject("select curve attractor point", 1)
Dim ptcoord1: ptcoord1 = rhino.PointCoordinates(ptparam1)
Dim strAttrHoles: strAttrHoles = rhino.GetObject("select holes attractor point", 1)
Dim arrAttrHoles: arrAttrHoles = rhino.PointCoordinates(strAttrHoles)
Dim strMeshGr: strMeshGr = rhino.GetObject("select ground mesh", 32)
Call rhino.AddLayer("glass")
ReDim Preserve domPt(0)
domPt(intcount) = domain(0)
''''''''' division of generator curve based on distance from ptcoord1
Do
intcount = intcount+1
distPt = rhino.Distance(ptcoord1, rhino.EvaluateCurve(strcurve, domPt(intcount-1)))
If domPt(intcount-1)+(0.035/distPt) > domain(1) Then Exit Do
ReDim Preserve domPt(intcount)
domPt(intcount) = domPt(intcount-1)+(0.018/distPt)
Loop
ReDim arrcircle(ubound(domPt))
Dim i, dblRad
Dim ptrot, pt, ptcurve
ReDim ptrot(ubound(domPt))
rhino.EnableRedraw(False)
For i = 0 To ubound(domPt)
Dim strPoncurve: strPoncurve = rhino.EvaluateCurve(strcurve, dompt(i))
Dim strframe: strframe = rhino.Curveperpframe(strcurve, dompt(i))
Dim tang: tang = rhino.curvetangent(strcurve, dompt(i))
Dim dist: dist = rhino.Distance(strPoncurve, ptcoord1)
arrcircle(i) = rhino.addcircle(strframe, 60/dist)
ptcurve = rhino.CurveStartPoint(arrcircle(i))
pt = rhino.addpoint(ptcurve)
dblRad = rhino.distance(strPoncurve, ptcurve)
''''''''' tubolar shape is scaled to obtain a pavilion section more similar to an ellipse than a circle
ptrot(i) = rhino.RotateObject(pt, strPoncurve, 137.52*i, tang, True)
ptrot(i) = rhino.ScaleObject(ptrot(i), strPoncurve, array((1+dblRad*0.015),(1+dblRad*0.015),(1-dblRad*0.035)))
Call rhino.Deleteobject(pt)
Next
Dim arrVectPos, arrVectNeg, arrPtPos
ReDim arrPtPos(ubound(ptrot))
Dim arrPtOnMesh, dblDistPtM, dblDistCrv
''''''''' here i create the double membrane
For i = 0 To ubound(ptrot)
arrPtOnMesh = rhino.MeshClosestPoint(strMeshGr, rhino.PointCoordinates(ptrot(i)))
dblDistPtM = rhino.Distance(arrPtonMesh(0), rhino.PointCoordinates(ptrot(i)))
dblDistCrv = rhino.Distance(rhino.PointCoordinates(ptrot(i)), rhino.EvaluateCurve(strcurve, dompt(i)))
strPoncurve = rhino.EvaluateCurve(strcurve, dompt(i))
arrVectPos = rhino.VectorCreate(rhino.PointCoordinates(ptrot(i)), strPoncurve)
arrVectPos = rhino.VectorUnitize(arrVectPos)
arrVectPos = rhino.VectorScale(arrVectPos, 0.75*((dblDistCrv-1.4)/(dblDistPtM+3.5)))
arrPtPos(i) = rhino.PointAdd(rhino.PointCoordinates(ptrot(i)), arrVectPos)
''''''''' double membrane is thicker near the ground
If (dblDistPtM < 6) Then
arrVectPos = rhino.VectorScale(arrVectPos, (6 /(dblDistPtM + 3))^2)
End If
arrPtPos(i) = rhino.PointAdd(rhino.PointCoordinates(ptrot(i)), arrVectPos)
Next
Dim strCrv1(), strCrv2()
ReDim arrCrv1(ubound(ptrot))
ReDim arrCrv2(ubound(ptrot))
''''''''' here i start to create triangles on the inner membrane
For i = 0 To ubound(ptrot)-34
arrCrv1(i) = rhino.AddInterpCurve(array(rhino.PointCoordinates(ptrot(i)), rhino.PointCoordinates(ptrot(i+21)), rhino.PointCoordinates(ptrot(i+13)),rhino.PointCoordinates(ptrot(i))),1)
arrCrv2(i) = rhino.AddInterpCurve(array(rhino.PointCoordinates(ptrot(i+13)), rhino.PointCoordinates(ptrot(i+21)), rhino.PointCoordinates(ptrot(i+34)), rhino.PointCoordinates(ptrot(i+13))),1)
Next
Dim strCrvPos1(), strCrvPos2()
ReDim arrCrvPos1(ubound(ptrot))
ReDim arrCrvPos2(ubound(ptrot))
''''''''' here i start to create triangles on the outer membrane
For i = 0 To ubound(arrPtPos)-34
arrCrvPos1(i) = rhino.AddInterpCurve(array(arrPtPos(i), arrPtPos(i+21), arrPtPos(i+13),arrPtPos(i)),1)
arrCrvPos2(i) = rhino.AddInterpCurve(array(arrPtPos(i+13), arrPtPos(i+21), arrPtPos(i+34),arrPtPos(i+13)),1)
Next
For i = 0 To ubound(arrPtPos)-34
Call rhino.AddLoftSrf(array(arrCrv1(i), arrCrvPos1(i)))
Call rhino.AddLoftSrf(array(arrCrv2(i), arrCrvPos2(i)))
Next
Dim arrCenter1(), arrCenter2()
Dim dblDistAttr1, dblDistAttr2
Dim arrVectAC1, arrVectBC1, arrVectCC1, arrPtAC1, arrPtBC1, arrPtCC1
Dim arrVectAC2, arrVectBC2, arrVectCC2, arrPtAC2, arrPtBC2, arrPtCC2
Dim dblScale1, dblScale2, dblDistHole
ReDim arrCenter1(ubound(arrPtPos)-34)
ReDim arrCenter2(ubound(arrPtPos)-34)
Dim strGlass
''''''''' here i create triangular holes, their size is influenced by the distance from arrAttrHoles
For i = 0 To ubound(arrPtPos)-34
arrCenter1(i) = rhino.CurveAreaCentroid(arrCrvPos1(i))
arrVectAC1 = rhino.VectorCreate(arrCenter1(i)(0), rhino.PointCoordinates(ptrot(i)))
arrVectBC1 = rhino.VectorCreate(arrCenter1(i)(0), rhino.PointCoordinates(ptrot(i+13)))
arrVectCC1 = rhino.VectorCreate(arrCenter1(i)(0), rhino.PointCoordinates(ptrot(i+21)))
dblDistHole = rhino.Distance(arrCenter1(i)(0), arrAttrHoles)
dblScale1 = 0.8/(dblDistHole * 0.1)
If (dblScale1 < 0.95) Then
arrVectAC1 = rhino.VectorScale(arrVectAC1, dblScale1)
arrVectBC1 = rhino.VectorScale(arrVectBC1, dblScale1)
arrVectCC1 = rhino.VectorScale(arrVectCC1, dblScale1)
arrPtAC1 = rhino.PointAdd(rhino.PointCoordinates(ptrot(i)), arrVectAC1)
arrPtBC1 = rhino.PointAdd(rhino.PointCoordinates(ptrot(i+13)), arrVectBC1)
arrPtCC1 = rhino.PointAdd(rhino.PointCoordinates(ptrot(i+21)), arrVectCC1)
Call rhino.AddSrfPt(array(rhino.PointCoordinates(ptrot(i)), rhino.PointCoordinates(ptrot(i+13)), arrPtBC1, arrPtAC1))
Call rhino.AddSrfPt(array(rhino.PointCoordinates(ptrot(i+13)), rhino.PointCoordinates(ptrot(i+21)), arrPtCC1, arrPtBC1))
Call rhino.AddSrfPt(array(rhino.PointCoordinates(ptrot(i+21)), rhino.PointCoordinates(ptrot(i)), arrPtAC1, arrPtCC1))
Call rhino.AddSrfPt(array(arrPtPos(i), arrPtAC1, arrPtBC1, arrPtPos(i+13)))
Call rhino.AddSrfPt(array(arrPtPos(i+13), arrPtBC1, arrPtCC1, arrPtPos(i+21)))
Call rhino.AddSrfPt(array(arrPtPos(i+21), arrPtCC1, arrPtAC1, arrPtPos(i)))
''''''''' i put the surface in the glass layer
strGlass = rhino.AddSrfPt(array(arrPtAC1, arrPtCC1, arrPtBC1))
Call rhino.ObjectLayer(strGlass, "glass")
Else
arrPtAC1 = rhino.PointAdd(rhino.PointCoordinates(ptrot(i)), arrVectAC1)
arrPtBC1 = rhino.PointAdd(rhino.PointCoordinates(ptrot(i+13)), arrVectBC1)
arrPtCC1 = rhino.PointAdd(rhino.PointCoordinates(ptrot(i+21)), arrVectCC1)
Call rhino.AddSrfPt(array(rhino.PointCoordinates(ptrot(i)), rhino.PointCoordinates(ptrot(i+13)), arrPtBC1))
Call rhino.AddSrfPt(array(rhino.PointCoordinates(ptrot(i+13)), rhino.PointCoordinates(ptrot(i+21)), arrPtCC1))
Call rhino.AddSrfPt(array(rhino.PointCoordinates(ptrot(i+21)), rhino.PointCoordinates(ptrot(i)), arrPtAC1))
Call rhino.AddSrfPt(array(arrPtPos(i), arrPtAC1, arrPtPos(i+13)))
Call rhino.AddSrfPt(array(arrPtPos(i+13), arrPtBC1, arrPtPos(i+21)))
Call rhino.AddSrfPt(array(arrPtPos(i+21), arrPtCC1, arrPtPos(i)))
End If
'----------------
arrCenter2(i) = rhino.CurveAreaCentroid(arrCrvPos2(i))
arrVectAC2 = rhino.VectorCreate(arrCenter2(i)(0), rhino.PointCoordinates(ptrot(i+13)))
arrVectBC2 = rhino.VectorCreate(arrCenter2(i)(0), rhino.PointCoordinates(ptrot(i+21)))
arrVectCC2 = rhino.VectorCreate(arrCenter2(i)(0), rhino.PointCoordinates(ptrot(i+34)))
dblDistHole = rhino.Distance(arrCenter2(i)(0), arrAttrHoles)
dblScale2 = 0.8/(dblDistHole * 0.1)
If (dblScale2 < 0.95) Then
arrVectAC2 = rhino.VectorScale(arrVectAC2, dblScale2)
arrVectBC2 = rhino.VectorScale(arrVectBC2, dblScale2)
arrVectCC2 = rhino.VectorScale(arrVectCC2, dblScale2)
arrPtAC2 = rhino.PointAdd(rhino.PointCoordinates(ptrot(i+13)), arrVectAC2)
arrPtBC2 = rhino.PointAdd(rhino.PointCoordinates(ptrot(i+21)), arrVectBC2)
arrPtCC2 = rhino.PointAdd(rhino.PointCoordinates(ptrot(i+34)), arrVectCC2)
Call rhino.AddSrfPt(array(rhino.PointCoordinates(ptrot(i+13)), arrPtAC2, arrPtBC2, rhino.PointCoordinates(ptrot(i+21))))
Call rhino.AddSrfPt(array(rhino.PointCoordinates(ptrot(i+21)), arrPtBC2, arrPtCC2, rhino.PointCoordinates(ptrot(i+34))))
Call rhino.AddSrfPt(array(rhino.PointCoordinates(ptrot(i+34)), arrPtCC2, arrPtAC2, rhino.PointCoordinates(ptrot(i+13))))
Call rhino.AddSrfPt(array(arrPtPos(i+13), arrPtPos(i+21), arrPtBC2, arrPtAC2))
Call rhino.AddSrfPt(array(arrPtPos(i+21), arrPtPos(i+34), arrPtCC2, arrPtBC2))
Call rhino.AddSrfPt(array(arrPtPos(i+34), arrPtPos(i+13), arrPtAC2, arrPtCC2))
''''''''' i put the surface in the glass layer
strGlass = rhino.AddSrfPt(array(arrPtAC2, arrPtBC2, arrPtCC2))
Call rhino.ObjectLayer(strGlass, "glass")
Else
arrPtAC2 = rhino.PointAdd(rhino.PointCoordinates(ptrot(i+13)), arrVectAC2)
arrPtBC2 = rhino.PointAdd(rhino.PointCoordinates(ptrot(i+21)), arrVectBC2)
arrPtCC2 = rhino.PointAdd(rhino.PointCoordinates(ptrot(i+34)), arrVectCC2)
Call rhino.AddSrfPt(array(rhino.PointCoordinates(ptrot(i+13)), arrPtAC2, rhino.PointCoordinates(ptrot(i+21))))
Call rhino.AddSrfPt(array(rhino.PointCoordinates(ptrot(i+21)), arrPtBC2, rhino.PointCoordinates(ptrot(i+34))))
Call rhino.AddSrfPt(array(rhino.PointCoordinates(ptrot(i+34)), arrPtCC2, rhino.PointCoordinates(ptrot(i+13))))
Call rhino.AddSrfPt(array(arrPtPos(i+13), arrPtPos(i+21), arrPtBC2))
Call rhino.AddSrfPt(array(arrPtPos(i+21), arrPtPos(i+34), arrPtCC2))
Call rhino.AddSrfPt(array(arrPtPos(i+34), arrPtPos(i+13), arrPtAC2))
End If
Next
Call rhino.DeleteObjects(ptrot)
call rhino.DeleteObjects(arrCircle)
Call rhino.enableredraw(True)
End Sub
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment