Hi, I am working on an astronomical image library which stitches spherical images together. Basically it involves lot of 3D vector rotation and other transforms.
I can not afford to create new Vector3D instance for each pixel, as it severely degrades performance. So I am reusing double[3] arrays to represent vectors. So please could you add this method to Rotation class? * /** Apply the rotation to a vector stored in an array.* * * It is more efficient, **as new instance does not have to be created for each rotation* * ** * * @param in an array with three items which stores vector to rotate* * * @param out an array with three items to put result to* * */* * public void applyTo(double[] in, double[] out) {* * * * double x = in[0];* * double y = in[1];* * double z = in[2];* * * * double s = q1 * x + q2 * y + q3 * z;* * * * out[0] = 2 * (q0 * (x * q0 - (q2 * z - q3 * y)) + s * q1) - x;* * out[1] = 2 * (q0 * (y * q0 - (q3 * x - q1 * z)) + s * q2) - y;* * out[2] = 2 * (q0 * (z * q0 - (q1 * y - q2 * x)) + s * q3) - z;* * }* Also it would be nice to have method '.toArray' and static '.fromArray' on Vector3D Regards, Jan http://github.com/jankotek/asterope