LineIndex¶
-
class
LineIndex
(lines, reverse=False)¶ Wrapper to scipy.spatial.cKDTree to facilitate systematic processing of a line collection.
Implementation note: we use the available bool array because deleting stuff from the index is costly.
Methods
Initialize self.
- rtype
Check the N nearest lines, hopefully find one that is active.
Find nearest in specific index.
- rtype
- rtype
Find the closest line, assuming a maximum admissible distance.
- rtype
Optional
[ndarray
]
- rtype
ndarray
Methods¶
-
LineIndex.
__getitem__
(item)¶
-
LineIndex.
__init__
(lines, reverse=False)¶ Initialize self. See help(type(self)) for accurate signature.
-
LineIndex.
_find_nearest_in_index
(p, index)¶ Check the N nearest lines, hopefully find one that is active.
-
LineIndex.
_find_nearest_within_in_index
(p, max_dist, index)¶ Find nearest in specific index. Return (reindex, idx, dist) tuple, where reindex indicates if a reindex is needed.
-
LineIndex.
find_nearest_within
(p, max_dist)¶ Find the closest line, assuming a maximum admissible distance. Returns a tuple of (idx, reverse), where idx may be None if nothing is found. reverse indicates whether or not a line ending has been matched instead of a start. False is always returned if index was created with reverse=False.s
-
LineIndex.
pop_front
()¶ - Return type
ndarray