class Polygon extends Object
{
	function Polygon()
	{
	$this->Object();
	$this->addAction($this->PolygonAction(),"act");
	$this->compire();
	}

	function PolygonAction()
	{
	$act = new SWFAction
	("
	
	
	this.newPolygon_square = function(){
	polygon = new Array();
	square = new Array(-100,-100,
			   -100,100,
                           100,100,
			   100,-100,
			   -100,-100);
	for (i = 0; i < square.length ;i++){
	polygon.push(_root.Matrix.newMatrix());
	}

	for(i=0;i<polygon.length/2;i++){
	 _root.Matrix.setElement(polygon[i],0,0,square[i*2+0]);
	 _root.Matrix.setElement(polygon[i],0,1,square[i*2+1]);
	 _root.Matrix.setElement(polygon[i],0,2,-100);

	 _root.Matrix.setElement(polygon[5+i],0,0,square[i*2+0]);
	 _root.Matrix.setElement(polygon[5+i],0,1,square[i*2+1]);
	 _root.Matrix.setElement(polygon[5+i],0,2,100);
	}
	return polygon;
	};
	
	duplicate = function(poly)
	{
		polygon = new Array();
		for(i = 0;i<poly.length;i++){
		polygon.push(_root.Matrix.duplicateArray( poly[i] ));
		}
		return polygon;
	};

	multiplication = function(poly,kakeru)
	{
	A = duplicate(poly);
	
	for(i = 0;i<poly.length;i++){
	A[i] =  _root.Matrix.multiplication(kakeru,_root.Matrix.transpose(A[i]));
	A[i] = _root.Matrix.transpose(A[i]);
	}
//	_root.Matrix.printMatrix(_root.Matrix.transpose(A[0]));
	return A;
	};

	move = function(poly,mov_x,mov_y,mov_z){
		temp = duplicate(poly);
		for(i=0;i<poly.length;i++)
		{
		temp[i][0]=mov_x +  poly[i][0];
		temp[i][1]=mov_y +  poly[i][1];
		temp[i][2]=mov_z +  poly[i][2];
		}

		return temp;
		};

	rotate_x = function(poly,kakudo)
		{
		k = kakudo;
		x = new Array
		(
		1,0,0,0,
		0,Math.cos(k),Math.sin(k),0,
		0,-1*Math.sin(k),Math.cos(k),0,
		0,0,0,1
		);

		temp = duplicate(poly);
		temp = multiplication(temp,x);
		
		return temp;
		};

	");
	return $act; 
	}

}


Gポイントポイ活 Amazon Yahoo 楽天

無料ホームページ 楽天モバイル[UNLIMITが今なら1円] 海外格安航空券 海外旅行保険が無料!