使用最小二乘法的3D向量交集 [英] 3D vectors intersection using least-squares approach

查看:97
本文介绍了使用最小二乘法的3D向量交集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试获取某些3D线的交点.这些行以以下形式表示:

I have been trying to get the intersection point of some 3D lines. The lines are represented in the form

行:s + t * r.线条并没有真正相交,所以我想在3D中得到一点,即从该点到所有线条的距离最小

Line: s + t*r. The lines doesn't really intersect, so I would like to get the point in 3D that the distance from that point to all lines is minimum

我找到了用于找到两条线之间的交点的解决方案,但就我而言,它是一组线,例如5条或更多.

I found solutions for finding the intersection between two lines, but in my case, it is a set of lines, like 5 or more.

我找到了一个表示点a到直线l之间距离的解决方案:p + t * r(p是起点,r是方向矢量,t是标量值)

I found a solution that represents the distance between the point a to line l: p+t*r (p is the start point, and r is the direction vector, t is a scalar value) as

d(a,l)=(|| r x(p-a)||)/|| r || =

d(a,l) = (|| r x (p-a) ||)/|| r || =

|| ([r] x/|| r ||)a-([r] x/|| r ||)p ||

|| ([r]x/||r||)a - ([r]x/||r||) p ||

该解决方案说第二个方程是形式为

which the solution said that the second equation is a least-square minimization problem of the form

|| Ax-b ||

|| Ax-b ||

解决方案是x =(At A)^-1 * At * b,At是A转置,但是我不能在这里格式化它.

and the solution is x = (At A)^-1 * At*b , At is A transpose, but I can't format it here.

如果我有多行,如何写矩阵A和向量b?

How can I write the matrix A and vector b if i have several lines?

推荐答案

我在此处将MATLAB函数用于最小二乘n线交点,并在C ++中对其进行了编码以供使用: http://www.mathworks.com/matlabcentral/fileexchange/37192-intersection-point-of-lines-in-3d-space/content/lineIntersect3D.m

I used the MATLAB function for least-squares n-line intersection here and coded it in C++ for my uses: http://www.mathworks.com/matlabcentral/fileexchange/37192-intersection-point-of-lines-in-3d-space/content/lineIntersect3D.m

我在这里遵循了n线相交的理论: http://en.wikipedia.org/wiki/Line-line_intersection

I followed the theory for n-line intersection here: http://en.wikipedia.org/wiki/Line-line_intersection

太棒了!

这篇关于使用最小二乘法的3D向量交集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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