简体   繁体   English

在3D空间中移动点

[英]moving a point in 3d space

I have a point at 0,0,0 I rotate the point 30 deg around the Y axis, then 30 deg around the X axis. 我有一个0,0,0的点,我围绕Y轴旋转了30度,然后围绕X轴旋转了30度。 I then want to move the point 10 units forward. 然后,我想将点向前移动10个单位。

I know how to work out the new X and Y position 我知道如何计算新的X和Y位置

MovementX = cos(angle) * MoveDistance;
MovementY = sin(angle) * MoveDistance;

But then I realised that these values will change because of Z, won't they? 但是后来我意识到这些值会因为Z而改变,不是吗?

How do I work out Z and have I worked out X and Y correctly? 如何计算Z并正确计算X和Y?

Thanks! 谢谢!

You should multiply point coordinates to full rotation matrix, which is matRotationTotal = matRotationX * matRotationY * matRotationZ . 您应该将点坐标乘以完整的旋转矩阵,即matRotationTotal = matRotationX * matRotationY * matRotationZ Check this article for details. 检查文章的详细信息。

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

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