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