]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/test/algorithms/intersects/intersects_box_geometry.cpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
3 // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
4 // Copyright (c) 2013-2015 Adam Wulkiewicz, Lodz, Poland.
6 // This file was modified by Oracle on 2013, 2015, 2016.
7 // Modifications copyright (c) 2013-2016, Oracle and/or its affiliates.
9 // Use, modification and distribution is subject to the Boost Software License,
10 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
11 // http://www.boost.org/LICENSE_1_0.txt)
13 #include "test_intersects.hpp"
16 #include <boost/geometry/geometries/geometries.hpp>
17 #include <boost/geometry/geometries/point_xy.hpp>
19 #include <boost/geometry/util/rational.hpp>
22 template <typename P1
, typename P2
>
25 typedef bg::model::polygon
<P1
> polygon
;
26 typedef bg::model::ring
<P1
> ring
;
28 // intersect <=> ! disjoint (in most cases)
29 // so most tests are done in disjoint test.
30 // We only test compilation of a few cases.
31 test_geometry
<P1
, bg::model::box
<P2
> >("POINT(1 1)", "BOX(0 0,2 2)", true);
33 test_geometry
<polygon
, bg::model::box
<P2
> >(
34 "POLYGON((1992 3240,1992 1440,3792 1800,3792 3240,1992 3240))",
35 "BOX(1941 2066, 2055 2166)", true);
37 test_geometry
<ring
, bg::model::box
<P2
> >(
38 "POLYGON((1992 3240,1992 1440,3792 1800,3792 3240,1992 3240))",
39 "BOX(1941 2066, 2055 2166)", true);
41 test_geometry
<polygon
, bg::model::box
<P2
> >(
42 "POLYGON((1941 2066,2055 2066,2055 2166,1941 2166))",
43 "BOX(1941 2066, 2055 2166)", true);
45 test_geometry
<P1
, bg::model::box
<P2
> >(
57 // Those tests won't pass for rational<> because numeric_limits<> isn't specialized for this type
59 void test_additional()
61 test_geometry
<bg::model::segment
<P
>, bg::model::box
<P
> >(
65 test_geometry
<bg::model::segment
<P
>, bg::model::box
<P
> >(
69 test_geometry
<bg::model::segment
<P
>, bg::model::box
<P
> >(
73 test_geometry
<bg::model::segment
<P
>, bg::model::box
<P
> >(
77 test_geometry
<bg::model::segment
<P
>, bg::model::box
<P
> >(
81 test_geometry
<bg::model::linestring
<P
>, bg::model::box
<P
> >(
82 "LINESTRING(0 0,1 0,10 10)",
85 test_geometry
<bg::model::linestring
<P
>, bg::model::box
<P
> >(
90 // http://stackoverflow.com/questions/32457920/boost-rtree-of-box-gives-wrong-intersection-with-segment
91 // http://lists.boost.org/geometry/2015/09/3476.php
92 typedef bg::model::point
<typename
bg::coordinate_type
<P
>::type
, 3, bg::cs::cartesian
> point3d_t
;
93 test_geometry
<bg::model::segment
<point3d_t
>, bg::model::box
<point3d_t
> >(
94 "SEGMENT(2 1 0,2 1 10)",
97 test_geometry
<bg::model::segment
<point3d_t
>, bg::model::box
<point3d_t
> >(
98 "SEGMENT(2 1 0,2 1 10)",
99 "BOX(0 -5 0,10 0 10)",
101 // and derived from the cases above
102 test_geometry
<bg::model::segment
<P
>, bg::model::box
<P
> >(
103 "SEGMENT(12 0,20 10)",
106 test_geometry
<bg::model::segment
<P
>, bg::model::box
<P
> >(
110 test_geometry
<bg::model::segment
<P
>, bg::model::box
<P
> >(
114 test_geometry
<bg::model::segment
<P
>, bg::model::box
<P
> >(
118 test_geometry
<bg::model::segment
<P
>, bg::model::box
<P
> >(
119 "SEGMENT(-1 0,-1 10)",
122 test_geometry
<bg::model::segment
<P
>, bg::model::box
<P
> >(
126 test_geometry
<bg::model::segment
<P
>, bg::model::box
<P
> >(
130 test_geometry
<bg::model::segment
<P
>, bg::model::box
<P
> >(
134 test_geometry
<bg::model::segment
<P
>, bg::model::box
<P
> >(
135 "SEGMENT(10 0,10 0)",
138 test_geometry
<bg::model::segment
<P
>, bg::model::box
<P
> >(
142 test_geometry
<bg::model::segment
<P
>, bg::model::box
<P
> >(
146 test_geometry
<bg::model::segment
<P
>, bg::model::box
<P
> >(
147 "SEGMENT(0 10,0 10)",
150 test_geometry
<bg::model::segment
<P
>, bg::model::box
<P
> >(
157 int test_main( int , char* [] )
159 test_all
<bg::model::d2::point_xy
<float>, bg::model::point
<double, 2, bg::cs::cartesian
> >();
160 test_all
<bg::model::d2::point_xy
<double> >();
161 test_additional
<bg::model::d2::point_xy
<double> >();
163 #if ! defined(BOOST_GEOMETRY_RESCALE_TO_ROBUST)
164 test_all
<bg::model::d2::point_xy
<boost::rational
<int> > >();