— applet display disabled, since java security is whack —

An early effort with Processing: implementation of a function demonstrated by a mathematician I know online only as fadesingh, which he originally showed here (it’s a big animated gif… give it time).

Some scaling factor appears to result in a rosette where he shows a butterfly, but it’s an interesting first step none the less.

code

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
float radius = 100; float scaler = 0.3; float t = 0; int angleinc = 1; void setup() { size(400,400); background(204); frameRate(30); } void draw() { t += .001; //println(t); background(204); butterfly(t); } void butterfly(float t){ float magi; float lastmag = 0; int lastangle = 0; for(int angle=0; angle<361; angle+=angleinc){ magi = exp(sin(t)) - 2*cos(angle*t) + (sin(1/2*(angle*t-PI))); polarLinePlot(lastangle,angle,lastmag,magi); lastmag = magi; lastangle = angle; } } void polarLinePlot(int angle1,int angle2,float mag1,float mag2){ float x_offset = width/2; float y_offset = height/2; float px1 = x_offset + cos(radians(angle1))*radius*mag1*scaler; float py1 = y_offset + sin(radians(angle1))*radius*mag1*scaler; float px2 = x_offset + cos(radians(angle2))*radius*mag2*scaler; float py2 = y_offset + sin(radians(angle2))*radius*mag2*scaler; line(px1,py1,px2,py2); } |

[collapse]

Addendum: I’m beginning to see where my understanding of the idea behind this is faulty. More later, when I am sure of my corrections.