logo separator

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

From Steve Ratcliffe steve at parabola.me.uk on Mon Mar 5 12:04:23 GMT 2012


> okay, safety first. Maybe Steve can say more about how important the
> precision

It ultimately fits into a byte, so it is only accurate to about 1.5
degrees anyhow. I only saw a difference for the value 90 degrees
when I tried WanMil's patch. But both are wrong in that they are only
179 degree apart instead of 180. Why not just reverse the integer
value instead of suffering more rounding with floats?

However I am not convinced that the original code is correct
in what it is doing.

If you have a road like this:

    .-------. C
    |        \
    |         \
    |          \
    |           \
    |            * D

where * are routing nodes, and . are plain nodes.

I thought that there were two directions, the initialHeading and the
Bearing. The initialHeading was AB and the Bearing AD. (For the
forward arc ABCD, for the reverse arc that would be DC and DA)

However the code has initialHeading and finalHeading of AB and CD
if I am reading it correctly.

I could be wrong of course, since I only looked at the routing network
very early on, and I'm not sure where this memory came from, since I
never implemented the complex cases.


More information about the mkgmap-dev mailing list