logo separator

[mkgmap-dev] Explanation of the is_in function

From Gerd Petermann gpetermann_muenchen at hotmail.com on Sat May 23 14:56:40 BST 2020

Hi Ticker,

yes, the patch seems to fix the problems regarding isPointInShape().
I've also changed the code which calculates new points (pTest) near points which are known to be ON.
This is still just a good guess and it is easy to construct test cases where a shape has a sharp angle so that it is nearly impossible to find a point which is IN but not inside the EPS halo and thus calculated as ON.
Let's see if this matters...

Gerd

________________________________________
Von: mkgmap-dev <mkgmap-dev-bounces at lists.mkgmap.org.uk> im Auftrag von Ticker Berkin <rwb-mkgmap at jagit.co.uk>
Gesendet: Samstag, 23. Mai 2020 12:01
An: Development list for mkgmap
Betreff: Re: [mkgmap-dev] Explanation of the is_in function

Hi Gerd

Here is a patch that should fix the problem - In the original code I
got carried away with the symmetry of Lat/Lon handling in the distance
calculation but the set-up for the crossing calculation isn't
symmetric!

I've also explained the ON error area more carefully and used INFINITY
instead of NaN because that is the horizontal distance where a line
through the node would meet a horizontal polygon side.

Ticker

On Fri, 2020-05-22 at 21:44 +0100, Ticker Berkin wrote:
> Hi Gerd
>
> I think I understand what is going wrong. I'll do another patch
> tomorrow.
>
> Ticker
>
>
> On Fri, 2020-05-22 at 13:36 +0000, Gerd Petermann wrote:
> > Hi Ticker,
> >
> > the patched version still returns ON for a Coord which is not ON
> > and
> > thus doesn't work with my example.
> > The result doesn't depend on the position of the last point of the
> > way as long as it is builds a nearly or exactly straight line with
> > two nodes of the shape.
> >
> > Your algorithm returns true for each such point, even when it is
> > 100m
> > away from any shape vertex.
> > See my new example where A,B and C build a straight line. Another
> > node is very close to the edge but still returns  IN (OK)
> >
> > Gerd
> >
> >
> > ________________________________________
> > Von: mkgmap-dev <mkgmap-dev-bounces at lists.mkgmap.org.uk> im Auftrag
> > von Ticker Berkin <rwb-mkgmap at jagit.co.uk>
> > Gesendet: Donnerstag, 21. Mai 2020 17:07
> > An: Development list for mkgmap
> > Betreff: Re: [mkgmap-dev] Explanation of the is_in function
> >
> > Hi Gerd
> >
> > Here is patch that prevents possible underflow when node is very
> > close
> > to an almost horizontal or vertical line and incorrect results when
> > exactly on this line.
> >
> > Ticker
> >
> > _______________________________________________
> > mkgmap-dev mailing list
> > mkgmap-dev at lists.mkgmap.org.uk
> > http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
> _______________________________________________
> mkgmap-dev mailing list
> mkgmap-dev at lists.mkgmap.org.uk
> http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev


More information about the mkgmap-dev mailing list