locationtech / jts

The JTS Topology Suite is a Java library for creating and manipulating vector geometry.
Other
1.94k stars 442 forks source link

Add MinimumAreaRectangle #977

Closed dr-jts closed 1 year ago

dr-jts commented 1 year ago

To address https://github.com/libgeos/geos/issues/679 (see #907), this adds a MinimumAreaRectangle class implementing the standard "rotating-calipers` algorithm for computing a Minimum-Area Rectangle.

MinimumDiameter.getMinimumRectangle was previously used for this, but it does not always compute the Minimum-Area Rectangle. It is kept available, for backwards compatibility. Also, it computes the Minimum-Width Rectangle, which may be useful.

image

willcohen commented 6 months ago

@pramsey and @dr-jts Just want to say thank you for this -- this has been quite useful as I work on determining a first pass for regularizing city parcel boundaries to determine depth and width when they're rectangular-ish.