Find corners of a rotated rectangle

混江龙づ霸主 提交于 2019-12-08 21:44:41

In pseudocode:

r = (x2 - x1)*sin(a) - (y2 - y1)*cos(a)
x3 = x1 + r*sin(a)
y3 = y1 - r*cos(a)
x4 = x2 - r*sin(a)
y4 = y2 + r*cos(a)

What this is doing is recovering the length r of the side of the rotated rectangle, then using that length to calculate where the two other points should be, relative to the two points that you have already.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!