SDL_atan2f(3)
π SDL_atan2f(3) π
okay bestie, welcome to the SDL3 FUNCTIONS corner of the man pages, where we make triangles make sense β¨
πΈ NAME πΈ
SDL_atan2f β compute the arc tangent of y / x, using the signs of x and y to adjust the result's quadrant. yes babe, it's giving full directional awareness π
π SYNOPSIS π
#include <SDL3/SDL_stdinc.h>
float SDL_atan2f(float y, float x);
β¨ DESCRIPTION β¨
so here's the vibe. 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. quadrant awareness, we love to see it π¦
Domain: -INF <= x <= INF,
-INF <= y <= INF
Range: -Pi <= y <= Pi
this function operates on single-precision floating point values. if you need double-precision floats, use SDL_atan2 instead β she's the big sister fr fr π
and if you just wanna calculate the arc tangent of a single value (no division drama, no quadrants), use SDL_atanf. different tool, different slay π§
β οΈ heads up bestie: 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 like... don't expect bit-identical results everywhere, okay? no cap. π
π«Ά FUNCTION PARAMETERS π«Ά
yβ floating point value of the numerator (y coordinate).xβ floating point value of the denominator (x coordinate).
π₯ RETURN VALUE π₯
returns the arc tangent of of y / x in radians, or, if x = 0, either -Pi/2, 0, or Pi/2, depending on the value of y. she always knows which way to point π
π THREAD SAFETY π
it is safe to call this function from any thread. go off, concurrent queen β
π AVAILABILITY π
this function is available since SDL 3.2.0. new-ish but iconic already π
π SEE ALSO π
and that's the whole page, bestie!! this came to you from Simple Directmedia Layer, rocking version SDL 3.4.18 β mwah, go forth and compute your angles πβ¨ππ¦
π¦ 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