Skip to content
This repository has been archived by the owner on Feb 3, 2023. It is now read-only.

Commit

Permalink
Clean up reindexed() (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmelnikow authored Mar 24, 2019
1 parent c35c0af commit d034d82
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions blmath/geometry/primitives/polyline.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,13 @@ def reindexed(self, index, ret_edge_mapping=False):
indices to new.
'''
if not self.closed:
raise ValueError("Can't rotate an open polyline")
raise ValueError("Can't reindex an open polyline")

rotated_v = np.append(
self.v[index:], self.v[0:index], axis=0
result = Polyline(
v=np.append(self.v[index:], self.v[0:index], axis=0),
closed=True
)
result = Polyline(v=rotated_v, closed=True)

if ret_edge_mapping:
edge_mapping = np.append(
np.arange(index, len(self.v)),
Expand Down

0 comments on commit d034d82

Please sign in to comment.