Reporting and Counting Intersections Between Two Sets of Line Segments

  • Harry G. Mairson
  • Jorge Stolfi
Part of the NATO ASI Series book series (volume 40)


We consider the problem of computing all intersections between two sets S and T of line segments in the plane, where no two segments in S (similarly, T) intersect. We present an asymptotically optimal algorithm which reports all those intersections in O(n log n + k) time and O(n) space, where n is the total number of line segments, and k is the number of intersections. Our algorithm works also for general arcs of single-valued curves, within the same time bounds. Applications include the intersection of two polygons and the “merge” of two planar maps in time O(n log n + m) and space O(n + m), where n and m are the number of input and output edges, respectively. In the case of straight line segments, a simple modification allows us to count the number of intersections (without reporting them) in time O((n +√ nk)log n) = O(n 1.5log n).


Intersection problems polygon intersection counting intersections segments planar maps plane sweep computational geometry algorithms 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. [1]
    A. V. Aho, J. E. Hopcroft, and J. D. Ullman: The design and analysis of computer algorithms. Addison-Wesley, Reading (1974).zbMATHGoogle Scholar
  2. [2]
    B. G. Baumgart: A polyhedron representation for computer vision. Proc. of the AFIPS National Computer Conference vol. 44 (1975), 589–596.Google Scholar
  3. [3]
    J. L. Bentley and Th. A. Ottman: Algorithms for reporting and counting geometric intersections. IEEE Transactions on Computers, vol. C-28 no. 9 (Sept. 1979), 643–647.CrossRefGoogle Scholar
  4. [4]
    J. L. Bentley and D. Wood: An optimal worst-case algorithm for reporting intersections of rectangles. IEEE Transactions on Computers, vol. C-29 no. 7 (July 1980), 571–577.CrossRefMathSciNetGoogle Scholar
  5. [5]
    B. Chazelle: Reporting and counting arbitrary planar intersections. Technical Report CS-83-16, Department of Computer Science, Brown University (June 1983). Submitted to the Journal of Algorithms.Google Scholar
  6. [6]
    D. P. Dobkin: Personal communication.Google Scholar
  7. [7]
    D. Greene and F. Frances Yao: Finite-resolution computational geometry. Manuscript (1986).Google Scholar
  8. [8]
    L. J. Guibas and J. B. Saxe: Problem 80-15: Computing the connected components of a collection of rectangles. Journal of algorithms vol. 1 (1980), 212, and vol. 4 (1983), 177–181.Google Scholar
  9. [9]
    L. J. Guibas and R. Seidel: Computing convolutions by reciprocal search. Proc. 2nd ACM Symp. on Computational Geometry (1986), 90–99.Google Scholar
  10. [10]
    L. J. Guibas and M. Sharir: Computing the unbounded component of an arrangement of line segments. Manuscript (Jan. 1987).Google Scholar
  11. [11]
    L. J. Guibas and J. Stolfi: Notes on computational geometry. CS445 lecture notes, CS Department, Stanford University (Winter 1982).Google Scholar
  12. [12]
    D. E. Knuth: The Art of Computer Programming, vol I: Fundamental Algorithms (2nd edition). Addison-Wesley (1973).Google Scholar
  13. [13]
    H. G. Mairson: Reporting line segment intersections. Manuscript (1981).Google Scholar
  14. [14]
    E. M. McCreight: Efficient algorithms for enumerating intersecting intervals and, rectangles. Report CSL 80–9, Xerox Palo Alto Research Center (June 1980).Google Scholar
  15. [15]
    S. Mowchenko: Ph. D. Thesis. Department of Electrical Engineering, University of Waterloo, Ontario, Canada.Google Scholar
  16. [16]
    D. E. Muller and F. P. Preparata: Finding the intersection of two convex poly-hedra. Theoretical Computer Science vol. 7 (1978), 217–236.CrossRefzbMATHMathSciNetGoogle Scholar
  17. [17]
    J. Nievergelt and F. P. Preparata: Plane-sweep algorithms for intersecting geo metric figures. Communications of the ACM vol. 25 no. 10 (Oct. 1982), 739–747.CrossRefzbMATHGoogle Scholar
  18. [18]
    E. M. Reingold: On the optimality of some set algorithms. Journal of the ACM vol. 19 no. 4 (Oct. 1972), 649–659.CrossRefzbMATHMathSciNetGoogle Scholar
  19. [19]
    M. I. Shamos and D. Hoey: Geometric intersection problems. Proc. of the 17th IEEE Symp. on Foundations of Computer Science (1976), 208–215.Google Scholar
  20. [20]
    D. D. Sleator and R. E. Tarjan: Self-adjusting binary trees. Proc. of the 15th ACM Symp. on Theory of Computing (1983), 235–245.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1988

Authors and Affiliations

  • Harry G. Mairson
    • 1
  • Jorge Stolfi
    • 2
  1. 1.Department of Computer ScienceBrandeis UniversityWalthamUSA
  2. 2.Stanford University and DEC Systems Research CenterPalo AltoUSA

Personalised recommendations