Here's a problem that's been wrecking my brain for a while.
Given: I have two coordinate spaces: the global space G, and a local space A, and I know the position and rotation of A relative to G.
Question: How can I programmatically calculate the position and rotation of G relative to A?
On graph paper, I can calculate this by hand:
- if A relative to G is (4, 1) 90deg, then G relative to A is (-1, -4) -90deg
- if A relative to G is (5, 0) 0deg, then G relative to A is (-5, 0) 0deg
... but I'm having trouble transferring this calculation to software.