バラ曲線リスト
バラ曲線のリスト
r = sin(θ * n/d)
このリストは横軸がn(1~8) 縦軸がd(1~8)
//
// バラ曲線のリスト
// r = sin(θ * n/d)
// このリストは横軸がn(1~8) 縦軸がd(1~8)
package
{
import flash.display.Sprite;
[SWF(width=465, height=465, frameRate=30, backgroundColor=0x000000)]
public class roseList extends Sprite
{
public function roseList()
{
this.graphics.beginFill(0);
this.graphics.drawRect(0,0,465,465);
this.graphics.endFill();
for (var d:uint = 0; d < 8; d++)
{
for (var n:uint = 0; n < 8; n++)
{
var r:Rose = new Rose(25, n + 1, d + 1);
addChild(r);
r.x = n * 55 +40;
r.y = d * 55 +40;
}
}
}
}
}
import flash.display.Shape;
class Rose extends Shape
{
public function Rose(radius:Number,n:uint,d:uint)
{
var c:Number = n/d;
this.graphics.lineStyle(1, 0xffffff);
this.graphics.moveTo(0,0);
for(var i:uint=0; i<360*d; i++)
{
var rad:Number = i * Math.PI /180;
var v:Number = Math.sin(c * rad);
var r:Number = radius * v;
var x:Number = r * Math.cos(rad);
var y:Number = r * Math.sin(rad);
this.graphics.lineTo(x,y);
}
this.graphics.endFill();
}
}