Check for NANs (when line is degenerate)
Some basic (& incorrect) code to guess reasonable tolerance.