Monday, April 21

Koch Snowflake 3D_01


































Worked on a script that builds 3D Koch Snowflakes from a given Base-Flake (1°), here is what it looks like.
The key was to have the coordinates of the object's bounding box. The Flake fits perfectly in, it's extremities all touch the box at /2, /3 or /4 edge lengths... holy geometry!

There are some reasons why I decided to try the Koch Snowflake geometry:
It it sort of a 3D tiling pattern, it grows recursively, like a fractal, it consists of just one simple module (itself being built from 8 even tetrahedrons) and last but not least, I just loved the snowflake allusion!

___
Option Explicit
'written by cubic on April 21th, 2008
'pick 3D Koch Snowflake to build +1° bigger flake


Call Main
Sub Main

Dim strFlake0
Dim arrBBox
Dim BoxX, BoxY, BoxZ
Dim arrFlakeBase
Dim arrReloc(7)
Dim arrVec(7)
Dim arrFlakes(7)
Dim n : n = 0

strFlake0 = Rhino.GetObject ("Please pick a 3D Koch Snowflake")
arrBBox = Rhino.BoundingBox (strFlake0)


'''''''''''''''''''''''''''''''''''''''''''''''
'Calculate base point (arrFlakeBase) for picked strFlake0, from flake's Bounding Box.

BoxX = Rhino.Distance (arrBBox(0), arrBBox(1))
BoxY = Rhino.Distance (arrBBox(0), arrBBox(3))
BoxZ = Rhino.Distance (arrBBox(0), arrBBox(4))

arrFlakeBase = Rhino.PointAdd (arrBBox(0), Array(0, BoxY/4, BoxZ/3))


'''''''''''''''''''''''''''''''''''''''''''''''
'Calculate relocation vectors for copies of strFlake0.

arrReloc(0) = Array(BoxX, 0, 0)
arrReloc(1) = Array(BoxX/2, BoxY/4, BoxZ/1.5)
arrReloc(2) = Array(BoxX/2, -BoxY/4, BoxZ/3)
arrReloc(3) = Array(BoxX/2, BoxY*0.75, 0)
arrReloc(4) = Array(0, BoxY/2, BoxZ/3)
arrReloc(5) = Array(BoxX, BoxY/2, BoxZ/3)
arrReloc(6) = Array(BoxX/2, BoxY/4, -BoxZ/3)


'''''''''''''''''''''''''''''''''''''''''''''''
'Make copies of strFlake0 and move to new positions ...

For n = 0 To 6
arrVec(n) = Rhino.PointAdd (arrFlakeBase, arrReloc(n))
arrFlakes(n) = Rhino.CopyObject (strFlake0, arrFlakeBase, arrVec(n))
Next

End Sub

1 comment:

Anonymous said...

Hello Phillipp,
nice blog,
I'm origamist and I have developed a origami Koch Snowflake 3D level 2, but no folded yet, and just looking for images, I found yours, see my Crease Pattern at
http://www.flickr.com/photos/origamiz/2950199976/