locationtech / locationtech/jts
MinimumDiameter.minimumRectangle result is incorrect
Open
@dr-jts is already working on this.
Since Sep 15, 2022.
jts-core
type-bug
- Dominant language
- Java
- Stars
- 2.2k
- Forks
- 475
- Avg merge
- 14d 10h
- Merged PRs (30d)
- 1
Description
As reported in https://github.com/libgeos/geos/issues/679, the result computed by the MinimumDiameter.minimumRectangle method is not always correct. This is because the algorithm assumes the minimum diameter is also the height of the minimum-area rectangle. But this is not always the case, since the perpendicular to the diameter may be long enough that another rectangle is smaller in area.
A reproducer is:
POLYGON ((150 300, 200 300, 300 300, 300 250, 280 120, 210 100, 100 100, 100 240, 150 300))

The fix is to create a new MinimumRectangle class using the classic Rotating Calipers algorithm.
Contributor guide
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.
Assessment
This issue has not been assessed yet.