简体   繁体   English

如何计算旋转后矩形中心到凸包边的距离?

[英]How to calculate distance from center of a rectangle to sides of the convex hull after rotation?

Knowing the dimensions of the rectangle ABCD, how can we calculate the distances OE and OF after a rotation with an angle=α?已知矩形 ABCD 的尺寸,我们如何计算角度 = α 旋转后的距离 OE 和 OF? 在此处输入图像描述

I have fine the answer of my question in a response to this question: Find the Bounding Rectangle of Rotated Rectangle [duplicate]我在回答这个问题时很好地回答了我的问题: Find the Bounding Rectangle of Rotated Rectangle [重复]

It was written by @MBo like this:它是由@MBo 编写的,如下所示:

Old_Width = X2_Old - X1_Old, Old_Height = Y2_Old - Y1_Old
New_Height = Old_Width * Abs(Sin(Fi)) + Old_Height * Abs(Cos(Fi))
New_Width = Old_Width * Abs(Cos(Fi)) + Old_Height * Abs(Sin(Fi))
X1_New = X1_Old - (New_Width - OldWidth) / 2 = 
         (X1_Old + X2_Old - New_Width) / 2

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM