Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm writing an OpenGL app with Java. I need to do some math for camera and frustum culling (for AABB). Could you suggest a simple and fast Java math library for that?

share|improve this question

closed as not constructive by Byte56, Josh Petrie, Tetrad Jan 4 '13 at 18:30

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

Sounds like a "What should I use for X", which are discouraged by the very first FAQ question. –  Anko Dec 28 '12 at 12:58

3 Answers 3

up vote 3 down vote accepted

Vecmath from Java3d http://java.net/projects/vecmath is useful for standard 3d geometry stuff.

Not sure camera and frustum culling would really be a bottleneck, but if you use this heavily you should try to reuse things like Vector3f rather than calling new the whole time which can lead to costly garbage collection.

share|improve this answer
mvnrepository.com/artifact/java3d/vecmath seems to have a more readily available jar. I'm not sure where this library is supposed to live these days, but I do think it is the library you want. –  PeterT Jan 9 '12 at 16:45

JAMA math.nist.gov/javanumerics/jama

Colt acs.lbl.gov/software/colt

jblas jblas.org

These come to mind first. jblas, thanks to the natives, seems to be a lot faster than the other though. Keep in mind the applet loader from LWJGL allow you to easily use natives in an applet.

see http://stackoverflow.com/questions/529457/performance-of-java-matrix-math-libraries

share|improve this answer
I believe these are not really designed for the kind of matrix maths one wants for 3d graphics; they are for operations on arbitrarily large matrices (like stats) rather than typical 3x3 or 4x4 geometric ones... unless I'm mistaken these libraries would be overcomplicated and suboptimal for simple graphic transformation kind of use-case. –  PeterT Jan 9 '12 at 16:52
If you are looking for pure speed you should use the natives. However, if you are looking for simplicity ("speed" as in "easy to understand and implement"), it may be a bit overkill. –  Klems Jan 9 '12 at 17:32
I doubt very much that native libraries designed to deal with large matrices will be more optimal than vecmath for these kinds of operations, HOWEVER... what you really want is something that can take advantage of native SIMD instructions on the CPU. AFAIK that isn't really practical in Java at present. Nonetheless, I maintain that your suggestions would be overcomplicated for the computer as well as the programmer... never a good combination. –  PeterT Jan 11 '12 at 19:34

I'am the author of la4j library (Linar Algebra for Java). I've just released verion 0.3.0. Try to look at it. la4j works pretty fine now with sparse and dense matrices.

share|improve this answer
-1: Your library does not seem to have any support for the requested features. Game-oriented matrix libraries tend to have far less "real linear algebra" features than la4j does, but do have a lot of specialized math for things like projection matrix generation, camera look-at matrix generation, etc. –  Sean Middleditch Dec 28 '12 at 7:59

Not the answer you're looking for? Browse other questions tagged or ask your own question.