Skip to content

Commit

Permalink
restrict length
Browse files Browse the repository at this point in the history
  • Loading branch information
tlambert03 committed Jul 8, 2024
1 parent 13ebe62 commit b623130
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/useq/_point_visiting.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ class TraversalOrder(Enum):

def order_points(self, points: np.ndarray, start_at: int = 0) -> np.ndarray:
"""Return the order of points based on the traversal order."""
if len(points) <= 2: # no sense in optimizing
return np.arange(len(points))
start_at = min(start_at, len(points) - 1)
if self == TraversalOrder.NEAREST_NEIGHBOR:
return _nearest_neighbor_order(points, start_at)
Expand Down

0 comments on commit b623130

Please sign in to comment.