1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2 //
3 // Copyright (c) 2012-2015 Barend Gehrels, Amsterdam, the Netherlands.
4
5 // This file was modified by Oracle on 2013, 2014. 2015.
6 // Modifications copyright (c) 2013-2015, Oracle and/or its affiliates.
7
8 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
9
10 // Use, modification and distribution is subject to the Boost Software License,
11 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
12 // http://www.boost.org/LICENSE_1_0.txt)
13
14 #include "test_touches.hpp"
15
16 template <typename P>
test_all()17 void test_all()
18 {
19 typedef bg::model::polygon<P> polygon;
20
21 // Just a normal polygon
22 test_self_touches<polygon>("POLYGON((0 0,0 4,1.5 2.5,2.5 1.5,4 0,0 0))", false);
23
24 // Self intersecting
25 test_self_touches<polygon>("POLYGON((1 2,1 1,2 1,2 2.25,3 2.25,3 0,0 0,0 3,3 3,2.75 2,1 2))", false);
26
27 // Self touching at a point
28 test_self_touches<polygon>("POLYGON((0 0,0 3,2 3,2 2,1 2,1 1,2 1,2 2,3 2,3 0,0 0))", true);
29
30 // Self touching at a segment
31 test_self_touches<polygon>("POLYGON((0 0,0 3,2 3,2 2,1 2,1 1,2 1,2 2.5,3 2.5,3 0,0 0))", true);
32 }
33
test_main(int,char * [])34 int test_main( int , char* [] )
35 {
36 test_all<bg::model::d2::point_xy<double> >();
37
38 #if defined(HAVE_TTMATH)
39 test_all<bg::model::d2::point_xy<ttmath_big> >();
40 #endif
41
42 return 0;
43 }
44