I am not sure why I am stuck on this for so long. I basically have this setup. An range of possible values from -180 to 180. And a list of intervals in that range. I am looking for a number closest to 0 that isn't taken by any of the intervals. (If there is just one interval of [-13,22], I'd like to return -13, no need to return closest number that isn't -13. So the actual interval numbers are excluded, but everything between them is a no go.)
I am actually projecting circles (obstacles) onto navigation of my unit, and now I need to find the closest point to go towards.
The intervals would look something like [-40, -23], [-3, 16], [70, 93]...
Thank you! I hopefully explained my problem properly, it seems rather trivial but my brain just doesn't let me solve it.
