SDL_atan2(3)
π SDL_atan2(3) π
okay bestie, welcome to the SDL3 FUNCTIONS corner of the group chat, where today's main character is SDL_atan2 π
β¨ NAME β¨
SDL_atan2 β compute the arc tangent of y / x, and the way it uses the signs of x and y to adjust the result's quadrant? it's giving precise. π
β¨ SYNOPSIS β¨
#include <SDL3/SDL_stdinc.h>
double SDL_atan2(double y, double x);
β¨ DESCRIPTION β¨
so the whole vibe here is: the definition of z = atan2(x, y) is y = x tan(z), where the quadrant of z is determined based on the signs of x and y. no cap, that's the entire personality. π¦
Domain: -INF <= x <= INF,
-INF <= y <= INF
Range: -Pi <= y <= Pi
this function operates on double-precision floating point values, so if you're out here needing single-precision floats, use SDL_atan2f instead. and if you just need the arc tangent of one single value, not a whole ratio situation, that's SDL_atan β different function, different vibe. πΈ
β οΈ real talk: this function may use a different approximation across different versions, platforms and configurations. i.e, it can return a different value given the same input on different machines or operating systems, or if SDL is updated. so don't be out here expecting bit-for-bit identical results across the whole friend group, okay? π
β¨ FUNCTION PARAMETERS β¨
yβ floating point value of the numerator (y coordinate). πxβ floating point value of the denominator (x coordinate). β
β¨ RETURN VALUE β¨
returns arc tangent of y / x in radians β OR, if x = 0, then it's either -Pi/2, 0, or Pi/2, depending on the value of y. three possibilities, one of them is yours, good luck bestie ππ
β¨ THREAD SAFETY β¨
it is safe to call this function from any thread. go off, multithreaded icon π
β¨ AVAILABILITY β¨
this function is available since SDL 3.2.0. she's been here a minute π
β¨ SEE ALSO β¨
and that's the whole page, periodt π this was brought to you by Simple Directmedia Layer, serving up SDL 3.4.18, and yeah the footer date lives right here in the sign-off so we're keeping it cute β¨ ily, go compute some quadrants π
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms