// Instance Methods public double DotProduct(Vector3D a) { return a.x * x + a.y * y + a.z * z; }
public Vector3D CrossProduct(Vector3D b) { double p = y * b.z - z * b.y; double q = z * b.x - x * b.z; double r = x * b.y - y * b.x; return new Vector3D(p, q, r); }
public static Vector3D CrossProduct(Vector3D a, Vector3D b) { return a.CrossProduct(b); }
// Static methods public static double DotProduct(Vector3D a, Vector3D b) { return a.DotProduct(b); }
public Vector3D(Vector3D a) { x = a.x; y = a.y; z = a.z; }