kaplibs: Handle straight lines as special case in autogrid code