Re: [Boost-bugs] [Boost C++ Libraries] #6366: Bug in "boost::polygon::contains" for polygon_90 type

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #6366: Bug in "boost::polygon::contains" for polygon_90 type
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-10-29 01:05:16


#6366: Bug in "boost::polygon::contains" for polygon_90 type
------------------------------------------+---------------------------------
  Reporter: sebastien.mirabel@… | Owner: ljsimons
      Type: Bugs | Status: reopened
 Milestone: To Be Determined | Component: polygon
   Version: Boost 1.51.0 | Severity: Problem
Resolution: | Keywords:
------------------------------------------+---------------------------------
Changes (by sebastien.mirabel@…):

  * status: closed => reopened
  * version: Boost 1.48.0 => Boost 1.51.0
  * resolution: fixed =>

Comment:

 The bug is still there in 1.51 and in trunk. The bug fixed "a long time
 ago" is probably an other one with similar behaviour.

 Here is a program that show more obviously the bug:

 {{{

 #include <boost/polygon/polygon.hpp>

 #include <cassert>
 #include <iostream>

 namespace gtl = boost::polygon;
 using namespace boost::polygon::operators;

 int main() {
     typedef gtl::polygon_90_data<int> Polygon;
     typedef gtl::polygon_traits_90<Polygon>::point_type Point;
     //lets construct a 10x10 rectangle shaped polygon
     Point pts1[] = {
         gtl::construct<Point>(0, 0),
         gtl::construct<Point>(10, 0),
         gtl::construct<Point>(10, 10),
         gtl::construct<Point>(0, 10)
     };

     Point pts2[] = {
         gtl::construct<Point>(0, 10),
         gtl::construct<Point>(10, 10),
         gtl::construct<Point>(10, 0),
         gtl::construct<Point>(0, 0)
     };

     Polygon poly1;
     gtl::set_points(poly1, pts1, pts1+4);
     Polygon poly2;
     gtl::set_points(poly2, pts2, pts2+4);

     Point point1 = gtl::construct<Point>(15, 5);
     Point point2 = gtl::construct<Point>(5, 5);

     {
         bool result;
         result = gtl::contains(poly1, point1);
         std::cout << "15,5 in poly1 " << std::boolalpha << result <<
 std::endl;

         result = gtl::contains(poly1, point2);
         std::cout << " 5,5 in poly1 " << std::boolalpha << result <<
 std::endl;

         result = gtl::contains(poly2, point1);
         std::cout << "15,5 in poly2 " << std::boolalpha << result <<
 std::endl;

         result = gtl::contains(poly2, point2);
         std::cout << " 5,5 in poly2 " << std::boolalpha << result <<
 std::endl;
     }
     return 0;
 }

 }}}

 Output:
 {{{
 15,5 in poly1 true
  5,5 in poly1 true
 15,5 in poly2 false
  5,5 in poly2 true
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/6366#comment:2>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:11 UTC