Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Specific Polygons That Won't Union #78

Open
sdubinsky opened this issue Oct 13, 2020 · 1 comment
Open

[Bug] Specific Polygons That Won't Union #78

sdubinsky opened this issue Oct 13, 2020 · 1 comment

Comments

@sdubinsky
Copy link

Hi,
I have two polygons:

geo1 = Geometry::Polygon.new(Geometry::Point[1691, 957], Geometry::Point[1677, 1175], Geometry::Point[1635, 1173], Geometry::Point[1649, 951])
geo2 = Geometry::Polygon.new(Geometry::Point[1690, 1033], Geometry::Point[1687, 1139], Geometry::Point[1670, 1138], Geometry::Point[1673, 1030])

When I call geo1.union(geo2) it throws an error:

Error:
TestBox#test_broken_box:
NoMethodError: undefined method `first' for nil:NilClass
    /home/deus-ex/.gem/ruby/2.7.1/gems/geometry-6.5/lib/geometry/polyline.rb:143:in `close!'
    /home/deus-ex/.gem/ruby/2.7.1/gems/geometry-6.5/lib/geometry/polygon.rb:32:in `initialize'
    /home/deus-ex/.gem/ruby/2.7.1/gems/geometry-6.5/lib/geometry/polygon.rb:174:in `new'
    /home/deus-ex/.gem/ruby/2.7.1/gems/geometry-6.5/lib/geometry/polygon.rb:174:in `union'
    /home/deus-ex/code/title_reader/test/test_box.rb:147:in `test_broken_box'

However, if I call geo2.union(geo1) it works fine. It also works if I change the first point in geo2 to Geometry::Point[1695, 1033]. I don't know enough about geometry to debug this further.

Thanks!

@sdubinsky
Copy link
Author

This is geometry version 6.5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant