logo separator

[mkgmap-dev] Gaps in surfaces

From Ticker Berkin rwb-mkgmap at jagit.co.uk on Mon Oct 2 14:55:15 BST 2023

Hi Gerd

Considering no_hp-overflow_alpha.patch:

It seems wrong to change a 24bit coordinate. Utils.toMapUnit() is well defined to do the
expected rounding with the conversion.

The actual deltas are local to Coord.java and, apart from their use by getAlternativePositions,
are just used to get back to the highPrec coord value.

The deltas are stored as byte, so the value of +32 causes no arithmetic problems generally.

getAlternativePositions(), however, should handle any complications with the +32, but it looks
like it mostly does, bumping up or down the 24bit coord if the abs(deltas) are > 16. It it
really possible that modLxxDelta can overflow a byte here?

Haven't looked at LineClipperTest yet.

Ticker

On Fri, 2023-09-29 at 06:57 +0000, Gerd Petermann wrote:
> Hi all,
> 
> I've found out that this problem is caused by a flaw in the "high precision" code. Under
> special conditions, two points with almost identical coordinates are internally represented
> with very different values. There is a possible overflow in the delta values, the value +32
> should not occur as it cannot be represented with 6 bits, but the calculations produce this
> value.
> I think I have an ugly fix for this but the resulting map still shows (smaller) gaps and a
> unit test needs corrections, so there is more to do.
> Attached is a patch that checks for this overflow. Work in progress and maybe causes trouble
> in other areas, e.g. in South America where we have negative lat/lon values.
> 
> @Ticker: The unit test für LineClipperTest fails. I am not sure if only the test has to be
> changed (how) or if the code in LineClipper can be improved. I seem to remember that you
> suggested to use
> the code in ShapeSplitter instead.
> 



More information about the mkgmap-dev mailing list