Can you do Vector addition in Java, natively?
I don't think there is a built-in way to do vector addition, however I've found a series describing how this could be done.
Yes, you'll have to write a class or use a library such as JScience
Java3D has various forms of Vector classes (Vector3d, Vector3f, Vector4d, etc). Java3D, of course, is somewhat risky these days, though, as it's seemingly set for abandonment.
If you are looking to make a vector in 2d space, couldn't you just go with a simple Point2D(x,y)
and let the length of your vector define magnitude?
So that Point2D a = new Point2D(1,1);
has a magnitude of 1.4, and a NE direction. And a Point2D b = new Point2D(2,2);
has the same direction but a magnitude of 2.8...
Addition would then just be: Point2D c = new Point2D(a.x + b.x, a.y + b.y);
In 3d space I would create my own class, or an entirely different data structure depending on you actual problem.
Edit: I hope he has found a solution in the past 3 years..