tags:

views:

434

answers:

4

I Know there's a "Vector" class in java, but it seems to be just a simpler ArrayList type of deal, not an actual, mathematical Vector (as in a magnitude and a direction).

Is there any way to do Vector manipulations (particularly addition) in Java? Or am I stuck on my own having to implement it or use a third party module?

-Jenny

+1  A: 

Yes, you'll have to write a library (or use a third-party library) in order to perform vector arithmetic.

erickson
+2  A: 

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.

luvieere
+1  A: 

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.

M1EK
Java3D is definitely set for abandonment. However, this is still a good answer, because you can easily just take "vecmath.jar" from Java3D and use the vector classes by themselves.
jprete
+3  A: 

Yes, you'll have to write a class or use a library such as JScience

dfa
+1 - I never saw that library, looks interesting.
James Black
Thanks for the link, JScience really does look great!
Jenny
Although in retrospect, it confuses me greatly. It does things I've never seen before. I guess I'll make a new question about it...
Jenny
Looking at the JScience website and CVS repository, it looks like nothing has changed in the past 2 years. Not exactly a good sign ...
Stephen C