SDL_RectsEqualFloat(3)
π SDL_RectsEqualFloat(3) π
okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, where we're talking about SDL_RectsEqualFloat β yes she's a whole function and yes she's here to settle the "are these two rectangles literally the same" debate π
β¨ NAME β¨
SDL_RectsEqualFloat β figure out whether two floating point rectangles are equal, within a default epsilon πΈ
π¦ SYNOPSIS π¦
#include <SDL3/SDL_rect.h>
SDL_FORCE_INLINE bool SDL_RectsEqualFloat(const SDL_FRect *a, const SDL_FRect *b);
π DESCRIPTION π
So here's the vibe: rectangles count as equal if both of them are not NULL and each of their x, y, width and height are within SDL_FLT_EPSILON of each other. That's the whole check, no cap. π«Ά
And honestly? This is often a totally reasonable way to compare two floating point rectangles, because it deals with the slight precision variations in floating point calculations that tend to pop up. (Floating point math is a menace, bestie, she does NOT do exact. π)
heads up: this is a forced-inline function in a header, not a public API function available in the SDL library. Which is to say, the code is embedded in the calling program, and the linker and dynamic loader will not be able to find this function inside SDL itself. it's giving "she lives in your header, not in the library" β¨
π FUNCTION PARAMETERS π
aβ the first rectangle to test. πbβ the second rectangle to test. π
β RETURN VALUE β
Returns true if the rectangles are equal, false otherwise. simple as that, periodt π
π THREAD SAFETY π
It is safe to call this function from any thread. go off, multithreaded queen π
π§ AVAILABILITY π§
This function is available since SDL 3.2.0. she's not new-new but she's still iconic β¨
π₯ SEE ALSO π₯
SDL_RectsEqualEpsilon(3)β the cousin, the sibling, the other flavor of rectangle equality π
and that's the whole page, bestie!! this lil slice of the manual came to you from Simple Directmedia Layer, running SDL 3.4.18, dated SDL_RectsEqualFloat(3) β mwah, go compare some rectangles responsibly πβ¨π
π¦ 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