Linux Format forums Forum Index Linux Format forums
Help, discussion, magazine feedback and more
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Java - Maths Package

 
Post new topic   Reply to topic    Linux Format forums Forum Index -> Programming
View previous topic :: View next topic  
Author Message
GMorgan
LXF regular


Joined: Thu Jan 12, 2006 6:58 pm
Posts: 684
Location: South Wales, UK

PostPosted: Sat Dec 16, 2006 6:28 pm    Post subject: Java - Maths Package Reply with quote

Does anyone know if there are any existing maths packages for Java. There is a Vector class in 1.5 but it has nothing to do with vectors.

What I'm looking for is something along the line of a Scalar class with a ScalarMaths class. Then a Vector2D/Maths class etc.

I need it for a game I'm writing (finally getting around to that now my coursework is done for a few weeks). I'll quite happily implement it myself but wanted to check if anyone knows of an existing package. Google tends to leave me looking at mountains of hits for the aforementioned Vector class (which is just a collection).
Back to top
View user's profile Send private message
jjmac
LXF regular


Joined: Fri Apr 08, 2005 2:32 am
Posts: 1996
Location: Sydney, Australia

PostPosted: Mon Dec 18, 2006 10:35 pm    Post subject: RE: Java - Maths Package Reply with quote

A maths class !

Java has always had math classes ... Just looking at knoppix 5.0.1's bundled java,

/usr/lib/j2se1.4-sun/jre/lib/rt.jar

Which has numerous math related classes.

>>
There is a Vector class in 1.5 but it has nothing to do with vectors.
>>

Thats just a type of array that will allow hold different 'types'. Along with built in methods for access.

As i remember it, java has had built in math from the beginning, which, of course, has just been going through progressive development over time.

>>
Google tends to leave me looking at mountains of hits for the aforementioned Vector class (which is just a collection).
>>

Thats because, thats what they mean by a vector.

You probably need to get a hold of a graphical app along the lines of what you want to do. One with the souces available, and just use that as a kind of example, to see what classes their using for their math.


jm
_________________
http://counter.li.org
#313537

The FVWM wm -=- www.fvwm.org -=-

Somebody stole my air guitar, It happened just the other day,
But it's ok, 'cause i've got a spare ...
Back to top
View user's profile Send private message
GMorgan
LXF regular


Joined: Thu Jan 12, 2006 6:58 pm
Posts: 684
Location: South Wales, UK

PostPosted: Mon Dec 18, 2006 11:04 pm    Post subject: RE: Java - Maths Package Reply with quote

It has a Maths class but it doesn't do what I want. I should have been more specific in the title. At the moment it has good support for scalar mathematics but I've seen nothing that looks like i,j,k vector mathematics.

I'm hoping to simplify all the movement in a game by simply using vectors. So a displacement would just be done by adding 2 vectors together and such. Just takes all the work out of implementation for future by bundling the motion into one package that can then just be used repeatedly.

For what I'm working on it would probably be easier to just dump such considerations directly into the game but it would spoil my sense of aesthetics Wink.
Back to top
View user's profile Send private message
jjmac
LXF regular


Joined: Fri Apr 08, 2005 2:32 am
Posts: 1996
Location: Sydney, Australia

PostPosted: Tue Dec 19, 2006 9:30 am    Post subject: RE: Java - Maths Package Reply with quote

I used to have a java applet that did a 'asteroids' type of game. It was created around 1.0, but worked really well. And had another thing that just faded in with a banner that said water, with lapping water as a back drop. They were both good small programs and were in windows. I guess if you could find something that exists that is close to what you want to do, and the source is available ... it might contain some hints. Even to possibly extend an existing class ?

jm
_________________
http://counter.li.org
#313537

The FVWM wm -=- www.fvwm.org -=-

Somebody stole my air guitar, It happened just the other day,
But it's ok, 'cause i've got a spare ...
Back to top
View user's profile Send private message
TonyLB
LXF regular


Joined: Tue Apr 12, 2005 8:08 pm
Posts: 112
Location: Wirral, UK

PostPosted: Thu Dec 21, 2006 10:24 pm    Post subject: RE: Java - Maths Package Reply with quote

Have a look at the Java3D package. That's oriented towards 3D graphics and has (amongst other things) a javax.vecmath package which contains various point, vector2D and vector3D classes along with manipulation methods, invertions, quaternions and lots more. Just about everything you need for graphics manipulation.

Java3D has been OS for quite a while now after Sun let it go (they are focusing more on jogl), and we're up to version 1.5 beta

https://java3d.dev.java.net/ and http://www.java3d.org/

Tony
_________________
In the beginning was nothing, which exploded! (Lords and Ladies, Terry Pratchett)
Back to top
View user's profile Send private message
GMorgan
LXF regular


Joined: Thu Jan 12, 2006 6:58 pm
Posts: 684
Location: South Wales, UK

PostPosted: Sat Dec 23, 2006 12:43 am    Post subject: RE: Java - Maths Package Reply with quote

I'll have a look. According to that site the vecmath project is under the JRL. I'll have to have a read of it, I'd be hoping to strip it out and put it directly in a package if at all possible. I'd rather not have to force people to install all of Java3D.
Back to top
View user's profile Send private message
View previous topic :: View next topic  
Display posts from previous:   
Post new topic   Reply to topic    Linux Format forums Forum Index -> Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Linux Format forums topic RSS feed 


Powered by phpBB © 2001, 2005 phpBB Group


Copyright 2011 Future Publishing, all rights reserved.


Web hosting by UKFast