1 // Boost.Polygon library polygon_rectangle_formation_test.cpp file
3 // Copyright Andrii Sydorchuk 2015.
4 // Distributed under the Boost Software License, Version 1.0.
5 // (See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
8 // See http://www.boost.org for updates, documentation, and revision history.
10 #include <boost/core/lightweight_test.hpp>
11 #include <boost/polygon/polygon.hpp>
13 using namespace boost::polygon
;
15 void rectangle_formation_test1()
17 typedef polygon_90_with_holes_data
<int> polygon_type
;
18 typedef polygon_traits
<polygon_type
>::point_type point_type
;
21 point_type points
[] = {
22 boost::polygon::construct
<point_type
>(0, 0),
23 boost::polygon::construct
<point_type
>(0, 10),
24 boost::polygon::construct
<point_type
>(10, 10),
25 boost::polygon::construct
<point_type
>(10, 0),
27 boost::polygon::set_points(poly
, points
, points
+ 4);
29 std::vector
< rectangle_data
<int> > rects
;
30 boost::polygon::get_rectangles(rects
, poly
);
32 BOOST_TEST_EQ(1, rects
.size());
33 const rectangle_data
<int>& rect
= rects
[0];
34 BOOST_TEST_EQ(0, rect
.get(WEST
));
35 BOOST_TEST_EQ(10, rect
.get(EAST
));
36 BOOST_TEST_EQ(10, rect
.get(NORTH
));
37 BOOST_TEST_EQ(0, rect
.get(SOUTH
));
42 rectangle_formation_test1();
43 return boost::report_errors();