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

__getitem__

__init__

Initialize self.

__len__

rtype

int

_find_nearest_in_index

Check the N nearest lines, hopefully find one that is active.

_find_nearest_within_in_index

Find nearest in specific index.

_make_index

rtype

None

_reindex

rtype

None

find_nearest

rtype

Tuple[int, bool]

find_nearest_within

Find the closest line, assuming a maximum admissible distance.

pop

rtype

Optional[ndarray]

pop_front

rtype

ndarray

Attributes

__dict__

__doc__

__module__

__weakref__

list of weak references to the object (if defined)

Methods

LineIndex.__getitem__(item)
LineIndex.__init__(lines, reverse=False)

Initialize self. See help(type(self)) for accurate signature.

LineIndex.__len__()
Return type

int

LineIndex._find_nearest_in_index(p, index)

Check the N nearest lines, hopefully find one that is active.

Return type

Tuple[Optional[int], float]

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.

Return type

Tuple[bool, Optional[int], Optional[float]]

LineIndex._make_index()
Return type

None

LineIndex._reindex()
Return type

None

LineIndex.find_nearest(p)
Return type

Tuple[int, bool]

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

Return type

Tuple[Optional[int], bool]

LineIndex.pop(idx)
Return type

Optional[ndarray]

LineIndex.pop_front()
Return type

ndarray

Attributes

LineIndex.__dict__ = mappingproxy({'__module__': 'vpype.line_index', '__doc__': 'Wrapper to scipy.spatial.cKDTree to facilitate systematic processing of a line\n collection.\n\n Implementation note: we use the `available` bool array because deleting stuff from the\n index is costly.\n ', '__init__': <function LineIndex.__init__>, '_make_index': <function LineIndex._make_index>, '_reindex': <function LineIndex._reindex>, '__len__': <function LineIndex.__len__>, '__getitem__': <function LineIndex.__getitem__>, 'pop_front': <function LineIndex.pop_front>, 'pop': <function LineIndex.pop>, 'find_nearest_within': <function LineIndex.find_nearest_within>, '_find_nearest_within_in_index': <function LineIndex._find_nearest_within_in_index>, 'find_nearest': <function LineIndex.find_nearest>, '_find_nearest_in_index': <function LineIndex._find_nearest_in_index>, '__dict__': <attribute '__dict__' of 'LineIndex' objects>, '__weakref__': <attribute '__weakref__' of 'LineIndex' objects>})
LineIndex.__doc__ = 'Wrapper to scipy.spatial.cKDTree to facilitate systematic processing of a line\n collection.\n\n Implementation note: we use the `available` bool array because deleting stuff from the\n index is costly.\n '
LineIndex.__module__ = 'vpype.line_index'
LineIndex.__weakref__

list of weak references to the object (if defined)