是关于这点怎么转做? [英] Is this how rotation about a point is done?

查看:128
本文介绍了是关于这点怎么转做?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

比方说,我有个多边形:

Let's say I have a polygon with points:

(0,0)
(100,0)
(100,100)
(0,100)

让我们也让它的中心是(50,50)。

Lets also let it's center be (50,50).

要旋转它,我会增加50到每个点的每一个组件,然后执行

To rotate it would I add 50 to each component of each point, then do

x' = cos(theta)*x - sin(theta)*y
y' = sin(theta)*x + cos(theta)*y

然后,从各点的各成分减去50?

Then subtract 50 from each component of each point?

感谢

推荐答案

这就是正确的,但在一开始,你需要减去50带来的多边形中心回0,然后在结尾加50带来的多边形回它的一部开拓创新的地位。

Thats right, except at the start you need to subtract 50 to bring the polygon center back to 0, then at the end add 50 to bring the polygon back to its orignal position.

其实使用的是这里什么是二维旋转矩阵:

Actually what you are using here is the rotation matrix in 2D:

这篇关于是关于这点怎么转做?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆