1
$\begingroup$

I'm getting the distance between two locations (lat/long) using Pythagoras theorem.

my data look like this (I use microdegrees because I have limitations)

point1: -34608420,-58373160
point2: -34609420,-58374160
distance:1414.213562373095

I have a few limitation, I'm building an application for a cell phone and using decimals and functions like $\sin, \cos$ are very expensive and take a lot of time. Also, I'm doing this calculation more than $1000$ times.

Pythagoras works fine, but I need to convert the result distance to meters. The radius is the Earth's radius.

I do not care about precession because the points are very close too each other and the arc would not be much.

So,

How can I convert the resulting distance using Pythagoras to meters? Is there a better way to do it, than using Pythagoras?

Thanks, Federico

  • 0
    Can you use taylor approximations to sin and cos? I don't think polynomials cost a lot of time now do they?2012-01-06
  • 0
    There are pretty much 3 algorithms to simulate the trig functions: CORDIC, taylor series, and table lookup. Choice depends on your exact constraints. If you're processor constrained but the processor is better than a microcontroller, which I assume is the case for a cell phone, table lookup might be fastest.2012-01-07

1 Answers 1