首页 > 解决方案 > 是否有一种已知的算法可以根据已知点之间的距离来获取 n 个未知点的相对位置?

问题描述

我在 3D 空间中有一组 10 个点。我拥有的唯一信息是从每个点到每个其他点的距离。

我可以任意设置一个点为(0,0,0),另一个为我的X轴(距离,0,0)。

现在,似乎我应该能够使用这两个已知点来定位 3D 空间中的所有其他点(相对于前两个点)。

我有足够的信息来做这件事吗?是否有我应该研究的现有算法?

标签: mathtriangulation

解决方案


对于前三点,我可以:

//store first one as zero point

        if (pos.id == 0)
        {
            pos.position = Eigen::Vector3d(0, 0, 0);    
        }

        //store second as X axis
        if (pos.id == 1)
        {
            pos.position = Eigen::Vector3d(<Distance from 1 to 2>, 0, 0);
        }

        //triangulate third from distances
        if (pos.id == 2)
        { 
            double c =  //distance from 3 to 1
            double b =  //distance from 3 to 2
            double a =  //distance from 1 to 2

            pos.position.x() = (c*c - b * b + a * a) / (2 * a);
            pos.position.y() = std::sqrt(c*c - pos.position.x()*pos.position.x());



        }

从这里开始的第三点代码

现在我可以按照评论中的建议,使用三个已知点对以下几点进行多点定位。


推荐阅读