Skip to content

AssertionError #4

@nedbat

Description

@nedbat
from poly_point_isect import *

isect_segments([
 ((-281.28544884362674, 317.6137532740669),
  (-265.13898636953286, 261.3043468249764)),
 ((-281.2854488436267, 317.6137532740669),
  (-337.59485529271734, 301.46729079997294)),
 ((-1149.6129916392008, 165.83369085939785),
  (-1163.7844481799289, 108.99508316541483)),
 ((-549.7909078231165, -373.0494512387376),
  (11.946694838912322, -684.4256889356793)),
])

produces:

Traceback (most recent call last):
  File "/Users/ned/zellij/poly_point_isect.py", line 284, in remove
    self._events_current_sweep.remove(event)
  File "/Users/ned/zellij/poly_point_isect.py", line 1197, in remove
    raise KeyError(str(key))
KeyError: 'Event(0x10d66be88, s0=(-337.59485529271734, 301.46729079997294), s1=(-281.2854488436267, 317.6137532740669), p=(-281.2854488436267, 317.6137532740669), type=0, slope=0.28674538575880665)'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "bad_isect.py", line 11, in <module>
    (11.946694838912322, -684.4256889356793))]
  File "/Users/ned/zellij/poly_point_isect.py", line 526, in isect_segments
    return isect_segments_impl(segments, include_segments=False)
  File "/Users/ned/zellij/poly_point_isect.py", line 509, in isect_segments_impl
    sweep_line.handle(p, events_current)
  File "/Users/ned/zellij/poly_point_isect.py", line 331, in handle
    self.handle_event(e)
  File "/Users/ned/zellij/poly_point_isect.py", line 355, in handle_event
    self.remove(event)
  File "/Users/ned/zellij/poly_point_isect.py", line 293, in remove
    assert(event.in_sweep == False)
AssertionError

I'm not sure what is special about these four segments. They are the smallest set that produces the crash from a much larger set that I started with.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions