Boost C++ Libraries: Ticket #4868: Boost::Polygon Polygon Concept contains function https://svn.boost.org/trac10/ticket/4868 <p> bool Boost::Polygon::contains(const T&amp;, const point_type&amp; point, bool consider_touch=true) functions doesn't give right answer when type is Polygon. Example: Point pts[] = {gtl::construct&lt;Point&gt;(1565, 5735), </p> <blockquote> <p> gtl::construct&lt;Point&gt;(915, 5735), gtl::construct&lt;Point&gt;(915, 7085), gtl::construct&lt;Point&gt;(1565, 7085) }; </p> </blockquote> <p> Polygon poly; gtl::set_points(poly, pts, pts+4); bool ret=gtl::contains(poly,gtl::construct&lt;Point&gt;(920, 7080)); </p> <p> The result must be true. But it is false. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/4868 Trac 1.4.3 Lucanus Simonson Tue, 30 Nov 2010 17:57:35 GMT status, milestone changed; resolution set https://svn.boost.org/trac10/ticket/4868#comment:1 https://svn.boost.org/trac10/ticket/4868#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.46.0</span> </li> </ul> <p> The problem was that in the manhattan version of contains the algorithm assumed counter clockwise winding for the polygon. This mean that clockwise polygons gave inverted result for their interior. The fix is the check the winding of the polygon and invert the result if clockwise in the case where the point wasn't on the boundary. </p> Ticket