给定起点,每个旋转轴的角度和方向,计算终点 [英] Given start point, angles in each rotational axis and a direction, calculate end point

查看:46
本文介绍了给定起点,每个旋转轴的角度和方向,计算终点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 3D 坐标中有一个起点,例如(0,0,0).

I have a start point in 3D coordinates, e.g. (0,0,0).

我有我指向的方向,由三个角度表示 - 每个旋转角度一个(X 方向旋转,Y 方向旋转,Z 方向旋转)(为了示例,假设我是其中之一用笔的旧标志海龟)以及我将在我指向的方向上行驶的距离.

I have the direction I am pointing, represented by three angles - one for each angle of rotation (rotation in X, rotation in Y, rotation in Z) (for the sake of the example let's assume I'm one of those old logo turtles with a pen) and the distance I will travel in the direction I am pointing.

我将如何计算终点坐标?

How would I go about calculating the end point coordinates?

我知道对于 2D 系统来说这很简单:

I know for a 2D system it would be simple:

new_x = old_x + cos(angle) * distance
new_y = old_y + sin(angle) * distance

但我不知道如何将其应用于 3 个维度

but I can't work out how to apply this to 3 dimensions

我想另一种思考方式是在知道您指向的方向和球体的半径的情况下尝试在球体表面找到一个点.

I suppose another way of thinking about this would be trying to find a point on the surface of a sphere, knowing the direction you're pointing and the sphere's radius.

推荐答案

基于三个角度,您必须构建 3x3 旋转矩阵.那么矩阵的每一列代表局部的 x、y 和 z 方向.如果您有想要移动的局部方向,则将 3x3 旋转乘以方向向量以获得全局坐标中的结果.

Based in the three angles you have to construct the 3x3 rotation matrix. Then each column of the matrix represents the local x, y and z directions. If you have a local direction you want to move by, then multiply the 3x3 rotation with the direction vector to get the result in global coordinates.

我对 3D 坐标变换做了一些介绍,我认为可以回答您的问题.

I made a little intro to 3D coordinate transformations that I think will answer your question.

这篇关于给定起点,每个旋转轴的角度和方向,计算终点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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