1

Problem:

  • I know the x and y of three arbitrary points on a 2d plane.
  • I know the vague distance from each point to the unknown, though I don't know the x y components.
  • I want to find the position of the 4th point.

The data is stored in a list >3 of type Data where

public class Data
{
   double m_x, m_y, m_distance;
}

I've tried:

  • Walking the list, calculating the components of the distance, then adding the known x and y. I then calculated the average position of the predicted point from the 3 known points, but the accuracy was inconsistent.
foreach (var item in data_list)
{
   var dx = item.m_x + item.m_distance * Math.Cos(item.m_distance);
   var dy = item.m_y + item.m_distance * Math.Sin(item.m_distance);

   out_list.Add(new Data { m_x = dx, m_y = dy });
}
foreach (var item in out_list)
{
   __dx += item.m_x;
   __dy += item.m_y;
}

__dx /= return_list.Count;
__dy /= return_list.Count;
  • Creating three circles at the known x and y, extending their radii equal to the distance component and checking intersection. The problem is that the distance varies since its rather imprecise, more like a suggestion.

Is there a simple, ok-performing, witty solution to this problem that I can't grasp? I've thought of extending lines 360 degrees around each point and checking where three lines intersect, the shortest distance away from the origin, but I'm not entirely sure about the implementation.

  • Google the keyword [Triangulation](https://en.wikipedia.org/wiki/Triangulation). This is a well researched problem, GPS works on the same principles and also has to account for slightly imprecise distance measurements depending on the angle to the satellites. – Andrew Williamson Jan 31 '22 at 22:42
  • The traditional pen-and-paper-way would be to draw circles with radius equal to distance from the known points, but if you don't know the distances, how could you find the fourth point? You'll need to have some concrete and accurate info to solve this. – Sami Jan 31 '22 at 22:43
  • can you expand a bit on what you mean by 'vague distance'? Is there an acceptible range (+/- 10 units) that will work? otherwise, any point on the same plane can satisfy the criteria, given 'vague' enough distance – Gus Jan 31 '22 at 22:44
  • @AndrewWilliamson thank you I will read more into it. – markdubinov01 Jan 31 '22 at 22:49
  • @Gus There is a 10% error in the distance, but I suppose it could be accounted for in the implementation. I'm just not sure how to go about it. – markdubinov01 Jan 31 '22 at 22:50
  • 1
    An easy implementation would be to add/subtract the error from one point at a time, and solve for the fourth point multiple times. You'll end up with a collection of fourth points in slightly different locations. Then you find the smallest circle that can contain all those points, and use that to work out the most likely solution and the accuracy of it – Andrew Williamson Feb 01 '22 at 00:18
  • 1
    The harder implementation is to add/subtract the error, and draw two circles around each point. The three points will make three rings, which should intersect at a common point. That intersection will make a complex shape, and the solution is somewhere in there. Maybe rasterize that shape, and take the average position as your fourth point – Andrew Williamson Feb 01 '22 at 00:21
  • 3
    The algorithm you're looking for is called [trilateration](https://en.wikipedia.org/wiki/True-range_multilateration) (triangulation uses angles from two reference points). There's no trivial solution, especially with imprecise inputs. – Corey Feb 01 '22 at 00:41

0 Answers0