Quaternions?

Started by fbi, June 16, 2004, 15:54:41

Previous topic - Next topic

fbi

Hello everybody,
since I'm currently in the process of dealing with some quaternion stuff for my engine, I was wondering if anybody out there is interested into the same stuff.
If this is case, do you think would it be the case to include that into the next LWJGL release?  :)

Fool Running

Call me stupid :roll: , but what are quaternions? :)
Programmers will, one day, rule the world... and the world won't notice until its too late.Just testing the marquee option ;D

anarchotron

Quaternions are a way to represent a rotational transform without using a matrix.  I for one would like to have a nice Quaternion implementation to use in lwjgl.
I can no longer sit back and allow, communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy, to sap and impurify all of our precious bodily fluids." - Gen. Jack T. Ripper

fbi

Hi people,
you can take a look at the current version of the code at
Some notes:

1) I used the method negate to implement the conjugate operator, in order to be LWJGL-compliant  :D
2) I didn't implement a straight Euler-to-Quaternion conversion as it can be done via the axis-angle
3) I tried to be as tight as possible to the existent LWJGL API, keeping an eye to the javax.vecmath Quaternion implementation shipped with Java3D

Any comment is absolutely welcome  :wink:

fbi

Oh sorry...damn hard programming...I forgot the URL!  :lol:
Here it is:  http://ant1.di.uniba.it/lwjgl/Quaternion.java

fbi

Ok...I forgot to say that I'm going to implement SLERP, too  :)

aldacron

Quaternions should not be in core LWJGL, IMO. That's the sort of thing that should be packaged up in a separate jar. IIRC Cas was talking about doing that with the Vector stuff some time ago.

indiana

I'm using the seperate vecmath.jar from Java3D (it has nothing to do with Java3D though), which contains the javax.vecmath package, for all vector math. It also contains quaternion classes, you might want to take a look!

You can get vecmath-1.3.1.jar here:
http://www.twinklestone.de/stuff/vecmath-1.3.1.jar

fbi

Yeah...I took a look at it and some functions are adapted from that code even if they use a lot of redundant types (in my opinion, of course)  :)
Anyway I didn't think to include this as a part of the core...all in all a utils.jar seems to be a viable option.

princec

All the vector stuff has now been moved to org.lwjgl.util.vector, which will be available as a separate jar of odds and sods.

Cas :)

fbi

I know it very well...I'm using such a version indeed  :wink:
I was thinking that if quaternions stuff could be of any use, should be packed there  :)

spasi

Sorry for the late reply (inet connection problems).

I'm more than interested in quats and I have an implementation in our project (heavily used in skeletal animation). A complete implementation would be great in the LWJGL vector package. Although I'm not using it (I had most of it implemented before it showed up), I might do sometime.

One note about all math packages: If you create an object behind my back I'm not going to use you! I'm not really familiar with the lwjgl vector package, but that is the main reason I don't use Java3D's (and preferred to do it myself). So the request I have is (for you and anyone responsible for the math package) to provide as many methods necessary to avoid having to create loads of new objects.

By the way, I can't download your code.

fbi

Ok...Spasi...try to take a look at the actual code now (we experimented some connection problems in our department today)  :x
Tell me if the methods I created are enough for your format needs  :wink:

princec

All the LWJGL vecmath code is designed so no objects are created. We'd like a compatible quaternion class.

Cas :)

fbi

As you might notice this is guaranteed by the fact that Quaternion inherits from Vector4f and the fact that I took a look in depth at your code  :wink: