math fun

 

Found this sketch of Albrecht Duerer on Citrinitas and I had to do it. It was obvious that there was some trigonemetry involved, especially in the left hand side. The one with the circles look like a sine wave, oscillating on the vertical axis. from what I gather,

-each step the cos(angle) gets incremented.

-circle’s horizontal positions are cos(anle).

-since cos(x) goes from -1 to 1, we get the wave plotted.

for(var j:Number = 0;j<=600;j++){

var dot:Sprite = new Sprite();

dot.graphics.lineStyle(1,0×000000,1);

dot.graphics.drawCircle(0,0,4);

dot.x=Math.sin(angle*(Math.PI/180))*40+100;

dot.y=j*2+2;

addChild(dot); angle+=   j/20; trace(600-j);

}

 

Above is the AS3.0 code of the algorithm. Also, Flash you need to convert degrees to radians.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: