I solved a very similar problem (in the context of a pathfinding and obstacle avoidance sim) 25 years ago, and I can probably describe the thought process and geometry in very digestible terms, but if I had to code it in a whiteboard I'd likely fail.