1 | #include <boost/polygon/polygon.hpp>
|
---|
2 |
|
---|
3 | #include <cassert>
|
---|
4 | #include <iostream>
|
---|
5 |
|
---|
6 | namespace gtl = boost::polygon;
|
---|
7 | using namespace boost::polygon::operators;
|
---|
8 |
|
---|
9 | int main() {
|
---|
10 | //lets construct a 10x10 rectangle shaped polygon
|
---|
11 | typedef gtl::polygon_90_data<int> Polygon;
|
---|
12 | typedef gtl::polygon_traits_90<Polygon>::point_type Point;
|
---|
13 | Point pts[] = {
|
---|
14 | gtl::construct<Point>(0, 0),
|
---|
15 | gtl::construct<Point>(10, 0),
|
---|
16 | gtl::construct<Point>(10, 10),
|
---|
17 | gtl::construct<Point>(0, 10)};
|
---|
18 | Polygon poly;
|
---|
19 | gtl::set_points(poly, pts, pts+4);
|
---|
20 |
|
---|
21 | Point point = gtl::construct<Point>(15, 5);
|
---|
22 | {
|
---|
23 | // Wrong result here :
|
---|
24 | bool result = gtl::contains(poly, point);
|
---|
25 | std::cout << std::boolalpha << result << std::endl;
|
---|
26 | }
|
---|
27 | //assert(!gtl::contains(poly, point));
|
---|
28 | //assert(!gtl::contains(poly, gtl::construct<Point>(15, 5)));
|
---|
29 | return 0;
|
---|
30 | }
|
---|