[英]How to find co-ordinates of a point from four points that can translate or rotate? All these points form a rigid body
I have a rigid body that translates and/or rotates about an axis perpendicular to the screen. 我有一个刚体,可以绕垂直于屏幕的轴平移和/或旋转。 I have co-ordinates of four points on the rigid body. 我在刚体上有四个点的坐标。 How can I get the co-ordinates of a unknown point on the rigid body? 如何才能获得刚体上未知点的坐标?
Can I form a linear equation with four known points to get the fifth unknown point? 我可以用四个已知点形成一个线性方程来得到第五个未知点吗? How to accommodate translation and rotation in the equation? 如何在等式中适应平移和旋转?
Any combination of rotation by θ about a point p and translation t' can be represented as a rotation by θ about the origin followed by a suitable translation t . 关于点p和平移t'的θ的旋转的任何组合可以表示为关于原点的θ的旋转,随后是合适的平移t 。 So the problem becomes working out the value of θ and t from the known points. 所以问题就是从已知点计算出θ和t的值。 Then the transformation can be applied to the unknown point. 然后转换可以应用于未知点。
The easiest way to work, I think, is in homogeneous coordinates. 我认为,最简单的工作方式是齐次坐标。 With column vectors, rotation about the origin by θ is represented by the matrix M( θ ): 对于列向量,通过θ围绕原点的旋转由矩阵M( θ )表示:
cos(θ) sin(θ) 0
-sin(θ) cos(θ) 0
0 0 1
Translation by t = ( tx , ty , 1) T is represented by the matrix T( t ): t =( tx , ty ,1)的翻译T由矩阵T( t )表示:
1 0 tx
0 1 ty
0 0 1
The overall transformation is the product T( t )M( θ ). 整体变换是乘积T( t )M( θ )。 This needs to be solved for the three unknowns θ , tx , and ty . 这需要针对三个未知数θ , tx和ty来解决。 With four known points, there are eight equations (two for each point, corresponding to the x and y coordinates), so there's more than enough info to solve for the unknowns. 有四个已知点,有八个方程(每个点两个,对应于x和y坐标),所以有足够的信息来解决未知数。 It's just a matter of plugging in the values for the known points. 这只是插入已知点的值的问题。
Since you have more points than is needed, you can use all of the points and solve the over-complete system to get a potentially more accurate transformation matrix (this is useful if you are not positive about the accuracy of the transformed coordinates). 由于您拥有的点多于所需的点,因此您可以使用所有点并求解过度完整的系统以获得可能更精确的变换矩阵(如果您对变换坐标的精度不肯定,这将非常有用)。
In more details, you can can represent the transformation matrix as 在更多细节中,您可以将转换矩阵表示为
a b c
-b a d
0 0 1
for some parameters a, b, and c (if you really need to, you can work out the angle and xy-translations from these a, b, and c). 对于某些参数a,b和c(如果你真的需要,你可以计算出这些a,b和c的角度和xy平移)。 Then we have these two equations from each of the four points (x_i, y_i) and result (x_i', y_i'): 然后我们从四个点(x_i,y_i)和结果(x_i',y_i')中的每一个得到这两个方程式:
a x_i + b y_i + c = x_i'
a y_i + -b x_i + d = y_i'
Then you can rewrite the eight equations as a system of linear equations with variables (a, b, c, d) as follows (in matrix form): 然后你可以将8个方程重写为具有变量(a,b,c,d)的线性方程组,如下所示(矩阵形式):
x_1 y_1 1 0 x_1'
y_1 -x_1 0 1 a y_1'
x_2 y_2 1 0 b x_2'
y_2 -x_2 0 1 * c = y_2'
x_3 y_3 1 0 d x_3'
y_3 -x_3 0 1 y_3'
x_4 y_4 1 0 x_4'
y_4 -x_4 0 1 y_4'
or Ax = B, where A is the matrix on the left, x = [abcd]', and B = the vector on the right. 或Ax = B,其中A是左边的矩阵,x = [abcd]',B =右边的矢量。
Now, decompose A using SVD to get UDV'. 现在,使用SVD分解A以获得UDV'。 Then x can be found as VD -1 U'B, where D -1 is the inverse of the diagonal matrix D. For more information on SVD, look at Singular Valude Decomposition (SVD) . 然后x可以被发现为VD -1 U'B,其中D -1是对角矩阵D的倒数。有关SVD的更多信息,请查看奇异有效分解(SVD) 。
Take two old points A, B (Line) with out loss of generality assume A is origin. 取两个旧点A,B(线)而不失一般性假设A是原点。 Look at A' and B'. 看看A'和B'。 translate A' to A and corresponding translation to B' => b''. 将A'转换为A并将相应的转换转换为B'=> b''。 Find the angle and you have the effective translation and rotation. 找到角度,你就有了有效的平移和旋转。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.