formula for inverse sine?
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]
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]
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]
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!
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......
quote:Original post by Muzzafarath
Actually VB doesn''t either......
thought we were speaking about programming languages?
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);
}
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);
}
[insert rant about how people should be using java applets for games, instead of trying to shoehorn the game into shockwave/flash, here]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement