compas-dev / compas-dev/compas
Polygon.centroid()
- Dominant language
- Python
- Stars
- 386
- Forks
- 122
- Avg merge
- 11d 46m
- Merged PRs (30d)
- 1
Description
**Describe the bug**
`Polygon.centroid` returns a strange value for a polygon with 4 points that is self interesecting (see image),

Using the same points (of the polygon), but cycled differently we get a polygon that is more conventional...

**To Reproduce**
Steps to reproduce the behavior:
1. Python script:
```
from compas.geometry.primitives import Polygon, Point
polygon1 = Polygon([Point(0.000, -5.536, 1977.967), Point(0.000, 144.352, -0.000), Point(0.000, -148.968, -0.000), Point(0.000, 264.624, 1977.967)])
polygon2 = Polygon([Point(0.000, 144.352, -0.000), Point(0.000, 264.624, 1977.967), Point(0.000, -5.536, 1977.967), Point(0.000, -148.968, -0.000)])
print(polygon1.centroid)
print(polygon2.centroid)
```
```
>>>>Point(0.000, -471.050, -7031.803)
>>>>Point(0.000, 62.715, 975.434)
```
**Expected behavior**
I would expect them to have the same centroid.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: Windows
- Python version 3.8.6
- Python package manager conda
- Compas version 1.0.0
Contributor guide
Assessment
This issue has not been assessed yet.