Opened 10 years ago

Closed 10 years ago

#3083 closed enhancement (invalid)

Add ST_MinimumDiameter() from GEOS

Reported by: sfkeller Owned by: pramsey
Priority: low Milestone: PostGIS 2.2.0
Component: postgis Version: master
Keywords: Cc:

Description

ST_MinimumDiameter() is a function in GEOS[*] obviously not yet made available in PostGIS.

[*] http://geos.refractions.net/ro/doxygen_docs/html/classgeos_1_1algorithm_1_1MinimumDiameter.html

Change History (4)

comment:1 by robe, 10 years ago

Bruce and I asked this about 6 years ago before Bruce created ST_MinimumBoundingCircle as he thought it would be useful for building ST_MinimumBoundingCircle.

Martin responded. Here is the thread:

http://lists.osgeo.org/pipermail/geos-devel/2009-January/003861.html and key elements of it:


Bruce Rindahl wrote:

I just looked at MinimumDiameter.cpp and the code does the same thing as the first part of my code linked by Regina. This would be nice to have except for one thing - it may not work. It calls distancePerpendicular which I couldn't find. If this finds the point furthest from the /extended/ line segment and uses this to compute the diameter it is the same method as I used - rotate the geometry so the segment is horizontal and compute the bounding box. I can provide you with a geometry where this algorithm fails. Lee Meilleur can also provide a counter example. Because of this I changed my code to test every point pair for the Minimum Diameter. Bruce Rindahl

Martin Davis wrote:

Yes, this is computing the same thing as the Minimum Bounding Circle algorithm. This algorithm appeared in JTS for some reason which is lost in the mists of time. AFAIK it's never really been used or tested extensively. It probably postdated the initial port of GEOS, and I guess nobody went looking for it until now…

Obe, Regina wrote:

I was snooping around the GEOS library and noticed a curious algorithm class called MinimumDiameter. As far as I can tell from scanning the code, it seems similar in concept to the the Minimum Bounding Circle plpgsql algorithm that Bruce posted in November


Anyway there is a reason we didn't expose it, not sure if that reason is still relevant:

strk you know if this function is still broken?

comment:2 by sfkeller, 10 years ago

Ok. What I'm actually looking for, is a function which takes a geometry and computes its oriented bbox, that is the minimal area rectangle containing the geom.

Here's a pl/pgsql prototype implementation: https://github.com/Remi-C/PPPP_utilities/blob/6e9e8524812961b013b899466fe833dfa5d926e9/postgis/rc_oriented_bbox_deom_axis.sql

comment:3 by pramsey, 10 years ago

Milestone: PostGIS 2.2.0
Version: 2.1.xtrunk

I don't think the GEOS code is going to be much help for a minimum bounding rectangle. However, the http://en.wikipedia.org/wiki/Rotating_calipers could provide a relatively easy basis to get such a thing.

comment:4 by pramsey, 10 years ago

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.