public static MatrixVector convertToMatrix(Vector3[] points){ MatrixVector m = new MatrixVector (points.Length, 1); for (int i=0; i<points.Length; i++) m.setValueAt (i, 0, points [i]); return m; }
public static MatrixVector convertToMatrix(Vector3[] points) { MatrixVector m = new MatrixVector(points.Length, 1); for (int i = 0; i < points.Length; i++) { m.setValueAt(i, 0, points [i]); } return(m); }
public static MatrixVector multiplyByMatrix(Matrix m, MatrixVector n) { MatrixVector res = new MatrixVector(m.getNrows(), 1); for (int i = 0; i < m.getNrows(); i++) { Vector3 sum = new Vector3(0, 0, 0); for (int j = 0; j < m.getNcols(); j++) { sum += new Vector3((float)(m.getValueAt(i, j) * n.getValueAt(j, 0).x), (float)(m.getValueAt(i, j) * n.getValueAt(j, 0).y), (float)(m.getValueAt(i, j) * n.getValueAt(j, 0).z)); } res.setValueAt(i, 0, sum); } return(res); }
public static MatrixVector multiplyByMatrix(Matrix m, MatrixVector n) { MatrixVector res = new MatrixVector (m.getNrows(), 1); for (int i=0; i<m.getNrows(); i++) { Vector3 sum = new Vector3 (0, 0, 0); for (int j=0; j<m.getNcols(); j++) sum += new Vector3 ((float)(m.getValueAt (i, j) * n.getValueAt(j,0).x), (float)(m.getValueAt (i, j) * n.getValueAt(j,0).y), (float)(m.getValueAt (i, j) * n.getValueAt(j,0).z)); res.setValueAt(i,0,sum); } return res; }