问题描述
我有4点之间的距离。我想在2D网格上绘制这个数据。
I have the distance between 4 points. I want to plot this data on a 2D grid.
我已经尝试过一点,并把它放在(0,0)开始。然后,我可以创建代表三个其他点的可能位置的圆圈。一旦我得到这一点,我可以锁定在任意位置的第二点。做相同的可能的位置,得到两个可能的位置点3.我可以只选一个,然后找出四。我知道这是可能的,我可以得到在纸上的答案,但我想知道是否有一个更容易的方式,而不是我的想法,其他人已经发现。
I have tried taking one point and placing it on (0,0) to start. Then I can create circles that represent possible locations for the the three other points. Once I get to that point I can lock in an arbitrary position for point two. Do the same possible locations and get to two possible location for point 3. I can just pick one and then figure out four. I know it's possible, I can get to the answer on paper but I wonder if there is an easier way than how I am going about it that others have already figured out.
如果有人可以指出正确的方向,或指向我一些阅读,讨论确定这些点的公式将是伟大的。
If someone could point me in the right direction or point me towards some reading that discusses the formulas involved in determining these points that would be great.
谢谢!
我尝试了:
points = [A, B, C, D] //unknown
angles = [AoA, AoB, AoC, AoD]
distances = [AB, AC, AD, BC, BD, CD] //known
A.x = 0 //seeded value
A.y = 0 //seeded value
B.x = AB
B.y = A.y
C.x = (AB² - BC² + AC²) / (2 * AB) //assume positive answer
C.y = Math.sqrt(BC² - (B.x - C.x)²) - B.y
D.x = ???
D.y = ???
推荐答案
/ p>
You will essentially have a system of six equations:
AB^2 = (A.x - B.x)^2 + (A.y - B.y)^2 EQ[1]
AC^2 = (A.x - C.x)^2 + (A.y - C.y)^2 EQ[2]
AD^2 = (A.x - D.x)^2 + (A.y - D.y)^2 EQ[3]
BC^2 = (B.x - C.x)^2 + (B.y - C.y)^2 EQ[4]
BD^2 = (B.x - D.x)^2 + (B.y - D.y)^2 EQ[5]
CD^2 = (C.x - D.x)^2 + (C.y - D.y)^2 EQ[6]
您的问题基本上解决了这8个变量 Ax,Ay,Bx,By,Cx,Cy,Dx,Dy
他们到2D图。这允许根据所选择的值折叠的整个范围的解。您在这里是一个的系统。有许多不同的方法来解决这些类型的方程:计算机,,等,你可以使用,或者通过代数操作变量。
Your problem is essentially solving these for the 8 variables Ax,Ay,Bx,By,Cx,Cy,Dx,Dy
and fitting them to a 2D graph. This allows for a whole range of solutions which collapses depending on what values are chosen. What you have here is a system of non-linear equations. There are many different methods to solve these types of equations: computers e.g. Mathematica, Matlab, Python, etc., by hand you can use a Jacobian, or by algebraically manipulating the variables.
您的圈子视图是开始的好地方。从你的第一个点A,你将有四个同心圆,然后从每个圆上的每个点四个同心圆。问题是的扩展版本。
Your visualization of circles is a good place to start. From your first point A, you will have four concentric circles, and then from each point on each circle four more concentric circles. The problem is the expanded version of this.
你在这种情况下的优势是你可以选择两个初始值。希望这指向正确的方向。我不知道你想使用什么方法,但这是你处理的问题类型。
Your advantage in this situation is that you get to choose the two initial values. Hopefully this points you in the right direction. I'm not sure what method you'd like to use but this is the type of problem you are dealing with.
这里是一个〜漂亮的图片:
And here is a ~pretty picture:
您的解决方案将沿着这些圈子的线及其交叉点传播。
Your solutions will propagate along the lines of these circles, and their intersection points.
正如你所看到的,你不会有任何明确的每个点的答案,直到你做出决定,但你可以看到如何选择A,然后选择B与A相关,你会有两个选择C,半径BC和半径AC的圆相交的圆。然后你将再次有两个选择D,其中三个圆圈:从半径AD的A,从半径BD的B和从半径CD的C相交。
As you can see you will not have any definite answers for each point until you make decisions along the way but you can see how as you choose A, then choose B related to A, you'll have two choices for C, where circles of radius BC and circles of radius AC intersect. Then you will again have two choices for D, where the three circles: from A with radius AD, from B with radius BD, and from C with radius CD intersect.
您可以在程序中设置方程式,对第一个点进行一些任意决定,因为 A =(0,0)
和 B =(AB,0)
,类似输入起点,第二个点总是 + AB
在 x
方向。然后求解找到定义从B的半径BC和从A的半径AC的圆的方程的两个根。一旦定义C,对于这三个圆的方程的根也是相同的。
You could set up your equations in a program to make some arbitrary decision for the first point as you have for A = (0,0)
and B = (AB,0)
, something like input a starting point, the second point is always +AB
in the x
direction. Then solve to find the two roots of the equation which defines the circles of radius BC from B and of radius AC from A. Once C is defined do the same for the roots of the equations of those three circles.
这篇关于基于它们之间的距离绘制4个点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!