Curious. When and why do you need to do this?
I just made that example up as an easy to understand instance of the type of problem. I'll give you some comparable examples from actual projects.
- A simulation of an old-style analog multimeter. For various reasons the routine updating the position of the needle (drawn as a black line) needed to redraw as a line from point to point, rather than rotating a line-shaped sprite. Calculating the needle's end point from the current angle required very basic trig functions (about as basic as you can get) -- x2 = x1 + length * cos (theta0 - theta), y2 = y1 + length * sin (theta0 - theta), where (x1, y1) is the pivot point (x2, y2) is the location of the tip of the needle, length is the length of the needle, theta0 is the needle's zero position, and theta is the angle of deflection. This simulation also required an exponential decay function to make the slew of the needle in realtime look realistic.
- In a kid's game, in a top-down view, a character continuously rotates to face the mouse pointer, as the mouse and character both move around. This is almost exactly equivalent to the "arrow" problem I referred to.
- In user interface for a graphics program for rendering molecules in 3-D, years ago when processors were too slow to update a 3-D rendered graphic in real time, I included various ways for the user to select an arbitrary rotation in 3-D. Combination of rotations around different fixed axes (e.g. yaw, roll, pitch) were often hard to visualize, and trial and error was a slow process given the several-minute redraw time, so I devised some other options.
One of them was that the program would draw a circle around the molecule, which the user would imagine as the edge of a transparent sphere. The user could then click any point inside the circle or on its edge, which the program would interpret as the selection of a point on the surface of the sphere, and then rotate the molecule so that the view direction was from that point. Clicks outside the circle were interpreted as clicks on the nearest point of the edge of the circle.
So, for example, if the image were an earth globe currently viewed from the side (that is, from a point directly above the equator), and you clicked on the very top edge of the circle, or directly above it, it would rotate the globe so that you were looking directly south from above the north pole. But you could also click on, say, London, and the globe would rotate so you were looking directly down on London. (Except the image was a molecule instead of a globe.)
It takes some trig and some linear algebra to make that work.
Respectfully,
Myriad