// technically not required as vectors have the same information as points, but it's useful to have separate vector and point things.. public class Vector3D { public double x; public double y; public double z; public Vector3D(double _x, double _y, double _z){ x = _x; y = _y; z = _z; } public double angleTo(Vector3D vec2){ return Math.acos( (x*vec2.x + y*vec2.y + z*vec2.z) /( //----------------------------------------------------------- Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2) + Math.pow(z, 2)) * Math.sqrt(Math.pow(vec2.x, 2) + Math.pow(vec2.y, 2) + Math.pow(vec2.z, 2)))); } }