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

Multi-union gives assertion error #160

Open
rjdverbeek opened this issue Feb 7, 2019 · 0 comments
Open

Multi-union gives assertion error #160

rjdverbeek opened this issue Feb 7, 2019 · 0 comments
Labels

Comments

@rjdverbeek
Copy link

When I use the multi-union function I get in some situations an assertion error:

---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
<ipython-input-155-314e2cf39774> in <module>()
----> 1 current_polygon = polygon.SphericalPolygon.multi_union(vp_set)

D:\PyCharmWorkspace\ODC\EdgeCaseAirspaces\spherical_geometry_master\spherical_geometry\polygon.py in multi_union(cls, polygons)
   1159 
   1160         g = graph.Graph(all_polygons)
-> 1161         return g.union()
   1162 
   1163     def intersection(self, other):

D:\PyCharmWorkspace\ODC\EdgeCaseAirspaces\spherical_geometry_master\spherical_geometry\graph.py in union(self)
    412         self._sanity_check("union - remove degenerate edges")
    413         self._remove_3ary_edges()
--> 414         self._sanity_check("union - remove 3ary edges")
    415         self._remove_orphaned_nodes()
    416         self._sanity_check("union - remove orphan nodes", True)

D:\PyCharmWorkspace\ODC\EdgeCaseAirspaces\spherical_geometry_master\spherical_geometry\graph.py in _sanity_check(self, title, node_is_2)
    389                 assert len(node._edges) % 2 == 0
    390             else:
--> 391                 assert len(node._edges) >= 2
    392             for edge in node._edges:
    393                 assert node in edge._nodes

AssertionError: 

I get the error when creating the union of the following three polygons:

[[SingleSphericalPolygon(array([[0.60853841, 0.07537912, 0.78993607],
        [0.58307793, 0.08937607, 0.80748501],
        [0.59261214, 0.12107428, 0.79633653],
        [0.61725749, 0.10959814, 0.77909014],
        [0.61914432, 0.10482613, 0.77824918],
        [0.60853841, 0.07537912, 0.78993607]]), array([0.60075422, 0.09825597, 0.79337263]))],
 [SingleSphericalPolygon(array([[0.59986044, 0.15391752, 0.7851604 ],
        [0.6235809 , 0.14470431, 0.76824965],
        [0.62643114, 0.13854319, 0.76706572],
        [0.61725749, 0.10959814, 0.77909014],
        [0.59261214, 0.12107428, 0.79633653],
        [0.59180216, 0.12300026, 0.79664367],
        [0.59986044, 0.15391752, 0.7851604 ]]), array([0.60969738, 0.12984616, 0.78192652]))],
 [SingleSphericalPolygon(array([[0.64389077, 0.087042  , 0.76015023],
        [0.6323568 , 0.0595102 , 0.77238812],
        [0.60957772, 0.0722364 , 0.78942822],
        [0.60853841, 0.07537912, 0.78993607],
        [0.61914432, 0.10482613, 0.77824918],
        [0.64120761, 0.09430318, 0.76155086],
        [0.64389077, 0.087042  , 0.76015023]]), array([0.62691089, 0.07966165, 0.77500759]))]]

But I don't get the error when I create a multi-union of the polygons 1 and 2, and with polygons 2 and 3.
I also don't get the error when I first create a multi-union of polygons 1 and 2, and then a multi-union of the resulting union of poly 1 + 2 with the polygon 3.

So
1 + 2 + 3 > assertion error
1 + 2 > correct
2 + 3 > correct
(1 + 2) + 3 > correct

When I turn off DEBUG (=False) I get an empty SphericalPolygon.

@pllim pllim added the bug label Oct 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants