return error if Path.point() cannot be computed

pull/207/head
Andrew Port 2023-05-20 13:20:05 -04:00
parent 229773ff9d
commit b282094b53
1 changed files with 2 additions and 1 deletions

View File

@ -2572,7 +2572,7 @@ class Path(MutableSequence):
# Shortcuts
if len(self._segments) == 0:
return None
raise ValueError("This path contains no segments!")
if pos == 0.0:
return self._segments[0].point(pos)
if pos == 1.0:
@ -2589,6 +2589,7 @@ class Path(MutableSequence):
segment_end - segment_start)
return segment.point(segment_pos)
segment_start = segment_end
raise RuntimeError("Something has gone wrong. Could not compute Path.point({}) for path {}".format(pos, self))
def length(self, T0=0, T1=1, error=LENGTH_ERROR, min_depth=LENGTH_MIN_DEPTH):
self._calc_lengths(error=error, min_depth=min_depth)