Archived

This topic is now archived and is closed to further replies.

angry

formula for inverse sine?

Recommended Posts

It happends to be that the language im writing my car game in doesn't have inverse sine and cos functions. It only has normal sin and cos. So how in the world am I supposed to calculate the inverse sin and cos? Anyone knows the formula for these two functions? [edit] though it has atan, could that be of any help? [edited by - angry on April 5, 2004 12:38:44 PM]

Share this post


Link to post
Share on other sites
You can do something similar with the inverse cosine, but only if -pi/2 < acos(x) < pi/2. Then acos(x) = atan(sqrt(1 - x^2) / x).

You could always do it the old-skool way and use a lookup table... Or switch to a language with a sensible set of standard functions. No inverse trig functions, sheesh! What is this, 1968?

[edited by - Muzzafarath on April 5, 2004 2:30:36 PM]

Share this post


Link to post
Share on other sites
quote:
Or switch to a language with a sensible set of standard functions. No inverse trig functions, sheesh! What is this, 1968?


LoL, well the language is called Lingo and is used for making "movies" in a program called Director. These "movies" can then be exported to shockwave movies, which then can be viewed on normal webpages...

Thanks for the replies!

Share this post


Link to post
Share on other sites
quote:
Original post by Muzzafarath
You can do something similar with the inverse cosine, but only if -pi/2 < acos(x) < pi/2. Then acos(x) = atan(sqrt(1 - x^2) / x).

You could always do it the old-skool way and use a lookup table... Or switch to a language with a sensible set of standard functions. No inverse trig functions, sheesh! What is this, 1968?

[edited by - Muzzafarath on April 5, 2004 2:30:36 PM]



Actually VB doesn''t either......

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:
Original post by Muzzafarath
Actually VB doesn''t either......


thought we were speaking about programming languages?

Share this post


Link to post
Share on other sites
Hmmm... This is not as accurate (since the series was not expanded far enough) as the method using atan but had there been no atan you could have done it so:

asin(n)
{
return n + power(n, 3)/ Factorial(3) + 9 *power(n, 5)/ Factorial(5) + 225 *power(n, 7)/ Factorial(7);
}

acos(n)
{
return PI/ 2 - asin(n);
}

Share this post


Link to post
Share on other sites
[insert rant about how people should be using java applets for games, instead of trying to shoehorn the game into shockwave/flash, here]

Share this post


Link to post
Share on other sites
quote:
[insert rant about how people should be using java applets for games, instead of trying to shoehorn the game into shockwave/flash, here]


I agree, however this certain game is for a competition and the only "language" allowed is shockwave

Share this post


Link to post
Share on other sites