1

I'm trying to implement Bentley-Ottmann Algorithm according to description found in Mark de Berg, et al. Computational Geometry Algorithms and Applications Third Edition book. There is not clear statement about support of overlapping (collinear and not disjoint) segments, however another degenerate cases described precisely.

From wikipedia I found that there exists implementation that handles all degenerate cases, and it descibed in Bartuschka, U.; Mehlhorn, K.; Näher, S. However it is very hard to understand.

Exactly the same approach provided here. In the subsection 4.3 I found the following:

The basic ingredients of the line sweep algorithm go back to work by Bentley and Ottmann from 1979. The particular formulation discussed here, which takes all possible degeneracies into account, is due to Mehlhorn and Näher.

After thorough investigation of it, I come to conclusion that the only difference is that sweep line going from left to right, but not from top to bottom as in de Berg's book. But I can't understand why this algorithm handles overlapping segments. I want to see some proof why such segments are handled correctly and how are they handled. What should we output as intersection: there is no intersections at all or segments are intersect in infinite number of points?

(I've alrady looked at The Generalization of Bentley-Ottmann Algorithm.)

Plase help me figure out how and why this algorithm handle overlapping segments.

  • IMO, the real challenge when dealing with such special cases are 1) to detect these situations in a way that is numerically meaningful and 2) to decide what to do with those cases (f.i. how to represent an intersection that is not a point ?). These aspects are application-dependent. –  Jan 20 '18 at 13:49
  • @Yves Daoust I've solved the first problem with application of fixed point arithmetic. For the second, I will use this implementation as the basis for implementation another algorithms, so I think the output should be in some general form, where it is possible to obtain all the information (list of intersections, overlappings). Now I'm trying to implement it according to Sneftel's answer, but every time I'm fixing all problems, there appears some unconsidered cases with overlaps where my tests break. It seems there are some details needed to add to book's description of algorithm. –  Jan 20 '18 at 14:47
  • In what way does fixed-point arithmetic make it numerically meaningful ? And "implement it according to Sneftel's answer": Sneftel didn't provide a single solution. Once again, all this is application-dependent. –  Jan 20 '18 at 14:52

1 Answers1

0

Overlapping (by which I assume you mean, collinear and not disjoint) segments aren't that difficult to handle. You have a couple of options.

  • You can merge overlapping segments when you encounter them at an event, treating them as one segment for the purposes of the algorithm.
  • You can decide that overlapping segments don't intersect at all, in which case you don't really have to do anything except filter out those intersections at events. In order to simplify the logic of event handling and locating segments on the sequence, though, it is useful to come up with a canonical order for the segments, such that if two segments are collinear, the order is used to determine which one's on top.
Sneftel
  • 40,271
  • 12
  • 71
  • 104