Algorithm Request: Comparison against a range that wraps


Author Message
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1181
Posted: 09:23pm 24 Jun 2021      

I only give time as an example. Compass direction in degrees is much the same. 359 degrees is very close to 1 degree. Or screen pixels, where the edges wrap to the other side.

I haven't come up with a simple criteria yet for when to 'unwrap' one of the limits. For example, with 359 degrees, you would subtract 360, giving -1, which _is_ close to 1.