Hi all, The attached file just tries to define a simple "cross product" between two vectors. the results are incorrect and i don't know why. I run jdk1.1.7 on glibc, RedHat 5.1 on a 200Mhz Pc. Thanks in advance, -Karthik. +-----------------------------------------------------------------+ | Karthik Vishwanath, Junior Research Fellow, | | National Centre for Biological Sciences, TIFR Bangalore, India. | | Ph[Off]: (080)8561657/58/59/71/72; 8462895, Ext. 3231 | | mail to: [EMAIL PROTECTED] | | Alt mail: [EMAIL PROTECTED] | +-----------------------------------------------------------------+ Microsoft isn't the answer. Microsoft is the question and the answer is NO.
public class aVectorUtil { public double x; public double y; public double z; public static void main(String argv[]) { aVectorUtil u = new aVectorUtil(1.0, 2.0, 0.0); aVectorUtil v = new aVectorUtil(0.0, 0.0, 1.0); u.print(); v.print(); u.cross(u,v); u.print(); } public aVectorUtil(double x1, double y1, double z1) { this.x = x1; this.y = y1; this.z = z1; } public void cross(aVectorUtil v1, aVectorUtil v2) { this.x = (v1.y*v2.z) - (v1.z-v2.y); this.y = (v1.z*v2.x) - (v1.x*v2.z); this.z = (v1.x*v2.y) - (v1.y*v2.x); } public void print() { System.out.println("(x,y,z) = ("+ this.x +","+this.y+","+this.z +")"); } }