id summary reporter owner description type status milestone component version severity resolution keywords cc 6366 "Bug in ""boost::polygon::contains"" for polygon_90 type" sebastien.mirabel@… Andrii Sydorchuk "For a polygon ((0,0) (10,0) (10,10) (0,10)) the function ""contains"" returns true for (15,5) whereas it should return true {{{ #include #include #include namespace gtl = boost::polygon; using namespace boost::polygon::operators; int main() { //lets construct a 10x10 rectangle shaped polygon typedef gtl::polygon_90_data Polygon; typedef gtl::polygon_traits_90::point_type Point; Point pts[] = { gtl::construct(0, 0), gtl::construct(10, 0), gtl::construct(10, 10), gtl::construct(0, 10)}; Polygon poly; gtl::set_points(poly, pts, pts+4); Point point = gtl::construct(15, 5); { // Wrong result here : bool result = gtl::contains(poly, point); std::cout << std::boolalpha << result << std::endl; } //assert(!gtl::contains(poly, point)); //assert(!gtl::contains(poly, gtl::construct(15, 5))); return 0; } }}} The bugs seems to come from line 1176 of ""boost\polygon\polygon_traits.hpp"" : {{{ //an odd number of edges to the left implies interior pt return counts[winding(polygon) == COUNTERCLOCKWISE ? 0 : 1] % 4 != 0; }}} There is ""% 4"" whereas the previous comment indicate ""an odd number of edges"" (this logicaly should be ""% 2"") " Bugs closed Boost 1.57.0 polygon Boost 1.51.0 Problem fixed sebastien.mirabel@…