[Xastir-dev] Distance/Area/Angle Calculation Summary

Curt, WE7U archer at eskimo.com
Thu Mar 24 12:39:27 EST 2005


What has been implemented.  Before I forget, which won't be long!


DISTANCE:
---------
*) Haversine formula (2-parameter atan version) for computing
distance between two points, for our general distance routines:

    calc_distance()
    calc_distance_course()
    distance_from_my_station()

*) Haversine formula (2-parameter atan version) in "Measure" for
both the X/Y offsets and the total distance.

Haversine formula is more accurate for shorter distances than
spherical trigonometry calculations.  Both methods are equivalent
for longer distances.  Both are Great-Circle calculations (as
opposed to Rhumb-line or planar geometry).  See the GIS FAQ for info
on these methods.  Dr. Math website mentions both of these and
refers people to the same GIS FAQ.


AREA:
-----
*) Area of a spherical rectangle from Dr. Math's website for the
"Measure" function.  I found errors in their last two derived
formulas and notified them of it.  Our implemented code appears to
be correct.

*) Now that I think about it, the area calculation for CAD Object
Polygons is probably not spherical, but planar.  It might take some
doing to calculate the area of irregular polygons on a spherical
surface though.  Haven't looked into it.


ANGLE:
------
*) Great Circle departure angle for the "Measure" function.

*) Great Circle departure angle for the calc_distance_course()
function.

*) I'm still not sure how to classify what I'm using for
dead-reckoning angle:

I compute the next point along a constant angle based on the last
position transmitted, the time elapsed, and the course desired.
This then gets corrupted a bit by the APRS grid that it has to snap
to (and the position snapped to for the previous position), and/or
by the course angle transmitted by Base-91 compressed positions.
Standard APRS gives you 1-degree resolution but 60-foot or so grid
points.  Compressed gives you something like 1 to 3-foot grid
points, but less resolution for the angles (+/- 2 degrees.  We can't
win!

The end result is that we start off like a drunk sailer due to our
short transmit times and the above problems, then the angle smooths
out as the time increases between our transmits.  You can see this
easily at zoom level 1, when you place an object and when you make a
change to an object or move it (transmit rate goes up for these
conditions).

I think dead-reckoning effectively does a Rhumb-Line calculation, as
it is trying to do a constant heading.  That means it is not the
shortest distance between the points (I'm still trying to get my
head around that last concept as it is counter-intuitive to someone
versed in compass/maps on land and with shorter distances).

A Great-Circle route is the shortest distance between two points on
a sphere, whereas a Rhumb-line is what you get if you move along a
constant compass heading and is a bit longer.

I don't think we need to get into ellipsoid calculations for Xastir.
Spherical calculations should be plenty good enough for what we do.

--
Curt, WE7U.   APRS Client Comparisons: http://www.eskimo.com/~archer
"Lotto:    A tax on people who are bad at math." -- unknown
"Windows:  Microsoft's tax on computer illiterates." -- WE7U
"The world DOES revolve around me:  I picked the coordinate system!"



More information about the Xastir-dev mailing list