VTK Python,围绕点旋转矢量

时间:2019-03-14 04:36:46

标签: python rotation vtk

我正在将VTK和Python用于与我的学习相关的项目。

为我提供了以下点centerOfRotation和方向度,以及矢量[1、0、0]。现在,我想旋转向量,使其沿“斜度”指定的方向“指向”,然后将其平移到点p。

centerOfRotation = [314.848717879, 283.085686693, 423.900139245]
degrees = [-7.93947167694, -0, 171.098864823]
vector = [1, 0, 0]

transform = vtk.vtkTransform()
transform.Identity()

transform.PreMultiply()
transform.Translate(centerOfRotation)
transform.RotateZ(degrees[2])
transform.RotateX(degrees[0])
transform.RotateY(degrees[1])
transform.Translate(-centerOfRotation[0], -centerOfRotation[1], -centerOfRotation[2])

newPos = [0]*3
transform.TransformPoint(vector, newPos)

centerOfRotation和度数是从另一个程序中提取的,在另一个程序中,第二点(newPos)应该位于第一个点(centerOfRotation)之下。但是使用上面给出的代码,第二点位于旋转中心上方。 我希望有人能指出我正确的方向。非常感谢!

顺便说一句:另一个程序为我提供了另一个信息:YSymmetry = 1。我不太确定那是什么意思。

注意:我既不是数学专业也不是计算机专业的学生,​​我的数学技能有些生锈。现在,我没有时间学习数学,因此,如果您能指出正确的“编码”方向,我将不胜感激:D

0 个答案:

没有答案
相关问题