The function half mean returns the distance between left and lefts[-1]. Since the rows are not sorted, lefts[-1] does not correspond to the point closest to C/2.
The projections should be done for row in sorted(rows) instead of for row in rows.
(Issue raised as requested by Professor Menzies)
