圆周相交算法

发布于 2024-12-28 02:50:09 字数 779 浏览 4 评论 0原文

我有一个点数组,其中(点)我知道坐标(在我的坐标平面中,x/y)。然后我有一个未知坐标的点,但我知道从“已知”点到该点的距离。我正在寻找“未知”点坐标。应该是一种三角测量。

我考虑过用方程组来描述这种情况。

假设这个数据:

coord[n] basePoints;
double[n] dist;
coord result;

让坐标像 a:

struct {
    double x,y;
};

现在,圆周方程是:

x^2 + y^2 + ax + bx + c = 0
where:
a = basePoint[i].x
b = basePoint[i].y
c = a^2 + b^2 + r^2
r = dist[i]

在这种情况下,我们需要 3 个点来精确确定结果点位置,因此我们需要一个由三个方程组成的系统。问题是:是否有一些快速的方法来找出结果坐标,但没有,是否有可遵循的算法?

编辑:

我在这里找到了我正在寻找的算法使用 3 个纬度和经度点以及 3 个距离进行三边测量

还要非常感谢 @hardmath 提供的方法名称和维基百科文章。

I have an array of points, of which(points) I know the coordinates(in my coordinate plane, x/y). Then I have a point of unknown coordinates, but I know the distance to that point from "known" points. I'm looking for "unknown" point coordinates. Should be a sort of triangulation.

I've thought about describing the situation with system of equations.

Let suppose this data:

coord[n] basePoints;
double[n] dist;
coord result;

Let think coord like a:

struct {
    double x,y;
};

Now, the circumference equation is:

x^2 + y^2 + ax + bx + c = 0
where:
a = basePoint[i].x
b = basePoint[i].y
c = a^2 + b^2 + r^2
r = dist[i]

In this case, we need 3 points to determine exactly the result point position, so we need a system of three equations. The question is: is there some fast way to find out the result coordinates, and there isn't, is there an algorithm to follow?

edit:

I found the algoritm I was looking for here Trilateration using 3 latitude and longitude points, and 3 distances.

Also a big thanks for @hardmath for the name of method and a wikipedia article.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

如梦初醒的夏天 2025-01-04 02:50:09

重述问题:您有以 basePoint[n] 为中心、半径为 dist[n]n 个圆,已知这些圆有一个公共交点观点。你想找到这一点。

取前两个圆并找到它们的交点。要么是 1,要么是 2(或者是 0,但问题无解)。如果是1,这应该就是答案。如果为 2,则与下一个圆圈消除歧义。您可以继续验证该点是否位于所有其他圆上。

Restating the problem: You have n circles centered at basePoint[n] with radius dist[n] which are known to have a single common intersection point. You want to find that one point.

Take the first two circles and find their intersection(s). There are either 1 or 2 (or 0, but then the problem has no solution). If 1, that should be the answer. If 2, disambiguate with the next circle. You could proceed to verify that point is on all of the other circles.

兮颜 2025-01-04 02:50:09

首先,你说你有n个点的坐标,以及到另一个点的距离(所以n个距离)。

如果你只有 2 个点的坐标,并且这 2 个坐标和第三个点(未知)之间的距离为 X(x,y)。

假设你的第一个点是 A(x1,y1),第二个点是 B(x2,y2)

现在你想找到未知点 X(x,y)

得到 A 和 x 之间的距离

d1 = sqrt((x1-x)^2 +(y1-y)^2)

你可以像这样 知道 x1、y1 和 d

,类似地,B 和 X 之间的距离将

d2 = sqrt((x2-x)^2-(y2-y)^2)

通过这两个方程得到,您将得到 2 个带有 2 个此类未知变量的线性方程,

mx+ny - d1 = 0

 and 

 px+ qy - d2 = 0 

您可以求解这两个方程以获得点的 x 和 y 坐标X(x,y)。

您没有提到您正在使用什么编程语言,但您可以使用您选择的任何编程语言来实现这一点。
你不需要n个点和n个距离来计算未知点,你可以只用2个点来计算它。

First of all, you say you have coordinates of n points, and the distance to the another point(so n distances).

if you have coordinates of only 2 points and you have the distance between those 2 coordinates and a third point(unknown) say X(x,y).

Lets say your first point is A(x1,y1) and your second Point is B(x2,y2)

Now you want to find the unknown Point X(x,y)

you can get distance between A and x like this

d1 = sqrt((x1-x)^2 +(y1-y)^2)

here you already know x1, y1 and d

and similarly distance between B and X will be

d2 = sqrt((x2-x)^2-(y2-y)^2)

so by these 2 equations, you will get 2 linear equations with 2 unknown variables of this type

mx+ny - d1 = 0

 and 

 px+ qy - d2 = 0 

you can solve these two equations to get x and y coordinates of point X(x,y).

you have not mentioned what programming language you are using, but you can implement this using any programming language of your choice.
You dont need n points and n distances to calculate the unknown point, you can calculate it using just 2 points.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文