Given the bounding box, relative rotation center, and rotation angle of a rectangle I need to find the absolute rotation center of the rectangle. Here is an image (I wouldn't mind if someone improved it): I hope that is clear enough. I need the x and y coordinates of the red dot. I've been working on this for some time now and I am lost with my trivial knowledge of trig. :/
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
If the angle of rotation is a
shown negative above, then the coordinates of the red dot are:
rx = x + rcx*COS(a) - rcy*SIN(a)
ry = y - (w-rcx)*SIN(a) + rcy*COS(a)
and remember to convert degrees to radians before taking SIN()
or COS()
.
Example: (x,y)=(80,60)
, (w,h)=(20,60)
and a=-15°
, with (rcx,rcy)=(15,30)
rx = 80 + 15*COS(-15°)-30*SIN(-15°) = 102.25
ry = 60 - (20-15)*SIN(-15°)+30*COS(-15°) = 90.27
Here is an output from GeoGebra of the calculation (with negative y
-axis)