All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.daxie.basis.matrix.Matrix Maven / Gradle / Ivy

There is a newer version: 2.1.0
Show newest version
package com.daxie.basis.matrix;

/**
 * 4 by 4 matrix
 * @author Daba
 *
 */
public class Matrix {
	private float[][] m;
	
	public Matrix() {
		m=new float[4][4];
		
		for(int i=0;i<4;i++) {
			for(int j=0;j<4;j++)m[i][j]=0.0f;
		}
	}
	public Matrix(Matrix mat) {
		this.m=new float[4][4];
		
		for(int i=0;i<4;i++) {
			for(int j=0;j<4;j++)this.m[i][j]=mat.m[i][j];
		}
	}
	
	@Override
	public String toString() {
		String ret="";
		String separator=System.getProperty("line.separator");
		
		for(int i=0;i<4;i++) {
			for(int j=0;j<4;j++) {
				ret+=m[i][j];
				if(j!=3)ret+=" ";
			}
			
			if(i!=3)ret+=separator;
		}
		
		return ret;
	}
	
	public void SetValue(int row,int column,float value) {
		m[row][column]=value;
	}
	public float GetValue(int row,int column) {
		return m[row][column];
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy