Minimum Area Rectangle II
From LeetCode. Min area from points (any orientation). Solve the geometry problem "Minimum Area Rectangle II".
Examples
Input: [1,2,3]
Output: 0
Input: [2,3,4]
Output: 0
Hints
In any rectangle, the diagonals bisect each other — they share the same midpoint and have equal length. Group pairs of points by their midpoint and squared diagonal length.
Within each group, every two pairs of points form a rectangle. The area of that rectangle is half the cross product magnitude of the two vectors: |v1.x * v2.y - v1.y * v2.x| / 2.
Midpoints may be half-integers. Store them as (x*2, y*2) integer pairs to avoid floating-point issues. There may be collinear pairs in a group — the cross product area formula handles those naturally (area = 0).
Minimum Area Rectangle II
**From LeetCode.** Min area from points (any orientation). Solve the geometry problem "Minimum Area Rectangle II".