X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fmath%2FRotatableMatrix.java;fp=src%2Fjalview%2Fmath%2FRotatableMatrix.java;h=f3bf436e13bb5b03877a796fa04a2ac4a1c54316;hb=ec8f3cedf60fb1feed6d34de6b49f6bfa78b9dd8;hp=602c5e4bc6cf66c6e3a325d6a95c60017ca1dd13;hpb=056dad85a910551cc95e44d451a61f6b8c4dd35d;p=jalview.git diff --git a/src/jalview/math/RotatableMatrix.java b/src/jalview/math/RotatableMatrix.java index 602c5e4..f3bf436 100755 --- a/src/jalview/math/RotatableMatrix.java +++ b/src/jalview/math/RotatableMatrix.java @@ -22,6 +22,7 @@ package jalview.math; import jalview.datamodel.Point; +import java.io.PrintStream; import java.util.HashMap; import java.util.Map; @@ -57,7 +58,7 @@ public class RotatableMatrix public enum Axis { X, Y, Z - }; + } float[][] matrix; @@ -101,16 +102,11 @@ public class RotatableMatrix /** * Prints the matrix in rows of space-delimited values */ - public void print() + public void print(PrintStream ps) { - System.out.println( - matrix[0][0] + " " + matrix[0][1] + " " + matrix[0][2]); - - System.out.println( - matrix[1][0] + " " + matrix[1][1] + " " + matrix[1][2]); - - System.out.println( - matrix[2][0] + " " + matrix[2][1] + " " + matrix[2][2]); + ps.println(matrix[0][0] + " " + matrix[0][1] + " " + matrix[0][2]); + ps.println(matrix[1][0] + " " + matrix[1][1] + " " + matrix[1][2]); + ps.println(matrix[2][0] + " " + matrix[2][1] + " " + matrix[2][2]); } /** @@ -248,74 +244,6 @@ public class RotatableMatrix } /** - * DOCUMENT ME! - * - * @param args - * DOCUMENT ME! - */ - public static void main(String[] args) - { - RotatableMatrix m = new RotatableMatrix(); - - m.setValue(0, 0, 1); - - m.setValue(0, 1, 0); - - m.setValue(0, 2, 0); - - m.setValue(1, 0, 0); - - m.setValue(1, 1, 2); - - m.setValue(1, 2, 0); - - m.setValue(2, 0, 0); - - m.setValue(2, 1, 0); - - m.setValue(2, 2, 1); - - m.print(); - - RotatableMatrix n = new RotatableMatrix(); - - n.setValue(0, 0, 2); - - n.setValue(0, 1, 1); - - n.setValue(0, 2, 1); - - n.setValue(1, 0, 2); - - n.setValue(1, 1, 1); - - n.setValue(1, 2, 1); - - n.setValue(2, 0, 2); - - n.setValue(2, 1, 1); - - n.setValue(2, 2, 1); - - n.print(); - - // m.postMultiply(n.matrix); - // m.print(); - // m.rotate(45,'z',new RotatableMatrix(3,3)); - float[] vect = new float[3]; - - vect[0] = 2; - - vect[1] = 4; - - vect[2] = 6; - - vect = m.vectorMultiply(vect); - - System.out.println(vect[0] + " " + vect[1] + " " + vect[2]); - } - - /** * Performs a vector multiplication whose result is the Point representing the * input point's value vector post-multiplied by this matrix. *