ま た か
ってことでフラクタルw

C曲線とはレヴィさんが考えたフラクタルのことで、Cに似た形になることからC曲線と名づけたそうです。
適当だなおいw

C曲線はコッホ曲線と似ています
コッホ曲線は線分を3分割し、真ん中の線分を正三角形に置き換えていました
C曲線では線分全体を直角二等辺三角形に置き換えます

Koch&C

これだけでできあがる形はまったく違うものになります
これは「ほんのわずかな初期条件の違いが予想もつかないほど大きく違った結果を生む」というカオスの特徴でもあります
実はカオスとフラクタルは密接に関係しており、自然界で多くみられるカオスをグラフにプロットするとそのグラフはフラクタルな性質を示すことが知られています

すごいですなぁw

※クリックでstart

Flash Player 10 にしてください

Line.as


package {
	import flash.display.Sprite;
	import flash.geom.Point;
	public class Line extends Sprite{
		public var startP:Point;
		public var endP:Point;
		public var distance:Number;
		public var angle:Number;
		function Line(startP:Point, endP:Point) {
			this.startP = startP;
			this.endP = endP;
			distance = Point.distance(startP, endP);
			angle = Math.atan2(endP.y-startP.y, endP.x-startP.x);

			graphics.lineStyle(0,0x000000);
			graphics.moveTo(startP.x, startP.y);
			graphics.lineTo(endP.x, endP.y);
			graphics.endFill();
		}
	}
}

CCurve.as


package {
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	import flash.events.Event;
	import flash.geom.Point;
	public class CCurve extends Sprite {
		private var list:Array = [];
		private var endPoint:Point;
		private var count:int=0;
		private const N:int=10;
		private const W:int = 300;
		private const H:int = 300;
		function CCurve() {
			var line:Line=new Line(new Point(W/4,H*2/3),new Point(W-W/4, H*2/3));
			endPoint=line.endP;
			list.push(line);
			stage.addChild(line);

			stage.addEventListener(MouseEvent.CLICK,onClick);
			function onClick(event:MouseEvent):void {
				stage.addEventListener(Event.ENTER_FRAME,onEnterFrameHandler);
				stage.removeEventListener(MouseEvent.CLICK,onClick);
			}

		}
		private function onEnterFrameHandler(event:Event):void {
			var line:Line=list[0];
			stage.removeChild(line);
			list.splice(0, 1);

			var p1:Point=new Point();
			p1.x= line.distance/2 * Math.SQRT2 * Math.cos(line.angle-Math.PI/4) + line.startP.x;
			p1.y= line.distance/2 * Math.SQRT2 * Math.sin(line.angle-Math.PI/4) + line.startP.y;

			var newLine:Line=new Line(line.startP,p1);
			stage.addChild(newLine);
			list.push(newLine);
			newLine=new Line(p1, line.endP);
			stage.addChild(newLine);
			list.push(newLine);

			if (line.endP == endPoint) {
				count++;
				trace(count);
				if (count == N) {
					stage.removeEventListener(Event.ENTER_FRAME,onEnterFrameHandler);
				}
			}
		}
	}
}
このエントリーを含むはてなブックマークはてなブックマーク - フラクタル~C曲線~ この記事をクリップ!Livedoorクリップ - フラクタル~C曲線~ BuzzurlにブックマークBuzzurlにブックマーク FC2ブックマークへ追加 Bookmark this on Delicious Digg This