Boost C++ Libraries: Ticket #10562: Wrong number of Points returned by convex_hull() https://svn.boost.org/trac10/ticket/10562 <p> If a valid Polygon is generated by a convex_hull() function, the Points of a closed Polygon are always returned (duplicated first Point at the end of a Range), even if an open Polygon is passed as the output. </p> <p> Example: </p> <pre class="wiki"> namespace bg = boost::geometry; typedef bg::model::point&lt;double, 2, bg::cs::cartesian&gt; point; typedef bg::model::polygon&lt;point, true, false&gt; polygon; typedef bg::model::polygon&lt;point, true, true&gt; polygon_closed; typedef bg::model::multi_point&lt;point&gt; multi_point; multi_point mp; bg::append(mp, point(1, 1)); bg::append(mp, point(2, 2)); bg::append(mp, point(2, 1)); bg::append(mp, point(1, 2)); polygon res; polygon_closed res_c; bg::convex_hull(mp, res); std::cout &lt;&lt; bg::closure&lt;polygon&gt;::value &lt;&lt; std::endl; std::cout &lt;&lt; res.outer().size() &lt;&lt; std::endl; std::cout &lt;&lt; bg::wkt(res) &lt;&lt; std::endl; bg::convex_hull(mp, res_c); std::cout &lt;&lt; bg::closure&lt;polygon_closed&gt;::value &lt;&lt; std::endl; std::cout &lt;&lt; res_c.outer().size() &lt;&lt; std::endl; std::cout &lt;&lt; bg::wkt(res_c) &lt;&lt; std::endl; </pre><p> Output: </p> <pre class="wiki">0 5 POLYGON((1 1,1 2,2 2,2 1,1 1)) 1 5 POLYGON((1 1,1 2,2 2,2 1,1 1)) </pre><p> On the other hand when an invalid Polygon is generated, a convex hull of a 1-Point <a class="missing wiki">MultiPoint</a> or 2-Point Linestring always 3-Point Polygon is generated. The smallest number of Points of a valid, closed Polygon should be 4. The generated Polygon isn't valid but the number of Points could be consistent. </p> <p> Example: </p> <pre class="wiki"> multi_point mp; bg::append(mp, point(1, 1)); </pre><p> Output: </p> <pre class="wiki">0 3 POLYGON((1 1,1 1,1 1)) </pre><p> Example: </p> <pre class="wiki"> multi_point mp; bg::append(mp, point(1, 1)); bg::append(mp, point(2, 2)); </pre><p> Output: </p> <pre class="wiki">0 3 POLYGON((1 1,2 2,1 1)) </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/10562 Trac 1.4.3 awulkiew Wed, 05 Nov 2014 14:40:43 GMT status, milestone changed; resolution set https://svn.boost.org/trac10/ticket/10562#comment:1 https://svn.boost.org/trac10/ticket/10562#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.57.0</span> </li> </ul> Ticket