Polygon 无法正确计算非简单多边形(有自交)的面积
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.7k
- Forks
- 182
- PR merge metrics
- No merged PRs in 30d
Description
无法正确计算非简单多边形(有自交)的面积
```python
from cyaron import *
p = Polygon(
[(-3, 4), (1.5, 3), (-6, -2), (-3, -4)]
)
print(p.area()) # output: 3.0
```
如图,显然面积为 $15$。

即使这种情形在应用时不常见,是否应在文档中警告,或者在代码逻辑中加入判断?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the example by calling Polygon.area() with the provided self-intersecting points, then inspect the Polygon.area() entry point and its existing tests, if any. Define the intended behavior for self-intersecting polygons and document or implement that decision; done means the behavior is explicit and the example is covered.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100