Performance aside, I think your LineComparator is incorrect(!) as it compares the points where the sweepline initially ran into the segments. The sweepline has swept on in the meanwhile and therefore, while the ordering of the segments on the sweepline has not changed, the actual location of their intersections with the sweepline has moved and you need to account for this when trying to figure out where to insert a new segment in the sweepline.
![illustration of the problem][1]illustration of the problem
When the vertical sweepline encounters segment number 5, it shouldn't compare its intersection point with 5 with the grey intersectionpoints of 1, 2, 3, and 4. If it does that, it'll insert 5 at the top. It needs to compare its intersection point with 5 with its current red intersection points with segments 1, 2, 3, and 4 and insert number 5 right in the middle. [1]: https://i.sstatic.net/qHqGo.jpg
Performance aside, I think your LineComparator is incorrect(!) as it compares the points where the sweepline initially ran into the segments. The sweepline has swept on in the meanwhile and therefore, while the ordering of the segments on the sweepline has not changed, the actual location of their intersections with the sweepline has moved and you need to account for this when trying to figure out where to insert a new segment in the sweepline.
![illustration of the problem][1]
When the vertical sweepline encounters segment number 5, it shouldn't compare its intersection point with 5 with the grey intersectionpoints of 1, 2, 3, and 4. If it does that, it'll insert 5 at the top. It needs to compare its intersection point with 5 with its current red intersection points with segments 1, 2, 3, and 4 and insert number 5 right in the middle. [1]: https://i.sstatic.net/qHqGo.jpg
Performance aside, I think your LineComparator is incorrect(!) as it compares the points where the sweepline initially ran into the segments. The sweepline has swept on in the meanwhile and therefore, while the ordering of the segments on the sweepline has not changed, the actual location of their intersections with the sweepline has moved and you need to account for this when trying to figure out where to insert a new segment in the sweepline.
illustration of the problem
When the vertical sweepline encounters segment number 5, it shouldn't compare its intersection point with 5 with the grey intersectionpoints of 1, 2, 3, and 4. If it does that, it'll insert 5 at the top. It needs to compare its intersection point with 5 with its current red intersection points with segments 1, 2, 3, and 4 and insert number 5 right in the middle.
Performance aside, I think your LineComparator is incorrect(!) as it compares the points where the sweepline initially ran into the segmentsegments. The sweepline has swept on in the meanwhile and therefore, while the ordering of the segments on the sweepline has not changed, the actual location of their intersections with the sweepline has moved and you need to account for this when trying to figure out where to insert thea new segment in the sweepline.
![illustration of the problem][1]
When the vertical sweepline encounters segment number 5, it shouldn't compare its intersection point with 5 with the grey intersectionpoints of 1, 2, 3, and 4. If it does that, it'll insert 5 at the top. It needs to compare its intersection point with 5 with its current red intersection points with segments 1, 2, 3, and 4 and insert number 5 right in the middle. [1]: https://i.sstatic.net/qHqGo.jpg
I think your LineComparator is incorrect as it compares the points where the sweepline initially ran into the segment. The sweepline has swept on in the meanwhile and therefore, while the ordering of the segments on the sweepline has not changed, the actual location of their intersections with the sweepline has moved and you need to account for this when trying to figure out where to insert the new segment in the sweepline.
![illustration of the problem][1]
When the vertical sweepline encounters segment number 5, it shouldn't compare its intersection point with 5 with the grey intersectionpoints of 1, 2, 3, and 4. If it does that, it'll insert 5 at the top. It needs to compare its intersection point with 5 with its current red intersection points with segments 1, 2, 3, and 4. [1]: https://i.sstatic.net/qHqGo.jpg
Performance aside, I think your LineComparator is incorrect(!) as it compares the points where the sweepline initially ran into the segments. The sweepline has swept on in the meanwhile and therefore, while the ordering of the segments on the sweepline has not changed, the actual location of their intersections with the sweepline has moved and you need to account for this when trying to figure out where to insert a new segment in the sweepline.
![illustration of the problem][1]
When the vertical sweepline encounters segment number 5, it shouldn't compare its intersection point with 5 with the grey intersectionpoints of 1, 2, 3, and 4. If it does that, it'll insert 5 at the top. It needs to compare its intersection point with 5 with its current red intersection points with segments 1, 2, 3, and 4 and insert number 5 right in the middle. [1]: https://i.sstatic.net/qHqGo.jpg
I think your LineComparator is incorrect as it compares the points where the sweepline initially ran into the segment. The sweepline has swept on in the meanwhile and therefore, while the ordering of the segments on the sweepline has not changed, the actual location of their intersections with the sweepline has moved and you need to account for this when trying to figure out where to insert the new segment in the sweepline.
![illustration of the problem][1]
When the vertical sweepline encounters segment number 5, it shouldn't compare its intersection point with 5 with the grey intersectionpoints of 1, 2, 3, and 4. If it does that, it'll insert 5 at the top. It needs to compare its intersection point with 5 with its current red intersection points with segments 1, 2, 3, and 4. [1]: https://i.sstatic.net/qHqGo.jpg
I think your LineComparator is incorrect as it compares the points where the sweepline initially ran into the segment. The sweepline has swept on in the meanwhile and therefore, while the ordering of the segments on the sweepline has not changed, the actual location of their intersections with the sweepline has moved and you need to account for this when trying to figure out where to insert the new segment in the sweepline.
I think your LineComparator is incorrect as it compares the points where the sweepline initially ran into the segment. The sweepline has swept on in the meanwhile and therefore, while the ordering of the segments on the sweepline has not changed, the actual location of their intersections with the sweepline has moved and you need to account for this when trying to figure out where to insert the new segment in the sweepline.
![illustration of the problem][1]
When the vertical sweepline encounters segment number 5, it shouldn't compare its intersection point with 5 with the grey intersectionpoints of 1, 2, 3, and 4. If it does that, it'll insert 5 at the top. It needs to compare its intersection point with 5 with its current red intersection points with segments 1, 2, 3, and 4. [1]: https://i.sstatic.net/qHqGo.jpg