如何有效地旋转和平移的平面在三维 [英] How to efficiently rotate and translate a plane in 3D

查看:267
本文介绍了如何有效地旋转和平移的平面在三维的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我具有由正(n)限定的平面和一距离(d)(从原点)。我想将它转变成一个新的系统。 在很长的路是这样的: 1)乘法距离(d)与正(n),导致氨基酸向量(p)的 2)旋转(R)和翻译(v)的所述向量(p)的获得(对') 3)正常化(P'),以获得正常的 4)使用另一个算法来寻找新的和平面的原点

I have a plane defined by a normal (n) and a distance (d) (from the origin). I would like to transform it into a new system. The long way is like this: 1) multiply distance (d) with normal (n) resulting in a a vector (p) 2) rotate (R) and translate (v) the vector (p) to get (p') 3) normalize (p') to get the normal 4) use another algorithm to find the smallest distance (d') between the new plane and the origin

我还没有试过,但我想它应该工作。 题: 是不是有一个更快的方法来获得N'和d'? 如果翻译(v)为0比我可以跳过4)。但是,如果它不是0?是否有更简单的方式来获得新的D'?

I haven't tried this but I guess it should work. QUestion: Isn't there a faster way to get n' and d'? If the translation (v) is 0 than I can skip 4). But if it is not 0? Is there an easier way to get the new d'?

推荐答案

您必须要小心,因为法线不一定变换像点做的,远处是的垂直的距离原点,所以你必须计算 D'= D + NV 。如果你正在做的是平移和旋转,然后就可以转动正常,并计算出一个新的垂直距离。但是,如果你扩展你的轴不同,或者做一般的射影变换,那么就需要区别对待的事情。

You need to be careful because normals don't necessarily transform like points do, and the distance is the perpendicular distance to the origin, so you have to compute d'= d + n.v. If all you're doing is translation and rotation, then you can rotate the normal and compute a new perpendicular distance. But, if you're scaling your axes differently, or doing a general projective transformation, then you need to treat things differently.

这适用于一切的方法是使用齐次坐标,让你所有的变换是4X4矩阵,双方你的观点,你的飞机是4向量:

The way that works for everything is to use homogeneous coordinates, so all your transforms are 4x4 matrices, and both your points and your planes are 4-vectors:

point p=(x,y,z)        -> homogeneous (x,y,z,1), equiv. to (x*W, y*W, z*W, W)
plane q=[n=(a,b,c), d] -> homogeneous [a,b,c,d], equiv. to [a*K, b*K, c*K, d*K)

  -> point p is on plane q iff:  p.q=0   (using homogeneous coords, as above) 

通常情况下,你要加倍所有的变换矩阵为一个4x4矩阵T,并使用该矩阵上的每一个点,以确定其最终转变立场。诀窍是,你需要使用T的的反置的改变你的平面坐标。从下面,你可以看到这个preserves点和平面之间的发病率:

Generally, you will multiply all your transformation matrices into one 4x4 matrix T, and use that matrix on every point, to determine its final transformed position. The trick is, you need to use the inverse transpose of T to transform your plane coordinates. From the following, you can see that this preserves incidence between points and planes:

point p' = T p
plane q' = (T^-1)^t q

  -> point p' is on plane q' when:  p'.q'=0

  then, note:  p'.q' = p^t T^t (T^-1)^t q = p^t q = p.q
  so:  p'.q'=0  whenever p.q=0

这篇关于如何有效地旋转和平移的平面在三维的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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