

We consider paths in the 2D square grid, composed of grid edges, given as a sequence of moves in the four cardinal compass directions, without U-turns, but possibly passing several times through the same vertex or the same edge (if the path is open, it cannot pass twice through its starting vertex). We propose an algorithm which reports a self-crossing if there is one, or otherwise draws the path without self-crossings. The algorithm follows the intuitive idea naturally applied by humans to draw a curve: at each vertex that has already been visited, it tries to insert two new segments in such a way that they do not cross the existing ones. If this is not possible, a self-crossing is reported. This procedure is supported by a data structure combining a doubly-linked circular list and a skip list. The time and space complexity is linear in the length of the path. © 2023 Elsevier Ltd
| Engineering uncontrolled terms | Digital curveDigital geometryDigital topologyFree pathSelf-crossingSelf-crossing pathSkip listesSquare gridTime and space complexity |
|---|---|
| Funding sponsor | Funding number | Acronym |
|---|---|---|
| 451-03-47/2023-01/200156 |
This research (paper) has been supported by the Ministry of Science, Technological Development and Innovation through project no. 451-03-47/2023-01/200156 “Innovative scientific and artistic research from the FTS (activity) domain”.
Magillo, P.; Faculty of Technical Sciences, University of Novi Sad, Novi Sad, Serbia;
© Copyright 2023 Elsevier B.V., All rights reserved.