Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (TipmyPip), 18,466 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 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,024
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,024
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