Hi !
Featured games (85)
games approved by the League of Dukes
Games in Showcase (636)
Games in Android Showcase (178)
games submitted by our members
Games in WIP (687)
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 2114 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: 42

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.

Dwinin (71 views)
2015-11-07 13:29:08

Rems19 (80 views)
2015-10-31 01:36:56

Rems19 (73 views)
2015-10-31 01:32:37

williamwoles (106 views)
2015-10-23 10:42:59

williamwoles (92 views)
2015-10-23 10:42:45

Jervac_ (106 views)
2015-10-18 23:29:12

DarkCart (134 views)
2015-10-16 00:58:11

KaiHH (116 views)
2015-10-11 14:10:14

KaiHH (155 views)
2015-10-11 13:26:18

BurntPizza (171 views)
2015-10-08 03:11:46
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

Rendering resources
by Roquen
2015-10-15 07:40:48

Math: Inequality properties
by Roquen
2015-10-01 13:30:46

Math: Inequality properties
by Roquen
2015-09-30 16:06:05

HotSpot Options
by Roquen
2015-08-29 11:33:11 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!