Calculate coordinates of a point with given distances to two other points
If I have three points A, B, C and I know the distances between them and A is at 2D coordinates {0,0} and B is at {ab,0}, then what would be the formula to find the coordinat开发者_高级运维es of the point C?
The point {cx, cy}
has to solve two equations:
cx^2+cy^2==ac^2 && (cx-ab)^2+cy^2==bc^2
=> cx^2-(cx-ab)^2==ac^2-bc^2
=> 2*cx*ab==ac^2-bc^2+ab^2
=> cx = (ac^2-bc^2+ab^2)/(2*ab)
=> cy = +/- sqrt(ac^2-cx^2) iff ac^2-cx^2 > 0
=> cy = 0 iff ac^2-cx^2 = 0
=> no solution else
There are either two points which both have the desired distances. But based on ac^2-cx^2
there may also be only one solution or none at all.
If you don't place any further restrictions to the distances, your question is equivalent to "how to find the intersection of 2 circles":
http://mathworld.wolfram.com/Circle-CircleIntersection.html
Therefore, as Howard pointed out, there will be 0, 1, or 2 intersections points fulfilling the conditions you placed.
You can use the distance formula (basically Pythagorean theorem) to find the distance between any two points on a coordinate plane.
http://www.purplemath.com/modules/distform.htm
精彩评论