Probably not the right term, but whatever. I'm not the best with math.
So here's the deal. I've got a screen where the X and Y coordinates wrap at the edges, like the surface of a torus. On it are two points, one I want to move to the other's position taking the shortest path. If both points are close to the edge, one will wrap around, following something like the blue path in this example image. I've taken to the internet searching for existing functions to use, but all I've been able to find is one that finds the distance between the two points. Finding the angles is apparently either so obvious that nobody's asking or so horrible that nobody's answering. So I figured I'd put out a request if anyone more mathematically inclined wants to help out. Otherwise I'll probably just end up doing something hackish and inefficient.