【发布时间】:2026-01-24 18:35:01
【问题描述】:
在此示例或任何示例中如何计算中心向量。 WolframAlpha:http://www.wolframalpha.com/input/?i=rotate+90+degrees+center+%283%2C0%29
【问题讨论】:
-
我没睡好。添加到旋转矩阵的向量是 (3, -3) 我如何得到这个值,我没有通过它。
在此示例或任何示例中如何计算中心向量。 WolframAlpha:http://www.wolframalpha.com/input/?i=rotate+90+degrees+center+%283%2C0%29
【问题讨论】:
齐次坐标:
[ cos(theta) -sin(theta) 0 ]
Rotate = [ sin(theta) cos(theta) 0 ]
[ 0 0 1 ]
[ 1 0 x ]
Translate = [ 0 1 y ]
[ 0 0 1 ]
所以要执行你的转换,你乘以Translate(x, y) * Rotate(theta) * Translate(-x, -y) 并得到一个转换矩阵。
【讨论】:
或者在一个函数语句中
Vector RotateAbout(Vector node, Vector center, double angle)
{
return new Vector(
center.X + (node.X-center.X)*COS(angle) - (node.Y-center.Y)*SIN(angle),
center.Y + (node.X-center.X)*SIN(angle) + (node.Y-center.Y)*COS(angle)
};
}
【讨论】: