Rh3_060503_Exhibited at the Royal Academie, London
(n)Tower, the maggie of nested loop...
COLLABORATIVE WORK WITH VINCENT NOWAK & CLAUDIA CORCILIUS (cici)
From DIN to DIM is a series of experimentations looking at transitions between the German Standard of design to self-similar objects controled by declared variables...
Both code are using simples nested loops
---------RECURSION---------
In mathematics and computer science, RECURSION specifies (or constructs) a class of objects or methods (or an object from a certain class) by defining a few very simple base cases or methods (often just one), and then defining rules to break down complex cases into simpler cases.
RECURSIVELY DEFINED SETS
* Example: the natural numbers
The canonical example of a recursively defined set is given by the natural numbers:
0 is in N
if n is in N, then n + 1 is in N
The set of natural numbers is the smallest set satisfying the previous two properties.
* Example: The set of true reachable propositions
Another interesting example is the set of all true "reachable" propositions in an axiomatic system.
* if a proposition is an axiom, it is a true reachable proposition.
* if a proposition can be obtained from true reachable propositions by means of inference rules, it is a true reachable proposition.
* The set of true reachable propositions is the smallest set of reachable propositions satisfying these conditions.
This set is called 'true reachable propositions' because: in non-constructive approaches to the foundations of mathematics, the set of true propositions is larger than the set recursively constructed from the axioms and rules of inference.
(Note that determining whether a certain object is in a recursively defined set is not an algorithmic task.)
RECURSION IN COMPUTER SCIENCE
A common method of simplification is to divide a problem into subproblems of the same type. As a computer programming technique, this is called divide and conquer and is key to the design of many important algorithms, as well as being a fundamental part of dynamic programming.
Recursion in computer programming is exemplified when a function is defined in terms of itself. One example application of recursion is in parsers for programming languages. The great advantage of recursion is that an infinite set of possible sentences, designs or other data can be defined, parsed or produced by a finite computer program.
Recurrence relations are equations to define one or more sequences recursively. Some specific kinds of recurrence relation can be "solved" to obtain a non-recursive definition.
Sub Tower()
' declare variables
Dim i, j
Dim arrCrvBank() 'dynamic array
' ------------------------------------------------------
' set variables: "Fl" = Floor
Dim intFloorNumber: intFloorNumber = 30
Dim intFloorHeight: intFloorHeight = 4'random(1,5)'random(1,3)'4
Dim intFloorRadius: intFloorRadius = Sin(i*10)+10'2'random(1,3)'(i/2+1,i)'8
' ------------------------------------------------------
Dim intSubDivide: intSubDivide = (2*intFloorNumber) + 4
Dim intLevel: intLevel = 0
' ------------------------------------------------------
' //////////////////////////////////////////////////////
'' FOR EVERY FLOOR
' //////////////////////////////////////////////////////
For i = 0 To intFloorNumber
Randomize
' ------------------------------------------------------
'' DRAW A CIRCLE
' ------------------------------------------------------
' setCenter
Dim x: x = 0'random(-1,1)'(-i/2,i/2)'0
Dim y: y = 0'random(-1,1)'(-i/2,i/2)'0
Dim z: z = intLevel
Dim arrCenter: arrCenter = Array(x,y,z)
' addCircle
Dim strCircle: strCircle = Rhino.AddCircle (arrCenter, intFloorRadius)
' ------------------------------------------------------
'' ROTATE THE CIRCLE
' ------------------------------------------------------
' getCircleDomain
Dim arrDomain: arrDomain = Rhino.CurveDomain(strCircle)
' Rotation for Twist
Dim intTwisting: intTwisting = i'random(1,(intSubDivide/2))
Dim dblParameter: dblParameter = arrDomain(0) + (arrDomain(1)/intSubDivide)*intTwisting
' reSet cercleOrigine
Rhino.CurveSeam strCircle, dblParameter
' ------------------------------------------------------
'' DIVIDE THE CIRCLE
' ------------------------------------------------------
' addPts onCircle
Dim arrPts: arrPts = Rhino.DivideCurve (strCircle, intSubDivide)
' deleteCircle
Rhino.DeleteObject strCircle
' //////////////////////////////////////////////////////
'' FOR EVERY (TWO) PTS
' //////////////////////////////////////////////////////
For j = 2 To UBound(arrPts) Step 2
' ------------------------------------------------------
'' DRAW A RADIAL
' ------------------------------------------------------
' addRadial
Dim strRadial : strRadial = Rhino.AddLine (arrPts(0), arrPts(j))
' ------------------------------------------------------
'' SET RADIAL LENGHT RADIAL
' ------------------------------------------------------
' setLength
Dim dblLength : dblLength = Random(2,10)
' getDomain : arrDomainRad(1) = original radius endPt
Dim arrDomainRad : arrDomainRad = Rhino.CurveDomain(strRadial)
' startPt
'Dim dblParam : dblParam = arrDomainRad(1) + (arrDomainRad(1) / dblLength)
Dim dblParam : dblParam = arrDomainRad(1) - (arrDomainRad(1) / dblLength)
Dim arrPointStart : arrPointStart = Rhino.EvaluateCurve(strRadial, dblParam)
' endPt
'dblParam = arrDomainRad(1) + dblParam
dblParam = arrDomainRad(1) + (arrDomainRad(1) / dblLength)
Dim arrPointEnd : arrPointEnd = Rhino.EvaluateCurve(strRadial, dblParam)
' ------------------------------------------------------
' deleteRadial
Rhino.DeleteObject strRadial
' ------------------------------------------------------
' SET PROFIL TO LOFT
' ------------------------------------------------------
' set arrPtsProfil
Dim arrPtsProfils: arrPtsProfils = array( arrPointStart,arrPts(j-1),arrPointEnd,arrPts(j+1),arrPointStart )
' addCurve
ReDim Preserve arrCrv((UBound(arrPts)/2)-1)
arrCrv((j/2)-1) = Rhino.AddCurve ( arrPtsProfils )
' addPolyline
ReDim Preserve arrPolyLines((UBound(arrPts)/2)-1)
arrPolyLines((j/2)-1) = Rhino.addPolyline ( arrPtsProfils )
Next
' //////////////////////////////////////////////////////
' ------------------------------------------------------
' createFloors
Dim arrFloor : arrFloor = Rhino.AddPlanarSrf ( arrPolyLines )
Rhino.SurfaceIsocurveDensity arrFloor, -1
' ------------------------------------------------------
' collecteCurvesToLoft (byFloors)
ReDim Preserve arrCrvBank(i): arrCrvBank(i) = arrCrv
' ------------------------------------------------------
' FOR NEXT LOOP:
intSubDivide = intSubDivide-2
intLevel = intLevel + intFloorHeight
' ------------------------------------------------------
Next
' //////////////////////////////////////////////////////
' //////////////////////////////////////////////////////
' INCREMENTAL LOFT PROCESS
' //////////////////////////////////////////////////////
Dim arrPolyLoft(), arrPtsCurves()
Dim intMax: intMax = intFloorNumber
j = 0
Do Until intMax = 0
' ------------------------------------------------------
For i=0 To intMax
ReDim Preserve arrPolyLoft(i)
arrPolyLoft(i) = arrCrvBank(i)(j)
Next
' ------------------------------------------------------
Dim strLoft : strLoft = Rhino.AddLoftSrf (arrPolyLoft,,,2,1,40)
Rhino.SurfaceIsocurveDensity strLoft, -1
j=j+1
intMax = intMax-1
Loop
' //////////////////////////////////////////////////////
End Sub
COLLABORATIVE WORK WITH VINCENT NOWAK & CLAUDIA CORCILIUS (cici)
From DIN to DIM is a series of experimentations looking at transitions between the German Standard of design to self-similar objects controled by declared variables...
Both code are using simples nested loops
---------RECURSION---------
In mathematics and computer science, RECURSION specifies (or constructs) a class of objects or methods (or an object from a certain class) by defining a few very simple base cases or methods (often just one), and then defining rules to break down complex cases into simpler cases.
RECURSIVELY DEFINED SETS
* Example: the natural numbers
The canonical example of a recursively defined set is given by the natural numbers:
0 is in N
if n is in N, then n + 1 is in N
The set of natural numbers is the smallest set satisfying the previous two properties.
* Example: The set of true reachable propositions
Another interesting example is the set of all true "reachable" propositions in an axiomatic system.
* if a proposition is an axiom, it is a true reachable proposition.
* if a proposition can be obtained from true reachable propositions by means of inference rules, it is a true reachable proposition.
* The set of true reachable propositions is the smallest set of reachable propositions satisfying these conditions.
This set is called 'true reachable propositions' because: in non-constructive approaches to the foundations of mathematics, the set of true propositions is larger than the set recursively constructed from the axioms and rules of inference.
(Note that determining whether a certain object is in a recursively defined set is not an algorithmic task.)
RECURSION IN COMPUTER SCIENCE
A common method of simplification is to divide a problem into subproblems of the same type. As a computer programming technique, this is called divide and conquer and is key to the design of many important algorithms, as well as being a fundamental part of dynamic programming.
Recursion in computer programming is exemplified when a function is defined in terms of itself. One example application of recursion is in parsers for programming languages. The great advantage of recursion is that an infinite set of possible sentences, designs or other data can be defined, parsed or produced by a finite computer program.
Recurrence relations are equations to define one or more sequences recursively. Some specific kinds of recurrence relation can be "solved" to obtain a non-recursive definition.
Sub Tower()
' declare variables
Dim i, j
Dim arrCrvBank() 'dynamic array
' ------------------------------------------------------
' set variables: "Fl" = Floor
Dim intFloorNumber: intFloorNumber = 30
Dim intFloorHeight: intFloorHeight = 4'random(1,5)'random(1,3)'4
Dim intFloorRadius: intFloorRadius = Sin(i*10)+10'2'random(1,3)'(i/2+1,i)'8
' ------------------------------------------------------
Dim intSubDivide: intSubDivide = (2*intFloorNumber) + 4
Dim intLevel: intLevel = 0
' ------------------------------------------------------
' //////////////////////////////////////////////////////
'' FOR EVERY FLOOR
' //////////////////////////////////////////////////////
For i = 0 To intFloorNumber
Randomize
' ------------------------------------------------------
'' DRAW A CIRCLE
' ------------------------------------------------------
' setCenter
Dim x: x = 0'random(-1,1)'(-i/2,i/2)'0
Dim y: y = 0'random(-1,1)'(-i/2,i/2)'0
Dim z: z = intLevel
Dim arrCenter: arrCenter = Array(x,y,z)
' addCircle
Dim strCircle: strCircle = Rhino.AddCircle (arrCenter, intFloorRadius)
' ------------------------------------------------------
'' ROTATE THE CIRCLE
' ------------------------------------------------------
' getCircleDomain
Dim arrDomain: arrDomain = Rhino.CurveDomain(strCircle)
' Rotation for Twist
Dim intTwisting: intTwisting = i'random(1,(intSubDivide/2))
Dim dblParameter: dblParameter = arrDomain(0) + (arrDomain(1)/intSubDivide)*intTwisting
' reSet cercleOrigine
Rhino.CurveSeam strCircle, dblParameter
' ------------------------------------------------------
'' DIVIDE THE CIRCLE
' ------------------------------------------------------
' addPts onCircle
Dim arrPts: arrPts = Rhino.DivideCurve (strCircle, intSubDivide)
' deleteCircle
Rhino.DeleteObject strCircle
' //////////////////////////////////////////////////////
'' FOR EVERY (TWO) PTS
' //////////////////////////////////////////////////////
For j = 2 To UBound(arrPts) Step 2
' ------------------------------------------------------
'' DRAW A RADIAL
' ------------------------------------------------------
' addRadial
Dim strRadial : strRadial = Rhino.AddLine (arrPts(0), arrPts(j))
' ------------------------------------------------------
'' SET RADIAL LENGHT RADIAL
' ------------------------------------------------------
' setLength
Dim dblLength : dblLength = Random(2,10)
' getDomain : arrDomainRad(1) = original radius endPt
Dim arrDomainRad : arrDomainRad = Rhino.CurveDomain(strRadial)
' startPt
'Dim dblParam : dblParam = arrDomainRad(1) + (arrDomainRad(1) / dblLength)
Dim dblParam : dblParam = arrDomainRad(1) - (arrDomainRad(1) / dblLength)
Dim arrPointStart : arrPointStart = Rhino.EvaluateCurve(strRadial, dblParam)
' endPt
'dblParam = arrDomainRad(1) + dblParam
dblParam = arrDomainRad(1) + (arrDomainRad(1) / dblLength)
Dim arrPointEnd : arrPointEnd = Rhino.EvaluateCurve(strRadial, dblParam)
' ------------------------------------------------------
' deleteRadial
Rhino.DeleteObject strRadial
' ------------------------------------------------------
' SET PROFIL TO LOFT
' ------------------------------------------------------
' set arrPtsProfil
Dim arrPtsProfils: arrPtsProfils = array( arrPointStart,arrPts(j-1),arrPointEnd,arrPts(j+1),arrPointStart )
' addCurve
ReDim Preserve arrCrv((UBound(arrPts)/2)-1)
arrCrv((j/2)-1) = Rhino.AddCurve ( arrPtsProfils )
' addPolyline
ReDim Preserve arrPolyLines((UBound(arrPts)/2)-1)
arrPolyLines((j/2)-1) = Rhino.addPolyline ( arrPtsProfils )
Next
' //////////////////////////////////////////////////////
' ------------------------------------------------------
' createFloors
Dim arrFloor : arrFloor = Rhino.AddPlanarSrf ( arrPolyLines )
Rhino.SurfaceIsocurveDensity arrFloor, -1
' ------------------------------------------------------
' collecteCurvesToLoft (byFloors)
ReDim Preserve arrCrvBank(i): arrCrvBank(i) = arrCrv
' ------------------------------------------------------
' FOR NEXT LOOP:
intSubDivide = intSubDivide-2
intLevel = intLevel + intFloorHeight
' ------------------------------------------------------
Next
' //////////////////////////////////////////////////////
' //////////////////////////////////////////////////////
' INCREMENTAL LOFT PROCESS
' //////////////////////////////////////////////////////
Dim arrPolyLoft(), arrPtsCurves()
Dim intMax: intMax = intFloorNumber
j = 0
Do Until intMax = 0
' ------------------------------------------------------
For i=0 To intMax
ReDim Preserve arrPolyLoft(i)
arrPolyLoft(i) = arrCrvBank(i)(j)
Next
' ------------------------------------------------------
Dim strLoft : strLoft = Rhino.AddLoftSrf (arrPolyLoft,,,2,1,40)
Rhino.SurfaceIsocurveDensity strLoft, -1
j=j+1
intMax = intMax-1
Loop
' //////////////////////////////////////////////////////
End Sub
Labels: Royale Academy London