Hi !
Featured games (87)
games approved by the League of Dukes
Games in Showcase (670)
Games in Android Showcase (194)
games submitted by our members
Games in WIP (727)
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  
  how can we abtain sin and cos methods ?  (Read 2220 times)
0 Members and 1 Guest are viewing this topic.
Offline blackjava

Senior Newbie

flashing vampire

« Posted 2005-01-25 23:24:27 »


i'm developing a game based on J2ME which needs sin, cos and tag values but i found no such methods in J2ME, is there any way to do that then ?

Never end on learning~
Offline Serethos

Junior Devvie

Java games rock!

« Reply #1 - Posted 2005-01-26 05:43:15 »

if you are programming with cldc1.0 you're lost. the only workaround is to use hard coded constants like in good ole'
days. i know thats not a big deal but for my experience you need real sin/cos methods in j2me very(!) rarely if you are not programming 3D games.
Offline mhale

Senior Newbie

Take pity, I'm just a poor blob!

« Reply #2 - Posted 2005-01-27 00:45:35 »

You can also use sin/cos routines for fixed-point numbers. If you google you will probably find some open source J2ME class with them in.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline wooD

Senior Newbie

J2ME Developer

« Reply #3 - Posted 2005-01-27 14:39:10 »

I looked into this when I started my last game. It was a 2d, so I'm not sure what your requirements are?  I ended up doing some odd contortions to make my collision detection logic happen. ShiftFP2D was very handy to do what I needed, but no sign/cos or sqrt.

For distances I ended up keeping all my measurements squared and measuring against values that were also squared. It worked for me.

For cases where I needed to know direction, I ended up using unit vectors and in some cases dot products to calculate facing values. Like I said, not pretty, but it did work.

If you can use cldc 2.0, that would also solve the problems.


Offline Abuse

JGO Ninja

Medals: 48

falling into the abyss of reality

« Reply #4 - Posted 2005-01-27 15:14:39 »


If you can use cldc 1.1, that would also solve the problems.

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here!
Offline blackjava

Senior Newbie

flashing vampire

« Reply #5 - Posted 2005-02-01 23:32:39 »

if im with cldc1.1 then how could i achieve exactly sin, cos and tag values ?


Never end on learning~
Offline calzada

Junior Devvie

m3g is the truth

« Reply #6 - Posted 2005-02-02 08:21:53 »

you'r enot lost, you can use:
Float midp Point

double asin(double x)
double acos(double x)
double atan(double x)
double atan2(double y, double x)
double exp(double x)
double log(double x)
double log10(double x)
double pow(double x, double y)
go to:


Mobile Entertainment Studio: M-E-S
Pages: [1]
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.

IanParcs (35 views)
2016-04-18 14:18:53

KaiHH (34 views)
2016-04-18 08:35:41

KaiHH (66 views)
2016-04-15 12:43:58

theagentd (64 views)
2016-04-14 02:16:17

theagentd (72 views)
2016-04-14 02:15:43

IanParcs (66 views)
2016-04-12 03:51:16

IanParcs (36 views)
2016-04-12 03:50:03

IanParcs (32 views)
2016-04-12 03:49:54

IanParcs (28 views)
2016-04-12 03:49:52

IanParcs (36 views)
2016-04-12 03:49:52
Website offering 3D Models specifically for games for free
by vusman
2016-04-29 12:56:17

List of Learning Resources
by SilverTiger
2016-02-05 09:39:47

List of Learning Resources
by SilverTiger
2016-02-05 09:38:38

List of Learning Resources
by SilverTiger
2016-02-05 09:35:50

Rendering resources
by Roquen
2015-11-13 14:37:59

Rendering resources
by Roquen
2015-11-13 14:36:58

Math: Resources
by Roquen
2015-10-22 07:46:10

Networking Resources
by Roquen
2015-10-16 07:12:30 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‑
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!