Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (538)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (600)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  VecMath (fast?) replacement  (Read 4922 times)
0 Members and 1 Guest are viewing this topic.
Offline shawnkendall

Senior Devvie





« Posted 2003-09-27 04:09:57 »

Hi all,
I finally got to give some attention to our vec math classes again.
After some reexamination, we are going with a somewhat J3D vecmath compatible API.  We used compatible class names for easier replacement into existing projects.  It's quite stripped down however.  For example, there are no double formats or Color classes and no plans to make them.  The source is bare (few comments) as well right now, but the Javadocs for J3D vecmath would explain the existing methods that match.

If any gets a chance let us know what you think.  We are trying to get a feel for what people use the most of in the original APIs but no more than that Smiley

Also, this release does NOT use our fast math classes yet (sin/cos etc).  We are still mulling the best way to allow the user to "config" it's usage in the vecmath classes.

It is being releases under the BSD license and here is some info from the pitiful release notes in this early version.
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
Lite VecMath
September 26, 2003
Release Notes:

-----------------------------
General design choices:

No equals/hashcode combo
Used clonable interface instead of explicitly overridding clone.
No clamping methods
Only support floating point versions, i.e no double, int or byte classes.
No double convience methods
No need for Tuple parent types since there would only be one child class for each type
All color types dropped/unimplemented.  However, the Color3f convience methods have been added to Vector3f
No epsilonEquals

Package name will change in future releases.

-----------------------------
javax.vecmath Classes partially supported:

Matrix3f
Matrix4f
.
.
No INVERT (priority 1)
---------
Quat4d
Quat4f

True quat interpolation (slerp) not implemented yet. (priority 1)

---------
Vector2f
Vector3f


General, toString output format is the same as original vecmath.

And finally the download link
http://www.imilabs.com/loader/loader/vecmathLite.jar
<mod> I went ahead and added the javadocs into the jar.

Shawn Kendall
Cosmic Interactive, LLC
http://www.facebook.com/BermudaDash
Offline shawnkendall

Senior Devvie





« Reply #1 - Posted 2003-09-27 04:45:37 »

Extra comment...
These classes do not have any methods for working with FloatBuffers as the LWJGL vector/matrix classes do, but we will add them.
They are not here now because we are still looking at a few options.  For example, I am leaning towards a utils class to do it in because there are several way you might want to pass on to FloatBuffers, not just a per matrix copy.  I want to be able to things like pass arrays for vectors and have the utils write it all to an array and then to the FloatBuffer in one move if that proves to be faster (or for what size will it?)

Shawn Kendall
Cosmic Interactive, LLC
http://www.facebook.com/BermudaDash
Offline William Denniss

JGO Coder


Projects: 2


Fire at will


« Reply #2 - Posted 2003-09-28 22:18:26 »

i havn't had the chance to look at it yet but are you keeping the javax.vecmath package name?  Otherwise it is a bit of a pain to switch (especially in this case where one implementation of the vecmath package should be almost identical in behaviour to the next).  Reason I ask is you say " Package name will change in future releases."

Will.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline shawnkendall

Senior Devvie





« Reply #3 - Posted 2003-09-29 00:41:28 »

The package name I used was vecmath.*
I just dropped the javax.
I thought that this would make for trouble so I kept it similiar, especially since the API is pratically the same.

Possible it could become net.vecmath at some point?

Shawn Kendall
Cosmic Interactive, LLC
http://www.facebook.com/BermudaDash
Offline William Denniss

JGO Coder


Projects: 2


Fire at will


« Reply #4 - Posted 2003-09-29 02:34:04 »

my opinion is that what you have is an implementation of the "javax.vecmath" library and therefore it should be named as such - this makes testing so much easier as you just pull one .jar from your classpath and plonk one back in.  IIRC the other free implementation followed this.

The same argument could be used for Xith3D itself, but that is less of an implementation of Java3D, and more an implemenation of a similar scenegraph.  With vecmath, the classes, method names and functionailty is exactally the same (hopefully) as it was for the official javax.vecmath package.

Fair enough you have cut some of the fat from the offiical javax.vecmath but what you have left in is essentially the same stuff.  This way you don't have to change a whole pile of import statements everytime you switch vecmath implementations.

Cheers,

Will.

Offline swpalmer

JGO Coder


Exp: 12 years


Where's the Kaboom?


« Reply #5 - Posted 2003-09-29 12:45:45 »

Are you "allowed" to do that?
Do you have to make an "endorsed standard" ?  I know the java.* packages are off-limits, but 3rd parties are allowed to make implementations of the javax.*  I just wonder if they are allowed to not match the official spec of a javax API and still use that name?

Offline shawnkendall

Senior Devvie





« Reply #6 - Posted 2003-09-29 13:45:06 »

Ok my original-cross posting has cause this thread to run in http://www.java-gaming.org/cgi-bin/JGNetForums/YaBB.cgi?board=xith3d;action=display;num=1063928279
as well.
I will stop posting there and move all my discusssions to here.
My last reply was this:
No offense, but the package name can NOT be the same.
It's not the same API, or code.
And it's not "javax", that is a "semi" official package division used on many Java APIs.

Anyone else have an view?  I've never heard of releasing an API with the same package name as an existing one from another source...

Shawn Kendall
Cosmic Interactive, LLC
http://www.facebook.com/BermudaDash
Offline DavidYazel

Junior Devvie




Java games rock!


« Reply #7 - Posted 2003-09-29 14:05:36 »

Using only floats is fine by me.

Some questions:


  • When you say no Tuple parent classes do you mean you  will not have a Tuple3f which is the parent class for vector3f and point3f?  Xith3d tries to use tuple wherever possible because in most cases points and vectors are treated the same, whereas in the places where it matters (like transform) we use the proper types.
  • epsilon equals is important for splitting bsp trees and t-juncture resolutions.
  • Hashing and equals is important for many algorithms, like building a list of unique coordinates.
  • We use quats all over the place for animation especially.
  • Just as a note we also use Vector2f quite a lot.


My recommendation would be to fully implement the entire package and do a parallel test to compare all functional outputs asa  regression test.  I know it is more work, but it would go a long way to getting it adopted.  Alternatively you could just open source it and people will help fill in the blanks.

David Yazel
Xith3D Project Founder
http://xith3d.dev.java.net

It may look complicated, but in the end it is just a bunch of triangles
Offline princec

« JGO Spiffy Duke »


Medals: 429
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #8 - Posted 2003-09-29 16:47:36 »

IMHO it was a disastrous error deriving Vector and Point from Tuple. It's just simply not how maths work.

It might be sensible to have only Tuple as an actual class, and then have two static classes, Vector and Point, which have static methods for manipulating Tuples as Vectors or Points - because as we all know in maths, things change their identity rather a lot.

Cas Smiley

Offline DavidYazel

Junior Devvie




Java games rock!


« Reply #9 - Posted 2003-09-29 17:34:29 »

Well I for one consider it really freaking annoying that I can't find the distance between two vectors, I don't care how mathematically wrong it is.  A lot of the times you use vector operations and the end result is a 3d coordinate in space... why do I have to convert it to a Point to do some simple operation on it?

Exactly what are the Vecmath operations that would be considered undetermined unless applied specifically to a point versus a vector?

THis is all ready annoying, but it would be 10 teims worse if Point and Vector were not even related classwise.


David Yazel
Xith3D Project Founder
http://xith3d.dev.java.net

It may look complicated, but in the end it is just a bunch of triangles
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline abies

Senior Devvie





« Reply #10 - Posted 2003-09-29 17:34:59 »

Quote
I
It might be sensible to have only Tuple as an actual class, and then have two static classes, Vector and Point, which have static methods for manipulating Tuples as Vectors or Points - because as we all know in maths, things change their identity rather a lot.


What with matrix transforms ? You need to differ between Vector (rotation/scale only) and Point transforms. Of course, it is possible to do it by two separate methods (transformPoint and transformVector), but if language supports method overloading, why not use it ?

IMHO, Tuple -> Point/Vector inheritance is quite reasonable - from both math and programming point of view.

Artur Biesiadowski
Offline shawnkendall

Senior Devvie





« Reply #11 - Posted 2003-09-29 18:43:05 »

Ok I'll try to address everything I missed so far.

1) As far as the vecor/point/tuple issues:
I made Vector have the Tuple methods, so it would still work as usual.  I also added the addition/different methods of Point class to the Vector class so all are there.  So yes you can get the distance between two vectors-computed as points.(my pet-peeve as well)
I have no plans to make a Point class, although it's not that bad, copy Vector cut out vector only methods, whamo Point classs.  But there is still no parent "Tuple" to use for type passing.  Not sure what to say about this.  My team never liked it, and aren't interested in Tuples.  This may be the biggest conflict for some original vecmath users, such as Xith.

2) Epsilon equals to me has always belonged a utils class call. Even the uses you site are typically offline uses, i.e. not in-game execution.  To me that is most certainly a utils class that does not end up in the final dist of a game.

3) Hashing and equals are intended to be overwritten, just  didn't in this first release.

4) The Quat class was implemented, just not complete yet.

5) Vector2f in there too. :-)

Quote
Alternatively you could just open source it and people will help fill in the blanks.

I released it under BSD as per your request.  I understood that to be open...?

On a different note, I just finished the fastSin\Cos intergration into vecMath.  So rotX() and similiar are ~5-10 times faster depending on the VM with user-definable error (the user can set the table size).  I will release this this week, and any new additions that come from this forum.
By intergrated I mean ADDed new methods.  The original methods use the standard Math.sin() stuff.

Shawn Kendall
Cosmic Interactive, LLC
http://www.facebook.com/BermudaDash
Offline William Denniss

JGO Coder


Projects: 2


Fire at will


« Reply #12 - Posted 2003-09-29 21:40:33 »

adressing the question are you "allowed" to call it javax.vecmath - there's no law against it is there?

My impression of the library was more that it "was the official javax.vecmath API but with less classes" hence if it looks like the official one, works like the official one, why not call it the same package name so that people can just use them interchangably.

This is what the people of the "official" unofficial vecmath implementation (http://objectclub.esm.co.jp/vecmath/?) have done:  

Tuple2f.java:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
/*
   Copyright (C) 1997,1998,1999
   Kenji Hiranabe, Eiwa System Management, Inc.

   This program is free software.
   Implemented by Kenji Hiranabe(hiranabe@esm.co.jp),
   conforming to the Java(TM) 3D API specification by Sun Microsystems.

   Permission to use, copy, modify, distribute and sell this software
   and its documentation for any purpose is hereby granted without fee,
   provided that the above copyright notice appear in all copies and
   that both that copyright notice and this permission notice appear
   in supporting documentation. Kenji Hiranabe and Eiwa System Management,Inc.
   makes no representations about the suitability of this software for any
   purpose.  It is provided "AS IS" with NO WARRANTY.
*/

package javax.vecmath;


But, it seems like you are using your poetic license with the API which is a good idea as you and some of the the previous posters have thought of some ways to expand and enhance the API.

please excuse my misunderstanding, carry on your good work Smiley

Cheers,

Will.

Offline shawnkendall

Senior Devvie





« Reply #13 - Posted 2003-09-30 22:45:57 »

I have a question for David and the rest of the Xith team. (suppose it should go in the Xith fourms then, but this thread is all over the place :-/ )
Are you using Kenji Hiranabe's vecmath implementations, and if not why?
It's totally complete, compliant, and the license seems opens source "enough".

Shawn Kendall
Cosmic Interactive, LLC
http://www.facebook.com/BermudaDash
Offline Yuri Vl. Gushchin

Senior Devvie




Speak Java!


« Reply #14 - Posted 2003-11-09 19:41:31 »

... Strange but I completely missed this thread...

Quote
Are you using Kenji Hiranabe's vecmath implementations, and if not why?


I tested Kenji's vecmath with Xith3D and it works just fine [with minor modifications, such as serialization, etc.].

I see no reason why not to use Kenji Hiranabe's vecmath implementation with Xith3D. But I still interested in performance comparison of different vecmath classes.

Yuri

Yuri Vl. Gushchin
JProof Group
Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #15 - Posted 2003-11-09 19:59:40 »

A random suggestion: how about getting it hosted as a middleware/library project on java.net? It could be a start towards more universal set of libraries (such as model loaders) which need some sort of shared core to avoid rewriting a bumpy wheel each time..

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline Yuri Vl. Gushchin

Senior Devvie




Speak Java!


« Reply #16 - Posted 2003-11-09 20:05:25 »

+1 for Orangy Tang suggestion.

Yuri

Yuri Vl. Gushchin
JProof Group
Offline Jens

Senior Devvie




Java for games!


« Reply #17 - Posted 2003-11-14 12:49:00 »

+1

Xith3D Getting Started Guide (PDF,HTML,Source)
Offline cfmdobbie

Senior Devvie


Medals: 1


Who, me?


« Reply #18 - Posted 2003-11-14 13:35:00 »

You know you've got my support on that!

+1

Hellomynameis Charlie Dobbie.
Offline kaffiene
« Reply #19 - Posted 2003-11-26 22:50:49 »

+1 - agree also that loaders should get the same treatment
Offline NexusOne

Junior Devvie




Java games rock!


« Reply #20 - Posted 2004-01-06 17:14:49 »

Would it be possible to include a separate class of useful functions involving matrices and vectors? The Vector, Point, and Matrix classes themselves have no need for complicated methods but many implementations do, I'm just hoping for methods such as (pardon the long names)
Matrix4f findRotationBetweenVectors(Vector original, Vector destination),

Vector3f findNormal(Polygon polygon... or maybe 3 points on it),

Point3f findPossibleIntersectionBetweenLineAndPolygonIn3DSpace(Point3f lineStartPoint, Vector3f lineDirection, Polygon polygon or possibly 3 points)....
these are just examples of what I think would be useful
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

rwatson462 (28 views)
2014-12-15 09:26:44

Mr.CodeIt (19 views)
2014-12-14 19:50:38

BurntPizza (37 views)
2014-12-09 22:41:13

BurntPizza (72 views)
2014-12-08 04:46:31

JscottyBieshaar (34 views)
2014-12-05 12:39:02

SHC (46 views)
2014-12-03 16:27:13

CopyableCougar4 (42 views)
2014-11-29 21:32:03

toopeicgaming1999 (110 views)
2014-11-26 15:22:04

toopeicgaming1999 (96 views)
2014-11-26 15:20:36

toopeicgaming1999 (29 views)
2014-11-26 15:20:08
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!