Inter-Utility Class Helper Methods

Started by dstaudigel, May 30, 2007, 03:36:19

Previous topic - Next topic

dstaudigel

Hey, I'm new to Java/GL (but not to C++/GL) and ended up writing my own whole framework based on JOGL.  I implemented a number of utility classes including Vector, Quaternion, and Matrix code.  I am transitioning over to LWJGL, and prefer some things, but find a few basic things lacking.  Where are the following things:

1) Quaternion/Vector direct multiplication (so you don't have to make a new matrix, should be static Quaternion.transform(Quaternion left,Vector right,Vector dest)
2) Quaternion/Vector direct inverse multiplication (so you don't have to invert and then make a new matrix)
3) Scaled Vector addition (Dx = Vx * V2x * f), so you don't have to create a temporary vector.
4) Quaternion from Start/Finish vector
5) Matrix from quaternion (should be static Matrix(3|4)f.rotate(Matrix left,Quaternion right,Matrix dest, or Matrix(3|4)f(Quaternion copy).
6) Matrix/Quaternion from (physics) standard angular velocity vector (omega), i.e. same as axis/angle but angle is the magnitude in radians.

[EDIT: Here's another one I forgot]
7) Where are the Vector(2|3|4)d and Matrix(2,3,4)d classes?  Shouldn't the quaternion class be all doubles?  That's the way I've seen it done most of the time.  Correct me if I'm out to lunch, I do think doubles are a bit fat, but that's just what I've seen.  Also, all of the Java math commands spit out and take doubles.
[/EDIT]

There probably are more, bu these are the only ones I can think of offhand.  I have code that does all of these things which I am working in as subclasses, but I'd like to have them in LWJGL, because it's easier that way.  Should I just join the project and go for it in SVN?  I also don't know if this functionality is implemented elsewhere or would conflict with the "style" of LWJGL, and wouldn't want to tread on any toes by adding in these basic methods.

Thanks a lot, and this is some great stuff, by the way.

Daniel Staudigel

Matzon

I'm not sure what should and what shouldn't be in our math package, but I am sure that adding more utility methods is a good thing.
As for being in float, that is because opengl itself only works in float. There is no need for the added precision since it drop performance slightly.

The best way to get things in SVN currently, is just to submit a patch file against trunk. You should also stop by #lwjgl on freenode if possible.

elias

I'm very open to patches to util.vector:

1) The classes end up in a separate lwjgl_util.jar anyway, so bloat for people not using the vector stuff is not a problem.
2) Afaik, the vector stuff is not used much (beside the basic stuff) by the core developers, so it would be nice with some help in that area to make it more generally useful.
3) I tend to agree that lwjgl's vector stuff is hanging somewhere between not good enough for wide use, but good enough not to remove entirely and replace by some other vector library. So in lack of courage to remove it altogether, I welcome patches that enhance the library.

As for the practical stuff, let's keep it to patches against svn head in the beginning.

- elias

kappa

yup would love to see the lwjgl vector stuff upgraded, I use it but its a bit inconsistent and could do with an overhaul. Quaternions would be useful, last i worked on skeletal animation had to write my own class for it.

will have to have a look at the api first though before giving it my final blessing :)