TICKIT_RECT_SUBTRACT(3)

πŸ’– TICKIT_RECT_SUBTRACT πŸ’–

okay bestie, this one is from the tickit library, and it's literally just ✨rectangle math✨ β€” specifically, how to cut a hole out of a rectangle. no cap.


✨ NAME ✨

tickit_rect_subtract β€” obtain the difference of two rectangles πŸ¦‹


✨ SYNOPSIS ✨

#include <tickit.h>

int tickit_rect_subtract(TickitRect dst[4],
    const TickitRect *orig, const TickitRect *hole);

Link with -ltickit. πŸ’…


✨ DESCRIPTION ✨

tickit_rect_subtract() initialises the rectangle structures given by dst β€” and bestie, listen, dst must be an array capable of containing at least four rectangle structures, like that is not optional, that is the vibe β€” with a set of non-overlapping rectangles covering the same area as the one given by orig without covering hole. πŸ’–

Depending on the geometry of the given rectangles it will create from zero to four resultant rectangles. she's flexible like that 🧚

It returns the number of rectangular regions initialised into the result array.

Now for the tea, the actual behaviour cases β˜•:

  • If hole completely covers orig then the result will contain no rectangles. rip orig, she's gone 😭
  • If they do not intersect then just orig will be returned. untouched, unbothered, main character energy πŸ‘‘
  • Otherwise, the result will contain non-overlapping horizontal stripes of orig without hole. yes queen, stripes ✨

✨ RETURN VALUE ✨

tickit_rect_subtract() returns the number of rectangles written to dst. that's it, that's the number, periodt πŸ’…


✨ SEE ALSO ✨


and that's the whole page, bestie!! 🫢 this was TICKIT_RECT_SUBTRACT(3), from the Library Functions Manual β€” go forth and subtract your rectangles, ily, bye πŸ’œπŸŽ€