I have a loop that generates pairs of coordinates (X, Z) that are waypoints.
Eventually, a path is linearly interpolated between the waypoints.
Because of the nature of the data, there will be long sequences where Z doesn't change. Within those sequences, I want to keep only the endpoints, deleting the superfluous waypoints in between.
Any suggestions on how to approach this would be appreciated (so far, my attempts are ugly).