Skip Menu |

This queue is for tickets about the Math-Polygon CPAN distribution.

Report information
The Basics
Id: 118030
Status: resolved
Priority: 0/
Queue: Math-Polygon

People
Owner: Nobody in particular
Requestors: marcus [...] fairwayit.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 1.04



Subject: poly->contains(POINT) fails on the edge
Date: Thu, 22 Sep 2016 11:52:47 +0100
To: bug-Math-Polygon [...] rt.cpan.org
From: Marcus Robst <marcus [...] fairwayit.com>
Hi – the documentation for poly->contains says: $obj->*contains*(POINT) - Returns a truth value indicating whether the point is inside the polygon or not. *On the edge is inside*. However this scenario in my application is failing (returning false) and I can’t see an obvious reason why: $s3_poly = Math::Polygon->new( [ 400, 0 ], [ 600, 0 ], [ 600, 1000 ], [ 400, 1000 ], [ 400, 0 ] ); if ( $s3_poly->contains( [ $x_pos, $y_pos ] ) ) { $moved_pupils[$i]->{'s3'} = 1; # s3 counter } Values for $x_pos and $y_pos are 400,480 Please advise if this is a bug or I did something wrong? I think its related to the edge scenario where x_pos = 400 as values > 400 work. Thank you Marcus
Subject: Re: [rt.cpan.org #118030] poly->contains(POINT) fails on the edge
Date: Fri, 23 Sep 2016 16:08:41 +0200
To: Marcus Robst via RT <bug-Math-Polygon [...] rt.cpan.org>
From: Mark Overmeer <mark [...] overmeer.net>
* Marcus Robst via RT (bug-Math-Polygon@rt.cpan.org) [160922 10:53]: Show quoted text
> Thu Sep 22 06:53:06 2016: Request 118030 was acted upon. > Transaction: Ticket created by marcus@fairwayit.com > Queue: Math-Polygon > Subject: poly->contains(POINT) fails on the edge > > Hi – the documentation for poly->contains says:
I use a standard algorithm which is solution 1 on page http://www.eecs.umich.edu/courses/eecs380/HANDOUTS/PROJ2/InsidePoly.html which is unclear about point on the edge. There was already a adaption for the case of horizontal edges, but apparently there was also a need for the vertical case. Be aware that this involves floating point calculation, which may cause rounding errors. Fix released as version 1.04 to CPAN. -- Thanks for reporting, MarkOv ------------------------------------------------------------------------ drs Mark A.C.J. Overmeer MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net
Subject: RE: [rt.cpan.org #118030] poly->contains(POINT) fails on the edge
Date: Mon, 26 Sep 2016 08:36:42 +0100
To: bug-Math-Polygon [...] rt.cpan.org
From: Marcus Robst <marcus [...] fairwayit.com>
Thanks Mark, appreciate the fast response. I have some similar use cases with triangle shapes not returning when the point is on the diagonal so will test against the new release and confirm if they are captured. Thanks Marcus Show quoted text
-----Original Message----- From: Mark Overmeer via RT [mailto:bug-Math-Polygon@rt.cpan.org] Sent: 23 September 2016 15:09 To: marcus@fairwayit.com Subject: Re: [rt.cpan.org #118030] poly->contains(POINT) fails on the edge <URL: https://rt.cpan.org/Ticket/Display.html?id=118030 > * Marcus Robst via RT (bug-Math-Polygon@rt.cpan.org) [160922 10:53]:
> Thu Sep 22 06:53:06 2016: Request 118030 was acted upon. > Transaction: Ticket created by marcus@fairwayit.com > Queue: Math-Polygon > Subject: poly->contains(POINT) fails on the edge > > Hi – the documentation for poly->contains says:
I use a standard algorithm which is solution 1 on page http://www.eecs.umich.edu/courses/eecs380/HANDOUTS/PROJ2/InsidePoly.html which is unclear about point on the edge. There was already a adaption for the case of horizontal edges, but apparently there was also a need for the vertical case. Be aware that this involves floating point calculation, which may cause rounding errors. Fix released as version 1.04 to CPAN. -- Thanks for reporting, MarkOv ------------------------------------------------------------------------ drs Mark A.C.J. Overmeer MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net
Subject: Re: [rt.cpan.org #118030] poly->contains(POINT) fails on the edge
Date: Mon, 26 Sep 2016 09:41:37 +0200
To: Marcus Robst via RT <bug-Math-Polygon [...] rt.cpan.org>
From: Mark Overmeer <mark [...] overmeer.net>
* Marcus Robst via RT (bug-Math-Polygon@rt.cpan.org) [160926 07:37]: Show quoted text
> Queue: Math-Polygon > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=118030 > > > Thanks Mark, appreciate the fast response. > > I have some similar use cases with triangle shapes not returning when the > point is on the diagonal so will test against the new release and confirm if > they are captured.
I tried to produce a mistake with a dialogal, but did not succeed myself. So: glad if you demonstrate a case. The fix for it looks quite straight-forward. -- Regards, MarkOv ------------------------------------------------------------------------ Mark Overmeer MSc MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net
Fixed in 1.04, released last september