Fix 1672033: when deciding which curve we are closest to, ignore the very ends of...