Gamestudio Links
Zorro Links
Newest Posts
NOMAX undeclared identifier.
by Petra. 01/09/26 21:12
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 01/07/26 15:14
Zorro locks DLL
by jcl. 01/07/26 13:33
zorro with ccxt?
by qin. 01/07/26 07:50
The new evaluation system
by jcl. 01/05/26 08:50
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
5 registered members (Petra, TipmyPip, AndrewAMD, M_D, Quad), 3,193 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Namitha_NN, Syndrela, agasior, mosfet, MonsterX
19188 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
fatan does not behave as (I) expected #72240
04/25/06 20:07
04/25/06 20:07
Joined: Nov 2003
Posts: 299
P
profmakx Offline OP
Member
profmakx  Offline OP
Member
P

Joined: Nov 2003
Posts: 299
Yello!

While developing some functions to rotate entites around I encountered a Problem with the fatan function. I suspected this to be the atan2 function, which is an extended version of the tan function, however fatan does merely return values of atan(y/x) if x!= 0 and 0 otherwise.

for anyone who is interested there is a simple way to circumvnt this limitation:

Code:

function atan2(y, x)
{
if(x>0) {
return(fatan(y,x));
} else {
if(x<0) {
return(fatan(y,x)+180);
} else {
return(sign(y)*90);
}}}
}



I was just wondering if fatan“s behaviour is intended. Took me a few hours to catch that one...

profmakx / REVOgames

Re: fatan does not behave as (I) expected [Re: profmakx] #72241
04/25/06 20:34
04/25/06 20:34
Joined: Jul 2000
Posts: 28,050
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,050
Frankfurt
Yes, the behavior of functions is normally intended.

You can not emulate atan2 with fatan - you need indeed a function similar to what you've posted. There is no C-Script equivalent of atan2.


Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1