flash on 2011-12-9
ある円の周りに稠密に内接する円集合の描画
/**
* Copyright DanYuya ( http://wonderfl.net/user/DanYuya )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/rU5h
*/
// ある円の周りに稠密に内接する円集合の描画
package {
import flash.display.Sprite;
public class FlashTest extends Sprite {
public function FlashTest() {
// write as3 code here..
var s:Sprite = new Sprite();
s.graphics.beginFill( 0xFFCC00, 1 );
s.graphics.drawCircle( 233, 233, 100 );
for( var n:int = 6; n < 128; n++ ){
var delta:Number = 2 * Math.PI / n / 2;
var r:int = 100 + 100 * Math.sin( delta ) / ( 1 - Math.sin( delta ) );
s.graphics.beginFill( 0xFFFF00, 0.1 );
s.graphics.lineStyle( 0, 0x999900, 0.2 );
for( var i:int = 0; i < n; i++ ){
var theta:Number = i * 2 * Math.PI / n;
s.graphics.drawCircle( 233 + r * Math.cos( theta ),
233 + r * Math.sin( theta ), r - 100 );
}
}
addChild( s );
}
}
}