Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Polygon.contains? bug #7

Open
xsxVeNxsx opened this Issue · 1 comment

2 participants

@xsxVeNxsx
arr = [Geometry::Point.new(1.6, 1.0), Geometry::Point.new(1.6, 2.0), 
     Geometry::Point.new(1.2, 2.0), Geometry::Point.new(1.2, 1.0)]
point = Geometry::Point.new(1.5, 1.5)
result = Geometry::Polygon.new(arr).contains?(point)

Result = true. It's ok. But:

arr = [Geometry::Point.new(1.6, 1.0), Geometry::Point.new(1.6, 2.0),
     Geometry::Point.new(1.2, 2.0), Geometry::Point.new(1.2, 1.0)]
point = Geometry::Point.new(1.5, 1.5)
result = Geometry::Polygon.new(arr).contains?(point)
(0..100).each{result &&= Geometry::Polygon.new(arr).contains?(point)}

result = false

@DanielVartanov

Thanks for reporting a very interesting bug. I'll investigate what's happening there.

@xsxVeNxsx xsxVeNxsx referenced this issue from a commit in horror/d2d-shooter_game
@xsxVeNxsx xsxVeNxsx Change polygon_include_point function
ruby-geometry is issued uncorrect results with some data. Details on DanielVartanov/ruby-geometry#7
That's why a new implementation has been developed, without using third-party gems.
3341467
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.