You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The compas.geometry.offset_polygon() returns TypeError when the parameter polygon is provided a Polygon instance
To Reproduce
Running this script with Python 3.11
fromcompas.geometryimportPolygonfromcompas.geometryimportoffset_polygonpts= [[0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0]]
polygon=Polygon(pts)
offset_polygon(pts, 0.1) # this worksoffset_polygon(polygon, 0.1) # this is not working
returns
Traceback (most recent call last):
File "/PATH/TO/SCRIPTS/offset.py", line 7, in <module>
offset_polygon(polygon, 0.1)
File "/opt/homebrew/Caskroom/miniconda/base/envs/ENV_NAME/lib/python3.11/site-packages/compas/geometry/offset/offset.py", line 147, in offset_polygon
polygon = polygon + polygon[:1]
~~~~~~~~^~~~~~~~~~~~~
TypeError: unsupported operand type(s) for +: 'Polygon' and 'list'
Expected behavior
As the doc implies, the polygon parameter should accept sequence[point] | [Polygon]
Desktop (please complete the following information):
OS: macOS 14.1.1
Python version: 3.11.6
Python package manager: conda
compas version: 1.17.9
The text was updated successfully, but these errors were encountered:
Also, the docs said that it returns a list where the first and last coordinates are identical. This is not the case when I run the script, and it returns 4 pts instead.
IMO this is a better behavior as it is consistent with the input.
Describe the bug
The
compas.geometry.offset_polygon()
returnsTypeError
when the parameterpolygon
is provided aPolygon
instanceTo Reproduce
Running this script with Python 3.11
returns
Expected behavior
As the doc implies, the
polygon
parameter should acceptsequence[point] | [Polygon]
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: