Vectors for a 2D/3D World in Java

Posted by jax on Stack Overflow See other posts from Stack Overflow or by jax
Published on 2010-03-15T05:18:10Z Indexed on 2010/03/15 5:19 UTC
Read the original article Hit count: 190

Filed under:

I reading about Mathematics in Games and am wondering what is the best way to represent a Vector location in Java.

I know there is a Vector class but I don't think this is what I need.

There is also a Matrix class which looks like it may be what I want (a 1 dimensional matrix maybe).

In particular, if I were to create a location Vector such as:

v(x,y,z) where x,y and z are the coordinates in 3D space, what would be the best way to represent this in Java. It would be nice if I could also add, subtract and find the dot-product of Vectors.

ideas?

© Stack Overflow or respective owner

Related posts about java