Add error message for invalid Path point range

As described on the README, "these parameterizations are defined over the domain 0 <= t <= 1". Otherwise, the user gets "Something went wrong" which is not very helpful.
pull/218/head
Andre Vallestero 2023-11-23 22:53:30 -05:00 committed by GitHub
parent fcb648b9bb
commit cd0f80691f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -2573,6 +2573,8 @@ class Path(MutableSequence):
# Shortcuts
if len(self._segments) == 0:
raise ValueError("This path contains no segments!")
if pos < 0.0 or pos > 1.0:
raise ValueError("Pos for Path.point must be between 0 and 1, but was {}".format(pos))
if pos == 0.0:
return self._segments[0].point(pos)
if pos == 1.0: