The overlap of two rectangles (zero-sized when they do not touch).
- a: the first rectangle.
- b: the second rectangle.
overlap := intersect(.{ 0, 0, 10, 10 }, .{ 5, 5, 10, 10 });
assert(overlap.x == 5 && overlap.w == 5 && overlap.h == 5);
assert(intersect(.{ 0, 0, 1, 1 }, .{ 5, 5, 1, 1 }).w == 0);intersect :: (a: Rect, b: Rect) -> Rect
The overlap of two rectangles (zero-sized when they do not touch).
Parameters
Returns
overlap := intersect(.{ 0, 0, 10, 10 }, .{ 5, 5, 10, 10 });
assert(overlap.x == 5 && overlap.w == 5 && overlap.h == 5);
assert(intersect(.{ 0, 0, 1, 1 }, .{ 5, 5, 1, 1 }).w == 0);