Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   arcsin (https://forums.graalonline.com/forums/showthread.php?t=54492)

Arkan1k 08-07-2004 06:09 AM

arcsin
 
The function I need to perform is:
NPC Code:
arcsin(tan(30°))


But of course the graal engine doesn't supply both the arcsin and tan functions.
I found that:
NPC Code:
arcsin = arctan(x / (1 - x * x)^.5);



So what I have ended up with is:
NPC Code:
tan = sin(30)/cos(30); // tan(a) = sin(a)/cos(a)
val = arctan(tan / (1 - tan * tan)^.5);



But in (1 - tan * tan)^.5 I keep getting a negative value and because it's in a square root it's undefined.
The value I'm looking for is +/- 35.264° and I'm at a point where I am quite stuck at the moment.
Would anyone be able to help with this?

Dach 08-07-2004 06:59 AM

Would,
NPC Code:
tan = sin(30)/cos(30); // tan(a) = sin(a)/cos(a)
val = arctan(tan / (abs(1 - tan * tan))^.5);


work?

Arkan1k 08-07-2004 07:01 AM

No matter I worked it out. Was just a matter of converting radians to degrees as Graal does things in radians.
NPC Code:
tan = sin(30*(pi/180))/cos(30*(pi/180));
val = arctan(tan / (1 - tan * tan)^.5)*(180/pi));


R0bin 08-07-2004 04:11 PM

/me knows what delph is doing :) (isnt it supposed to be 27.8 degrees or something?)

Arkan1k 08-08-2004 02:04 AM

I'm pretty sure it's not :\
Why, what do you think I'm doing?


All times are GMT +2. The time now is 05:03 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.