| 1 | #include <boost/polygon/polygon.hpp>
|
|---|
| 2 | #include <stdint.h>
|
|---|
| 3 | #include <assert.h>
|
|---|
| 4 | #include <limits>
|
|---|
| 5 |
|
|---|
| 6 | namespace bp = boost::polygon;
|
|---|
| 7 |
|
|---|
| 8 | typedef int32_t Coord;
|
|---|
| 9 | typedef bp::polygon_set_data<Coord> PSet;
|
|---|
| 10 | typedef bp::rectangle_data<Coord> Rect;
|
|---|
| 11 |
|
|---|
| 12 | int
|
|---|
| 13 | main()
|
|---|
| 14 | {
|
|---|
| 15 | using namespace bp::operators;
|
|---|
| 16 |
|
|---|
| 17 | PSet ps1;
|
|---|
| 18 | ps1.insert(Rect(0, 0, 1, 1));
|
|---|
| 19 |
|
|---|
| 20 | Coord low = std::numeric_limits<Coord>::min();
|
|---|
| 21 | Coord high = std::numeric_limits<Coord>::max(); // fails
|
|---|
| 22 |
|
|---|
| 23 | //Coord high = std::numeric_limits<Coord>::max()-100; // also fails
|
|---|
| 24 | //Coord high = std::numeric_limits<Coord>::max()/2; // works
|
|---|
| 25 |
|
|---|
| 26 | PSet ps2 = ps1 & Rect(low, low, high, high);
|
|---|
| 27 | assert(ps1 == ps2);
|
|---|
| 28 | }
|
|---|