This question evaluates computational geometry skills, numerical robustness, and algorithmic implementation for merging collinear, overlapping 2D segments in the Coding & Algorithms domain.
You are given a collection of 2D line segments. Each segment may be represented either as:
(x1, y1)
and
(x2, y2)
, or
Two segments are mergeable if:
Merge all mergeable segments and output the resulting set of maximal segments (no two output segments should be further mergeable).
(xa, ya)
and
(xb, yb)
.