Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"IndexError: list index out of range" when using negative offset #37

Open
fredpeertje opened this issue May 31, 2021 · 0 comments
Open

Comments

@fredpeertje
Copy link

fredpeertje commented May 31, 2021

When I use a negative offset of say 2 meter in a polygon square that is 2m2 (a small square), an "IndexError: list index out of range" error comes up. Ofcourse I would expect an error message in this situation. However, this invalid input offset is not properly handled.

The code that I use:

import pyclipper

negative_offset = -2
coordinates = # Small polygon of around 2m2
clipper_offset = pyclipper.PyclipperOffset()
coordinates_scaled = pyclipper.scale_to_clipper(coordinates)

clipper_offset.AddPath(coordinates_scaled, pyclipper.JT_ROUND, pyclipper.ET_CLOSEDPOLYGON)

new_coordinates = clipper_offset.Execute(pyclipper.scale_to_clipper(negative_offset))

new_coordinates_scaled = pyclipper.scale_from_clipper(new_coordinates)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant