Gamestudio Links
Zorro Links
Newest Posts
What are you working on?
by rayp. 11/20/26 18:10
FXCM => AVA Trade Plugin???
by Martin_HH. 11/17/26 17:02
contractUpdate() is filtering if >2 rows
by mistery. 11/09/26 12:06
New Zorro version 3.15
by jcl. 11/09/26 09:24
Removing outliers from files
by jcl. 11/04/26 10:30
[MED] Import from FBX (2010) missing!!!
by rayp. 11/03/26 14:33
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
2 registered members (LucasJoshua, 1 invisible), 46,379 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rht, MaliceTheMaker, Haitao_Ren, JimSimons, julienp
19249 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,149
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

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