title: 3 points distance calculation strategy
body: <p><strong>Problem:</strong> I have (lat-long) co-ordinates of a lot of points a, b, c, d . . . in the database.
  Now, when i choose point a, i need to calculate the distances of point a from each of the other points and get the closest one for eg. This math requires cos and tan calculations of the points. So this seems to be quite expensive on the db side.</p>
  
  <p>So i thought of a strategy to simplify this. Below is the explanation of the strategy.</p>
  
  <p>I have 3 known points (x, y, z) the distance between one point to the other is known. For this example lets assume to be 10. i.e. distance from x to y = 10; y to z = 10; z to x = 10. (this forms an equilateral triangle. but real scenario might not be the case)</p>
  
  <p>Now lets say we have two points a and b. we calculate the distances of point a to x, y and z and store respectively and so for point b. (say application logic)</p>
  
  <p>so we have:</p>
  
  <ul>
  <li>for point a: Ax, Ay and Az </li>
  <li>for point b: Bx, By and Bz</li>
  </ul>
  
  <p>As for the strategy, the question is how can we calculate the distance between point a to point b.  </p>
  
  <p>As for the problem itself, if i apply the above strategy to my it, question is am I simplifying or complicating the situation?</p>
  
  <p>Thanks in advance for your answer.</p>