Calculate Coordinates on a 2D Plane while Compensating for a Rotation
Working with HTML5 Canvas here.
The Canvas Plane is tilted; however, I still want to move along X and Y as if it were not tilted.
Here is an image describing the problem: http://i.imgur.com/2yyAQ.png
Posted Aug 30, 2012, 9:45 PM UTC
42
For anyone who is interested I think I have found the solution to this problem. The first thing one needs to do is to remember since we are working off a plane of rotation we can treat the two points as if they were two points about the circumference of a circle. So first we must calculate the radius of the circle (e.g. the length of the line).
We can get the length of the line by using the distance formula: SQRT((Delta X)^2+(Delta Y)^2)
Once we have the radius (length of line) and the angle of rotation in degrees we can use a trigonometric function that I don't know the name of to calculate the X and Y points on the now-rotated plane: X = originx + sin(angle) * radius, and Y = originy + sin(angle) * radius
I will report back with my findings to see if this actually works like it seems to on paper.