## Monday, May 08, 2006

### Rh4_060507_GrowingAlgorythm

AA STUDENTS PAVILON (discovered in the BD of last week)
Design by a student of the AA Unit of Charles Walker & Martin Self (both ARUP AGU)

Here is my first test on growing algorythm...
Highly inspired but for sure yet much less sophisticated...
L-system, fractals are now very trendy...

Option Explicit
Sub tree()
' ------------------------------------------------------
' growing tesselation
Dim intSubDivide: intSubDivide = 3
' growing twist differentation
Dim dblAngle : dblAngle = 120
' ------------------------------------------------------
'Dim arrCircles() 'dynamic array
Dim strCircle1, strCircle2, strCircle3, strCircle4, strCircle5
Dim arrCircGen1, arrCircGen2, arrCircGen3, arrCircGen4, arrCircGen5
' ------------------------------------------------------
Dim arrPlane: arrPlane = Rhino.WorldXYPlane
' ------------------------------------------------------
arrCircGen1 = Subdiv (strCircle,intSubDivide,dblAngle)
For Each strCircle1 In arrCircGen1

arrCircGen2 = Subdiv (strCircle1,intSubDivide,dblAngle)
For Each strCircle2 In arrCircGen2

arrCircGen3 = Subdiv (strCircle2,intSubDivide,dblAngle)
For Each strCircle3 In arrCircGen3

arrCircGen4 = Subdiv (strCircle3,intSubDivide,dblAngle)
For Each strCircle4 In arrCircGen4

'arrCircGen5 = Subdiv (strCircle4,intSubDivide,dblAngle)
'For Each strCircle5 In arrCircGen5

Subdiv strCircle4,intSubDivide,dblAngle
'to be changed each time less growth

'Next
Next
Next
Next
Next
' ------------------------------------------------------
End Sub
' ------------------------------------------------------
Function Subdiv(strCircle,intSubDivide,dblAngle)
' getCenter
Dim arrPtCenter: arrPtCenter = Rhino.CircleCenterPoint(strCircle)
' subdiv
Dim arrPts: arrPts = Rhino.DivideCurve (strCircle, intSubDivide)
Dim i
For i = 0 To UBound(arrPts)
Randomize
' collectOriginalEndPt
ReDim Preserve arrEndPtCollect(UBound(arrPts))
' setLength
' ------------------------------------------------------
Dim dblLengthExtend : dblLengthExtend = 1/3*Rhino.CurveLength(strRadial)
' ------------------------------------------------------
' setNewOrigine
' ------------------------------------------------------
' ------------------------------------------------------
' setNewPlane
Dim arrDirection: arrDirection = Array( arrEndPt(0), arrEndPt(1), arrEndPt(2)+1 )
Dim arrPlane: arrPlane = Rhino.PlaneFromPoints(arrEndPt, arrPtCenter, arrDirection)
Dim arrRotated: arrRotated = RotatePlane(arrPlane, dblAngle, arrPlane(1))