public class Vector2D { // technically not required as vectors have the same information as points, but it's useful to have separate vector and point things.. public double x; public double y; public Vector2D(double _x, double _y){ x = _x; y = _y; } public void createFrom2Points(Point2D start, Point2D end){ x = end.x - start.x; y = end.y - start.y; } public double getLength(){ return Math.sqrt(x*x + y*y); } public double angleTo(Vector2D vec2){ return Math.acos( dot(vec2) / (getLength()*vec2.getLength())) * Math.signum(x*vec2.y - y *vec2.x); } public double dot(Vector2D vec2){ return (x*vec2.x) + (y*vec2.y); } }