pub fn append_rect(rectangles: &mut Vec<TileRect>, new_rect: TileRect)Expand description
Appends a new rectangle to a list of rectangles, ensuring no overlaps exist.
If the new rectangle overlaps with any existing rectangle, it will be split into non-overlapping parts that extend beyond the existing rectangle. This process is recursive and ensures that the final list contains only non-overlapping rectangles.
ยงExamples
let mut rectangles = Vec::new();
append_rect(&mut rectangles, TileRect::new(0, 0, 0, 1, 1));
append_rect(&mut rectangles, TileRect::new(0, 1, 1, 2, 2));
// The second rectangle overlaps with the first, so it gets split
assert_eq!(rectangles.len(), 3);