Posted 22 October 2012 - 02:02 PM
Just remember that in vector form, the x component equals "run" and the y component="rise".
That being said, the general form for 2D rotation about a point is:
x' = x*cos(A) - y*sin(A)
y' = y*cos(A) + x*sin(A)
Where A is the angle by which to rotate.
You really, really don't want to work directly with slope if you are allowing rotation. You want to work with vector form, because eventually your slope is likely to become undefined, if the "run" is ever equal to 0. Working in vector form essentially means that instead of keeping track of "slope", you keep track of "rise" and "run" instead. It's just that if object A is directly above the base object, if you are working with vector form then things won't crash and burn, but if you are working with slope you will suddenly end up with a divide-by-zero exception.