class Matrix extends Object
{
	function Matrix()
	{
	$this->Object();
	$this->addAction($this->MatrixAction(),"act");
	$this->compire();
	}
	function MatrixAction()
	{
	$act = new SWFAction
	("
		//二次元配列
		this.newMatrix =function(name){
		return matrix = new Array
				  (0,0,0,0,0
		         	  ,0,0,0,0,0
				  ,0,0,0,0,0
				  ,0,0,0,0,0);
		};

		this.setMatrix_array = function(self,matrix){
		this = matrix;
		};

		this.getMatrix_array = function(self){
		return self;
		};

		this.getElement = function(self,row,col){
		return self[4*row+col];
		};

		this.setElement= function(self,row,col,element){
		self[4*row+col] = element;
		};

		this.duplicateArray= function(self){
		
		matrix = newMatrix();
		
		for(i = 0;i<4;i++ )
		 for(j = 0;j<4;j++){
			matrix[4*i+j] =getElement(self,i,j);
			}
		return matrix;
		};
//演算

		this.multiplication= function(A,B)
		{
		matrix = newMatrix();
		temp = 0;
	      for(m = 0;m<4;m++)
		for(i=0;i<4;i++){
		  for(j=0;j<4;j++)
				{
			temp += getElement(A,m,j)*getElement(B,j,i);
				}
			setElement(matrix,m,i,temp);temp=0;
			}
		return matrix;
		};


		this.addition = function(A,B)
		{
			matrix = newMatrix();
			for(i=0;i<4;i++)
			  for(j=0;j<4;j++)
  			    {
			    this.setElement(matrix,i,j,getElement(A,i,j)+getElement(B,i,j));  
		  	    }
		};

		this.transpose = function(self)
		{
 		  matrix = newMatrix();

		  for(i = 0;i<4;i++)
			for(j = 0;j<4;j++){
			setElement(matrix,i,j,getElement(self,j,i));
			}
		};

		this.rotate_x = function(A,kakudo){

		rotate = newArray();
		rotate.setData(0,0,1);
		rotate.setData(1,1,Math.cos(kakudo));
		rotate.setData(1,2,Math.sin(kakudo));
		rotate.setData(2,1,-1*Math.sin(kakudo));
		rotate.setData(2,2,Math.cos(kakudo));
		rotate.setData(3,3,1);
		
		
		return rotate;
		};

		this.printMatrix = function(self){
			string = '';
			for(i=0;i<4;i++){
				string+='\n';
		 	  for(j=0;j<4;j++){
				string +=getElement(self,i,j)+' '; 
		  			}}
			_root.print.text.text = string;
		};

	");
	return $act;
	}
}


楽天モバイル[UNLIMITが今なら1円] ECナビでポインと Yahoo 楽天 LINEがデータ消費ゼロで月額500円〜!


無料ホームページ 無料のクレジットカード 海外格安航空券 解約手数料0円【あしたでんき】 海外旅行保険が無料! 海外ホテル