mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-15 14:26:01 +00:00
Hook up SDL_acos and SDL_asin properly.
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
Reference in New Issue
Block a user