logo separator

[mkgmap-dev] [Patch] Reduce bearingTo() calculations

From GerdP gpetermann_muenchen at hotmail.com on Sun Mar 4 21:05:20 GMT 2012

Hi WanMil,

the calculation in bearingTo() involves a lot of rounding errors because of
the trig. functions.
I verified that no value differed more than 0.5, which is good enough for us
since we only use the
integer value.
See also http://www.movable-type.co.uk/scripts/latlong.html 
It says:
"For final bearing, simply take the initial bearing from the end point to
the start point and reverse it (using θ = (θ+180) % 360)."

That's what I tried to implement. 

Gerd


WanMil wrote
> 
> Hi Gerd,
> 
> I have checked your patch by comparing old bearing to results with new 
> results. I got lots of differences as you can see by trying attached
> patch.
> 
> Can you please carefully check why there is a difference and which 
> version is 'better'?
> 
> WanMil
> 
> 
> 
>> Hi,
>>
>> in class RoadNetwork we calculate both p1.bearingTo(p2)  and the reverse
>> p2.bearingTo(p1).
>> I think the reverse value should be calculated from the initial value.
>>
>> See attached patch.
>>
>> Gerd
>>
>> http://gis.19327.n5.nabble.com/file/n5533880/bearingTo.patch
>> bearingTo.patch
>>
>> --
>> View this message in context:
>> http://gis.19327.n5.nabble.com/Patch-Reduce-bearingTo-calculations-tp5533880p5533880.html
>> Sent from the Mkgmap Development mailing list archive at Nabble.com.
>> _______________________________________________
>> mkgmap-dev mailing list
>> mkgmap-dev at .org
>> http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
> 
> 
> _______________________________________________
> mkgmap-dev mailing list
> mkgmap-dev at .org
> http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
> 


--
View this message in context: http://gis.19327.n5.nabble.com/Patch-Reduce-bearingTo-calculations-tp5533880p5535815.html
Sent from the Mkgmap Development mailing list archive at Nabble.com.



More information about the mkgmap-dev mailing list