A Linear Time and Space Algorithm for Detecting Path Intersection
For discrete sets coded by the Freeman chain describing their contour, several linear algorithms have been designed for determining their shape properties. Most of them are based on the assumption that the boundary word forms a closed and non-intersecting discrete curve. In this article, we provide a linear time and space algorithm for deciding whether a path on a square lattice intersects itself. This work removes a drawback by determining efficiently whether a given path forms the contour of a discrete figure. This is achieved by using a radix tree structure over a quadtree, where nodes are the visited grid points, enriched with neighborhood links that are essential for obtaining linearity.
KeywordsFreeman code lattice paths self-intersection radix tree discrete figures data structure
- 2.Freeman, H.: Boundary encoding and processing. In: Lipkin, B., Rosenfeld, A. (eds.) Picture Processing and Psychopictorics, pp. 241–266. Academic Press, New York (1970)Google Scholar
- 9.Provençal, X.: Combinatoire des mots, géométrie discrète et pavages. PhD thesis, D1715, Université du Québec à Montréal (2008)Google Scholar
- 13.Labbé, S.: Personal communication (2009)Google Scholar