Hook up SDL_acos and SDL_asin properly.
This commit is contained in:
parent
1509359de3
commit
924207a299
12 changed files with 54 additions and 29 deletions
|
@ -46,6 +46,42 @@ SDL_atan2(double x, double y)
|
|||
#endif /* HAVE_ATAN2 */
|
||||
}
|
||||
|
||||
double
|
||||
SDL_acos(double val)
|
||||
{
|
||||
#if defined(HAVE_ACOS)
|
||||
return acos(val);
|
||||
#else
|
||||
double result;
|
||||
if (val == -1.0) {
|
||||
result = M_PI;
|
||||
} else {
|
||||
result = SDL_atan(SDL_sqrt(1.0 - val * val) / val);
|
||||
if (result < 0.0)
|
||||
{
|
||||
result += M_PI;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
#endif
|
||||
}
|
||||
|
||||
double
|
||||
SDL_asin(double val)
|
||||
{
|
||||
#if defined(HAVE_ASIN)
|
||||
return asin(val);
|
||||
#else
|
||||
double result;
|
||||
if (val == -1.0) {
|
||||
result = -(M_PI / 2.0);
|
||||
} else {
|
||||
result = (M_PI / 2.0) - SDL_acos(val);
|
||||
}
|
||||
return result;
|
||||
#endif
|
||||
}
|
||||
|
||||
double
|
||||
SDL_ceil(double x)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue