Ticket #10823: ticket_10823.cpp

File ticket_10823.cpp, 640 bytes (added by mkaravel, 8 years ago)

File showing the validity of the correctly defined polygon

Line 
1#include <boost/assert.hpp>
2#include <boost/geometry.hpp>
3
4#include <boost/geometry/geometries/point_xy.hpp>
5
6typedef boost::geometry::model::d2::point_xy<float> point_type;
7typedef boost::geometry::model::polygon<point_type> polygon_type;
8
9int main()
10{
11 polygon_type p_valid, p_invalid;
12 boost::geometry::read_wkt("POLYGON((0 3,3 3,3 1,2 1,2 2,1 2,\
13 1 1,2 1,2 0,0 0,0 3))", p_invalid);
14
15 BOOST_ASSERT(! boost::geometry::is_valid(p_invalid));
16
17 boost::geometry::read_wkt("POLYGON((0 3,3 3,3 1,2 1,2 0,0 0,0 3),\
18 (2 1,2 2,1 2,1 1,2 1))", p_valid);
19
20 BOOST_ASSERT(boost::geometry::is_valid(p_valid));
21
22 return 0;
23}