compute_curves now aware of presorted vectors