1. NodeBox 1
    1. Homepage
    2. NodeBox 3Node-based app for generative design and data visualization
    3. NodeBox OpenGLHardware-accelerated cross-platform graphics library
    4. NodeBox 1Generate 2D visuals using Python code (Mac OS X only)
  2. Gallery
  3. Documentation
  4. Forum
  5. Blog

fermat spiral

Posted by Emilio on Mar 15, 2012



my first attempt to reproduce a fermat spiral in nodebox.
work inspired by this applet built in processing.

import math
from math import *
 
size(150, 150)
 
a=2
 
var("seeds", NUMBER, 100, 20, 1000)
semi = int(seeds)
 
var("angle", NUMBER, 2.39983333, 0, 6.28320000)
#angle = 1.5708 # = 90°
 
var("dim", NUMBER, 1, 0, 2)
 
var("dif", NUMBER, 0, 0, 0.01)
 
 
var("goldenRatio", BOOLEAN, False)
if goldenRatio:
    angle = 2.39983333
    
print "---"
print "angle", angle
print "seeds", semi
 
translate (WIDTH/2, HEIGHT/2)
 
for i in range(semi):
    x = a* sqrt(i) * cos(i* angle)
    y = a* sqrt(i) * sin(i* angle)
    
    rr = dim+(i*dif)
    
    oval(x-(rr/2), y-(rr/2), rr, rr)