<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p>Hello,</p>
<p>Yes, I have implemented this algorithm in python (processing). In
my memories, my other template was a <a moz-do-not-send="true"
href="http://dwoll.de/rexrepos/posts/diagBounding.html">R source
code</a>.<br>
</p>
Regards.<br>
<br>
<br>
<br>
<div class="moz-cite-prefix">Le 08.06.2017 à 09:21, Havard Tveite a
écrit :<br>
</div>
<blockquote type="cite"
cite="mid:18f32017-8d86-68bf-05b1-f58f4db5de41@nmbu.no">The
QgsGeometry::orientedMinimumBoundingBox seems to implement
<br>
the rotating calipers method. If it does, it should produce
<br>
the correct minimum bounding rectangle.
<br>
(<a class="moz-txt-link-freetext" href="http://en.wikipedia.org/wiki/Minimum_bounding_box_algorithms">http://en.wikipedia.org/wiki/Minimum_bounding_box_algorithms</a>)
<br>
<br>
Håvard
<br>
<br>
On 08. juni 2017 01:18, Nyall Dawson wrote:
<br>
<blockquote type="cite">On 6 June 2017 at 18:43, Paul Jobling
<a class="moz-txt-link-rfc2396E" href="mailto:paul.jobling@gmail.com"><paul.jobling@gmail.com></a> wrote:
<br>
<br>
<blockquote type="cite">I am implementing geo in the Kognitio
WX2 database using GEOS as a backend,
<br>
though I am using my own code for many things. One of those
things is
<br>
ST_MinimumRectangle, which I have implemented as the rectangle
with the
<br>
smallest area that encloses the geometry. This is different to
the
<br>
implementation that I see you have recently added, which
extrapolates from
<br>
the MinimumDiameter property.
<br>
<br>
<br>
<br>
For example, ST_MinimumRectangle ('POLYGON((1 2, 3 0, 5 2, 3
2, 2 3, 1 2))')
<br>
has an area of 9.6 (and a perimeter of 12.65) using the
MinimumDiameter
<br>
implementation, whereas my implementation finds the actual
minimum – with an
<br>
area of 8 (and perimeter of 11.31) - it is POLYGON ((5 2, 3 0,
1 2, 3 4, 5
<br>
2)) rather than POLYGON((1.4 3.2, 0.6 0.8, 4.2 -0.4,5 2, 1.4
3.2)).
<br>
<br>
<br>
<br>
My question is why has this implementation been decided on –
is it just that
<br>
MimimumDiameter is already present? Or is there some other
reason due to
<br>
some standard?
<br>
</blockquote>
<br>
Did you mean to post this to the GEOS mailing lists instead?
<br>
<br>
Anyway, some background from QGIS' perspective. A while ago I
was
<br>
looking for a minimum rect implementation, so ported JTS'
<br>
implementation over to GEOS. I then exposed this to the
QgsGeometry
<br>
API, but to my suprise found that the results were not ideal. At
the
<br>
time there was some python code in processing which performed a
MBR
<br>
calculation, and I found that the area of rectangles calculated
by
<br>
this python code was smaller then JTS' algorithm. Additionally,
I
<br>
thought it created subjectively 'more aesthetically pleasing'
<br>
rectangles (when used as atlas feature extents, and also output
the
<br>
angle/width/height of these rectangles (the GEOS implementation
<br>
doesn't expose this). So I ported the Python code over to c++ as
<br>
QgsGeometry::orientedMinimumBoundingBox and updated the
processing alg
<br>
to use this c++ method instead. The guts of this algorithm sits
in
<br>
<a class="moz-txt-link-freetext" href="https://github.com/qgis/QGIS/blob/master/src/core/geometry/qgsgeometry.cpp#L890">https://github.com/qgis/QGIS/blob/master/src/core/geometry/qgsgeometry.cpp#L890</a>
<br>
.
<br>
<br>
Does that clarify?
<br>
<br>
Nyall
<br>
_______________________________________________
<br>
QGIS-Developer mailing list
<br>
<a class="moz-txt-link-abbreviated" href="mailto:QGIS-Developer@lists.osgeo.org">QGIS-Developer@lists.osgeo.org</a>
<br>
List info:
<a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-developer">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a>
<br>
Unsubscribe:
<a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-developer">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a>
<br>
<br>
</blockquote>
<br>
</blockquote>
<br>
</body>
</html>