I am trying to figure out how to calculate the midpoint of two points in a repeating one-dimensional space. The points being represented as numbers between 1 and 100.
While the midpoint of x1=45 and x2=55 can be represented as (x1 + x2) / 2 = 50, the formula fails when the space repeats itself: x1=99, x2=1 also results to 50 (which is a midpoint but I'm interested in the midpoint with the shortest distance, hence 1).
This is probably dead easy for most of you but I cannot get behind it. Help is greatly appreciated.