在给定三角形顶点的坐标的情况下,找到其在3D中的旋转角度 [英] Find the rotation angles of a triangle in 3D, given the coordinates of its vertices

查看:78
本文介绍了在给定三角形顶点的坐标的情况下,找到其在3D中的旋转角度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试以3D旋转和平移等边三角形,直到其顶点达到某些坐标为止.

I try to rotate and translate an equilateral triangle in 3D until his vertices reach some coordinates.

已知顶点坐标 F,G,H F',G',H':

我能够找到新的质心c'坐标,如下所示:

I was able to find the new centroid c' coordinates like this :

c'.x = ( F'.x + G'.x + H'.x ) / 3
c'.y = ( F'.y + G'.y + H'.y ) / 3
c'.z = ( F'.z + G'.z + H'.z ) / 3

因此平移三角形没有问题.但是我找不到一种方法来计算将F'G'H'三角形放置在正确位置所需的旋转度...

So no problem to translate the triangle. But I can't find a way to calculate the rotations needed to put F'G'H' triangle in the right position...

我必须知道三角形F'G'H'必须绕每个轴(x,y,z)以度为单位旋转多少度,知道初始三角形的旋转为0°

通过旋转每个轴,我正在谈论这个:

By rotation for each axis, I'm talking about this:

有什么想法吗?

推荐答案

技巧是使用叉积b4和旋转后找到三角形的法线向量

trick is to find the normal vectors of the triangles using cross product b4 and after rotations

v1 = (F.x - G.x, F.y - G.y, F.z - G.z)
v2 = (F.x - H.x, F.y - H.y, F.z - H.z)
n  = cross_prod(v1, v2) # see http://en.wikipedia.org/wiki/Cross_product
n  = n / norm(n) # normalize to unit vector

v'1 = (F'.x - G'.x, F'.y - G'.y, F'.z - G'.z)
v'2 = (F'.x - H'.x, F'.y - H'.y, F'.z - H'.z)
n'  = cross_prod(v'1, v'2)
n'  = n' / norm(n')

rot = arc_cos(n.x * n'.x + n.y * n'.y + n.z * n'.z)

这篇关于在给定三角形顶点的坐标的情况下,找到其在3D中的旋转角度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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