Gamestudio Links
Zorro Links
Newest Posts
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, bigsmack, monarch), 1,240 guests, and 9 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19058 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: 27,987
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,987
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 | chip programmers | 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