"compas.geometry.Polygon" and "Plotter.draw_polygons"

When using Polygon from compas.geometry, how should the points be sorted in the input?

I also have problems inputting my polygon points in “Plotter.draw_polygons”, the instructions are not clear. Could you please provide an example?

hi,

the polygon points should be provided to the constructor in the order as they appear in the polygon. the following is a square in the first quadrant of the coordinate system, formed in counter-clockwise direction.

polygon = Polygon([[0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0]])

as per the docs, the draw_polygons method takes one positional argument, which is a list of dict. each dict should at least contain the coordinates of the points of the polygon

plotter = Plotter()
plotter.draw_polygons([{'points': polygon.points}])
plotter.show()

however, i had never used the polygons directly with the plotters. when i tried the code above i got the error described in issue #41. this is now solved with the corresponding hotfix…

hope this helps.

best,
tom

Thanks for the correction. I had the input the same way, but kept getting errors.