Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 08-07-2004, 06:09 AM
Arkan1k Arkan1k is offline
Delph
Join Date: Feb 2004
Location: Melbourne, Australia
Posts: 35
Arkan1k is on a distinguished road
Send a message via AIM to Arkan1k Send a message via MSN to Arkan1k
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?
__________________
[ Delph ]
Reply With Quote
  #2  
Old 08-07-2004, 06:59 AM
Dach Dach is offline
call me Chad, it's cooler
Dach's Avatar
Join Date: Aug 2002
Posts: 1,899
Dach is on a distinguished road
Would,
NPC Code:
tan = sin(30)/cos(30); // tan(a) = sin(a)/cos(a)
val = arctan(tan / (abs(1 - tan * tan))^.5);


work?
__________________
Scripting Documents:Old Script Documentation-Movement Tutorial
Reply With Quote
  #3  
Old 08-07-2004, 07:01 AM
Arkan1k Arkan1k is offline
Delph
Join Date: Feb 2004
Location: Melbourne, Australia
Posts: 35
Arkan1k is on a distinguished road
Send a message via AIM to Arkan1k Send a message via MSN to Arkan1k
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));

__________________
[ Delph ]
Reply With Quote
  #4  
Old 08-07-2004, 04:11 PM
R0bin R0bin is offline
Banned
R0bin's Avatar
Join Date: Oct 2002
Location: Wales, UK
Posts: 828
R0bin is on a distinguished road
Send a message via AIM to R0bin
/me knows what delph is doing (isnt it supposed to be 27.8 degrees or something?)
Reply With Quote
  #5  
Old 08-08-2004, 02:04 AM
Arkan1k Arkan1k is offline
Delph
Join Date: Feb 2004
Location: Melbourne, Australia
Posts: 35
Arkan1k is on a distinguished road
Send a message via AIM to Arkan1k Send a message via MSN to Arkan1k
I'm pretty sure it's not
Why, what do you think I'm doing?
__________________
[ Delph ]
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 09:42 PM.


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