View Source AoC.Rect (aoc v0.11.4)
Summary
Functions
Sort rectangles by reading order:
- First, the topmost rectangle.
- Then, the leftmost rectangle.
Returns a tuple {covered, remains}
where
covered
is a list with zero or one item, the parts of the rectangle that are covered by thesplitter
.remains
is a list of the parts of the rectangle that are not covered. It can be an empty list if the original rectangle is fully covered by the splitter.
The algorithm follow the reading directions, meaning that it will first cut the uncovered part above the splitter, then the uncovered part left to the splitter, then right, then below.
As we use the standard Erlang list building mechanism, those parts will be in
reverse order in the remains
list. This is an implementation detail and the
order of this list should not be relied upon.