A recursive method consist in explore solutions which depends on solutions of the same instance of the solution. For example, a function take 3 points to build a triangle. After the triangle is built, the mid points of the triangle edges are calculated and the function is called again. this time, the new 3 points are passed as parameters. This process define an infinite number of instances, triangles inside another triangle, inside another triangle. Therefore a stop condition must be applied.

As opposed, iterations consist in repeat a certain number of tasks until a solutions is reached.
Recursion is a broadly concept applied in a variety of fields: Linguistic, Logic, Art, Humor, Philosophy, Computer Science, etc.

##### FINITE SUBDIVISION RULE

In mathematics, a finite subdivision rule is a recursive method to divide a polygon into smaller pieces, usually confused with fractals because, both exhibits self-similarity at different scales. finite subdivision rules also has different applications in design, biology, computer science, 3d modelling, etc.

Similar as the triangle example, A subdivision rule starts with a polygon tile and turns it into a new tile by subdividing the polygon into smaller polygons. It's called finite subdivision because there are only finite number of ways to subdivide every polygon at each step.

##### BASE CODE

The code below, is the start point I used to develop the following polygon subdivisions images.

```
Option Explicit
'Script written by Carlos de la Barrera'
Call Main()
Sub Main()
Dim pt1, pt2, pt3, trip
pt1 = Rhino.GetPoint("sel fisrt point")
If IsNull (pt1) Then Exit Sub
pt2 = Rhino.GetPoint("sel second point")
If IsNull (pt2) Then Exit Sub
pt3 = Rhino.GetPoint("sel third point")
If IsNull (pt3) Then Exit Sub
trip = Rhino.AddPolyline(Array(pt1, pt2, pt3, pt1))
Call myFractal(trip, pt1, pt2, pt3)
End Sub
Function myFractal(trip, Opt1, Opt2, Opt3)
Dim pt1, pt2, pt3
pt1 = myMidFunction(Opt1, Opt2)
pt2 = myMidFunction(Opt2, Opt3)
pt3 = myMidFunction(Opt3, Opt1)
trip = Rhino.AddPolyline(Array(pt1, pt2, pt3, pt1))
If Rhino.Distance(pt1, pt2) > 0.01 Then
Call myFractal(trip, pt1, pt2, pt3)
Else
Exit Function
End If
End Function
Function myMidFunction(P1, P2)
Dim MidP
MidP = Array((P1(0) + P2(0)) / 2, (P1(1) + P2(1)) / 2, (P1(2) + P2(2)) / 2)
myMidFunction = MidP
End Function
```

*The third one is the Sierpinski triangle*

*Experiments, with random decisions*

*Experiments, using other triangle properties for the subdivision*

*Hexagon patterns*

*Experiments transforming hexagons to triangles and vice versa*

*3D recursive subdivisions*

*Perspectives*

*elevation*

## 0 Comments:

## Add a comment