Creating a polygon with no area or an invalid area should throw an error [LUCENE-8850]
- Dominant language
- Java
- Stars
- 3.6k
- Forks
- 1.4k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 88
Description
Working with some polygon data which has some data quality issues I found two cases where we can throw an error as we know the polygon is invalid,
1) We are already computing the signed area on the Polygon constructor, therefore if the value is 0, then we know we are building a polygon with no area and therefore we can throw an error as it is an invalid polygon.
2) We can calculate the total area of the polygon and holes, if the area is lower or equal than 0, then the holes are equal or bigger than the polygon which it is an invalid polygon.
In addition I propose anew method to calculate the signed area which requires less arithmetic calculations and therefore it introduces less numerical errors.
---
Migrated from [LUCENE-8850](https://issues.apache.org/jira/browse/LUCENE-8850) by Ignacio Vera (@iverase), updated Jul 01 2019
Contributor guide
Research direction
Start by locating the Polygon constructor and its existing signed-area calculation. Review how polygon and hole areas are represented, then determine where invalid zero or non-positive total areas should be rejected and how the proposed signed-area calculation fits. Done means invalid polygons throw an error without introducing numerical regressions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- search
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100