1 // Boost.Geometry (aka GGL, Generic Geometry Library)
4 // Copyright (c) 2015-2022, Oracle and/or its affiliates.
6 // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
7 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
8 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
10 // Licensed under the Boost Software License version 1.0.
11 // http://www.boost.org/users/license.html
14 #ifndef BOOST_TEST_MODULE
15 #define BOOST_TEST_MODULE test_envelope_on_sphere_or_spheroid
18 #include <boost/test/included/unit_test.hpp>
25 #include <boost/numeric/conversion/bounds.hpp>
27 #include <from_wkt.hpp>
28 #include <geometry_test_common.hpp>
29 #include "test_envelope_expand_on_spheroid.hpp"
31 #include <boost/geometry/algorithms/convert.hpp>
32 #include <boost/geometry/algorithms/envelope.hpp>
33 #include <boost/geometry/algorithms/reverse.hpp>
34 #include <boost/geometry/core/coordinate_dimension.hpp>
35 #include <boost/geometry/core/tag.hpp>
36 #include <boost/geometry/core/tags.hpp>
37 #include <boost/geometry/geometries/geometries.hpp>
38 #include <boost/geometry/index/detail/algorithms/is_valid.hpp>
39 #include <boost/geometry/io/dsv/write.hpp>
40 #include <boost/geometry/io/wkt/wkt.hpp>
41 #include <boost/geometry/util/condition.hpp>
42 #include <boost/geometry/util/type_traits.hpp>
45 template <typename FormulaPolicy
, typename CS_Tag
>
48 template <typename Geometry
, typename Box
>
49 static inline void apply(Geometry
& geometry
, Box
& detected
)
51 bg::envelope(geometry
, detected
);
55 template <typename FormulaPolicy
>
56 struct test_envelope
<FormulaPolicy
, bg::geographic_tag
>
58 template <typename Geometry
, typename Box
>
59 static inline void apply(Geometry
& geometry
,
62 typedef bg::strategy::envelope::spherical_point point_strategy_t
;
63 typedef bg::strategy::envelope::spherical_multipoint multi_point_strategy_t
;
64 typedef bg::strategy::envelope::spherical_box box_strategy_t
;
65 typedef bg::strategy::envelope::geographic
<FormulaPolicy
, bg::srs::spheroid
<double>, double> strategy_t
;
69 std::is_same
<typename
bg::tag
<Geometry
>::type
, bg::point_tag
>::value
,
73 std::is_same
<typename
bg::tag
<Geometry
>::type
, bg::multi_point_tag
>::value
,
74 multi_point_strategy_t
,
77 std::is_same
<typename
bg::tag
<Geometry
>::type
, bg::box_tag
>::value
,
84 bg::envelope(geometry
, detected
, strategy
);
88 template <typename MBR
, typename FormulaPolicy
= bg::strategy::thomas
>
89 class envelope_on_spheroid_basic_tester
95 typename Tag
= typename
bg::tag
<Geometry
>::type
99 template <typename OutputStream
>
100 static inline OutputStream
& apply(OutputStream
& os
,
101 Geometry
const& geometry
)
103 os
<< bg::wkt(geometry
);
108 template <typename Segment
>
109 struct write_geometry
<Segment
, bg::segment_tag
>
111 template <typename OutputStream
>
112 static inline OutputStream
& apply(OutputStream
& os
,
113 Segment
const& segment
)
115 os
<< "SEGMENT" << bg::dsv(segment
);
120 template <typename Box
>
121 struct write_geometry
<Box
, bg::box_tag
>
123 template <typename OutputStream
>
124 static inline OutputStream
& apply(OutputStream
& os
,
127 os
<< "BOX" << bg::dsv(box
);
132 template <typename Geometry
, typename Box
>
133 static inline void check_message(bool same_boxes
,
134 std::string
const& case_id
,
135 std::string
const& units_str
,
136 Geometry
const& geometry
,
140 std::ostringstream stream
;
141 stream
<< "case ID: " << case_id
<< ", "
142 << "MBR units: " << units_str
<< "; "
145 write_geometry
<Geometry
>::apply(stream
, geometry
);
147 stream
<< std::setprecision(17);
149 stream
<< "; " << "expected: " << bg::dsv(expected
)
150 << ", " << "detected: " << bg::dsv(detected
);
152 BOOST_CHECK_MESSAGE(same_boxes
, stream
.str());
157 typename Geometry
, typename Box
,
158 typename T1
, typename T2
, typename T3
, typename T4
160 static inline void check_message(bool same_boxes
,
161 std::string
const& case_id
,
162 std::string
const& units_str
,
163 Geometry
const& geometry
,
164 T1
const& lon_min
, T2
const& lat_min
, double height_min
,
165 T3
const& lon_max
, T4
const& lat_max
, double height_max
,
168 std::ostringstream stream
;
169 stream
<< "case ID: " << case_id
<< ", "
170 << "MBR units: " << units_str
<< "; "
173 write_geometry
<Geometry
>::apply(stream
, geometry
);
175 stream
<< std::setprecision(17);
177 stream
<< "; " << "expected: ";
179 if (BOOST_GEOMETRY_CONDITION(bg::dimension
<Box
>::value
== 2))
181 stream
<< "(" << lon_min
<< " " << lat_min
182 << ", " << lon_max
<< " " << lat_max
<< ")";
186 stream
<< "(" << lon_min
<< " " << lat_min
<< " " << height_min
187 << ", " << lon_max
<< " " << lat_max
<< " " << height_max
<< ")";
189 stream
<< ", " << "detected: " << bg::dsv(detected
);
191 BOOST_CHECK_MESSAGE(same_boxes
, stream
.str());
196 typename Box
, typename Geometry
,
197 typename T1
, typename T2
, typename T3
, typename T4
199 static inline void base_test(std::string
const& case_id
,
200 Geometry
const& geometry
,
201 T1
const& lon_min
, T2
const& lat_min
, double height_min
,
202 T3
const& lon_max
, T4
const& lat_max
, double height_max
,
205 typedef typename
bg::coordinate_system
<Box
>::type::units box_units_type
;
207 std::string
const units_str
= units2string
<box_units_type
>();
210 test_envelope
<FormulaPolicy
, typename
bg::cs_tag
<Geometry
>::type
>
211 ::apply(geometry
, detected
);
213 #ifdef BOOST_GEOMETRY_TEST_DEBUG
214 std::cout
<< "geometry: ";
215 write_geometry
<Geometry
>::apply(std::cout
, geometry
);
217 std::cout
<< std::endl
218 << "MBR units: " << units_str
220 std::cout
<< "expected: ";
221 if (BOOST_GEOMETRY_CONDITION(bg::dimension
<Box
>::value
== 2))
223 std::cout
<< "(" << lon_min
<< " " << lat_min
224 << ", " << lon_max
<< " " << lat_max
<< ")";
228 std::cout
<< "(" << lon_min
<< " " << lat_min
<< " " << height_min
229 << ", " << lon_max
<< " " << lat_max
<< " " << height_max
<< ")";
231 std::cout
<< std::endl
232 << "detected: " << bg::dsv(detected
)
233 << std::endl
<< std::endl
;
236 bool check
= box_check_equals
<Box
>::apply(detected
,
237 lon_min
, lat_min
, height_min
,
238 lon_max
, lat_max
, height_max
,
244 lon_min
, lat_min
, height_min
,
245 lon_max
, lat_max
, height_max
,
248 // if valid box is expected, check the validity
249 if (lon_min
<= lon_max
&& lat_min
<= lat_max
&& height_min
<= height_max
)
251 BOOST_CHECK_MESSAGE(bg::index::detail::is_valid(detected
),
252 "Case ID: " << case_id
<< ", "
253 << "MBR units: " << units_str
<< "; "
254 << "Invalid Box: " << bg::dsv(detected
));
262 typename T1
, typename T2
, typename T3
, typename T4
264 static inline void apply(std::string
const& case_id
,
265 Geometry
const& geometry
,
266 T1
const& lon_min
, T2
const& lat_min
, double height_min
,
267 T3
const& lon_max
, T4
const& lat_max
, double height_max
,
270 typedef other_system_info
272 typename
bg::coordinate_system
<MBR
>::type
275 typedef bg::model::box
279 typename
bg::coordinate_type
<MBR
>::type
,
280 bg::dimension
<MBR
>::value
,
285 #ifdef BOOST_GEOMETRY_TEST_DEBUG
286 std::cout
<< std::endl
<< std::endl
;
287 std::cout
<< "case ID: " << case_id
<< std::endl
<< std::endl
;
290 base_test
<MBR
>(case_id
, geometry
,
291 lon_min
, lat_min
, height_min
,
292 lon_max
, lat_max
, height_max
,
295 if (lon_max
< lon_min
)
297 // we are in the case were a special MBR is returned;
298 // makes no sense to change units
299 base_test
<other_mbr_type
>(case_id
, geometry
,
300 lon_min
, lat_min
, height_min
,
301 lon_max
, lat_max
, height_max
,
306 base_test
<other_mbr_type
>(case_id
, geometry
,
307 other::convert(lon_min
),
308 other::convert(lat_min
),
310 other::convert(lon_max
),
311 other::convert(lat_max
),
319 // test the reverse of a geometry if it is either linear or ring
320 template <typename Geometry
>
321 struct test_reverse_geometry
323 static bool const is_linear
= bg::util::is_linear
<Geometry
>::value
;
325 // currently disable rings
326 static bool const is_ring
= false;
327 // static bool const is_ring = bg::util::is_ring<Geometry>::value;
329 static bool const value
= (is_linear
|| is_ring
);
336 typename Tag
= typename
bg::tag
<Geometry
>::type
,
337 bool TestReverse
= test_reverse_geometry
<Geometry
>::value
,
338 typename FormulaPolicy
= bg::strategy::thomas
340 struct test_envelope_on_sphere_or_spheroid
342 template <typename T1
, typename T2
, typename T3
, typename T4
,
343 typename T5
, typename T6
, typename T7
, typename T8
>
344 static inline void apply(std::string
const& case_id
,
345 Geometry
const& geometry
,
346 T1
const& lon_min1
, T2
const& lat_min1
, double height_min1
,
347 T3
const& lon_max1
, T4
const& lat_max1
, double height_max1
,
348 T5
const& lon_min2
, T6
const& lat_min2
, double height_min2
,
349 T7
const& lon_max2
, T8
const& lat_max2
, double height_max2
,
350 double tolerance
= std::numeric_limits
<double>::epsilon())
352 envelope_on_spheroid_basic_tester
355 >::apply(case_id
, geometry
,
356 lon_min1
, lat_min1
, height_min1
,
357 lon_max1
, lat_max1
, height_max1
,
360 if (BOOST_GEOMETRY_CONDITION(TestReverse
))
362 std::string reversed_case_id
= case_id
+ "-reverse";
364 Geometry reversed_geometry
= geometry
;
365 bg::reverse(reversed_geometry
);
366 envelope_on_spheroid_basic_tester
369 >::apply(reversed_case_id
, reversed_geometry
,
370 lon_min2
, lat_min2
, height_min2
,
371 lon_max2
, lat_max2
, height_max2
,
375 #ifdef BOOST_GEOMETRY_TEST_DEBUG
376 std::cout
<< "=================="
377 << std::endl
<< std::endl
;
381 template <typename T1
, typename T2
, typename T3
, typename T4
,
382 typename T5
, typename T6
, typename T7
, typename T8
>
383 static inline void apply(std::string
const& case_id
,
384 Geometry
const& geometry
,
385 T1
const& lon_min1
, T2
const& lat_min1
,
386 T3
const& lon_max1
, T4
const& lat_max1
,
387 T5
const& lon_min2
, T6
const& lat_min2
,
388 T7
const& lon_max2
, T8
const& lat_max2
,
389 double tolerance
= std::numeric_limits
<double>::epsilon())
391 apply(case_id
, geometry
,
392 lon_min1
, lat_min1
, 0, lon_max1
, lat_max1
, 0,
393 lon_min2
, lat_min2
, 0, lon_max2
, lat_max2
, 0,
397 template <typename T1
, typename T2
, typename T3
, typename T4
>
398 static inline void apply(std::string
const& case_id
,
399 Geometry
const& geometry
,
400 T1
const& lon_min
, T2
const& lat_min
, double height_min
,
401 T3
const& lon_max
, T4
const& lat_max
, double height_max
,
402 double tolerance
= std::numeric_limits
<double>::epsilon())
404 apply(case_id
, geometry
,
405 lon_min
, lat_min
, height_min
,
406 lon_max
, lat_max
, height_max
,
407 lon_min
, lat_min
, height_min
,
408 lon_max
, lat_max
, height_max
,
412 template <typename T1
, typename T2
, typename T3
, typename T4
>
413 static inline void apply(std::string
const& case_id
,
414 Geometry
const& geometry
,
415 T1
const& lon_min
, T2
const& lat_min
,
416 T3
const& lon_max
, T4
const& lat_max
,
417 double tolerance
= std::numeric_limits
<double>::epsilon())
419 apply(case_id
, geometry
,
420 lon_min
, lat_min
, 0, lon_max
, lat_max
, 0,
426 // special tester for rings
427 template <typename Geometry
, typename MBR
, bool TestReverse
>
428 struct test_envelope_on_sphere_or_spheroid
<Geometry
, MBR
, bg::ring_tag
, TestReverse
>
430 template <typename T1
, typename T2
, typename T3
, typename T4
,
431 typename T5
, typename T6
, typename T7
, typename T8
>
432 static inline void apply(std::string
const& case_id
,
433 Geometry
const& geometry
,
434 T1
const& lon_min1
, T2
const& lat_min1
,
435 T3
const& lon_max1
, T4
const& lat_max1
,
436 T5
const& lon_min2
, T6
const& lat_min2
,
437 T7
const& lon_max2
, T8
const& lat_max2
,
438 double const& tolerance
= std::numeric_limits
<double>::epsilon())
440 envelope_on_spheroid_basic_tester
443 >::apply(case_id
, geometry
,
444 lon_min1
, lat_min1
, 0,
445 lon_max1
, lat_max1
, 0,
448 std::string ccw_case_id
= case_id
+ "-2ccw";
452 typename
bg::point_type
<Geometry
>::type
, false
454 bg::convert(geometry
, ccw_ring
);
456 envelope_on_spheroid_basic_tester
459 >::apply(ccw_case_id
, ccw_ring
,
460 lon_min2
, lat_min2
, 0,
461 lon_max2
, lat_max2
, 0,
464 #ifdef BOOST_GEOMETRY_TEST_DEBUG
465 std::cout
<< "=================="
466 << std::endl
<< std::endl
;
470 template <typename T1
, typename T2
, typename T3
, typename T4
>
471 static inline void apply(std::string
const& case_id
,
472 Geometry
const& geometry
,
473 T1
const& lon_min
, T2
const& lat_min
,
474 T3
const& lon_max
, T4
const& lat_max
,
475 double tolerance
= std::numeric_limits
<double>::epsilon())
477 apply(case_id
, geometry
,
478 lon_min
, lat_min
, lon_max
, lat_max
,
479 lon_min
, lat_min
, lon_max
, lat_max
,
485 template <typename CoordinateSystem
, typename Geometry
>
486 void test_empty_geometry(std::string
const& case_id
, std::string
const& wkt
)
488 std::size_t const dim
= bg::dimension
<Geometry
>::value
;
490 typedef bg::model::point
<double, dim
, CoordinateSystem
> point_type
;
491 typedef bg::model::box
<point_type
> B
;
492 typedef test_envelope_on_sphere_or_spheroid
<Geometry
, B
> tester
;
494 typedef typename
bg::coordinate_type
<Geometry
>::type ct
;
495 ct high_val
= boost::numeric::bounds
<ct
>::highest();
496 ct low_val
= boost::numeric::bounds
<ct
>::lowest();
498 if (BOOST_GEOMETRY_CONDITION(dim
== 2))
500 tester::apply(case_id
,
501 from_wkt
<Geometry
>(wkt
),
502 high_val
, high_val
, low_val
, low_val
);
506 tester::apply(case_id
,
507 from_wkt
<Geometry
>(wkt
),
508 high_val
, high_val
, high_val
, low_val
, low_val
, low_val
);
513 template <typename CoordinateSystem
>
514 void test_envelope_point()
516 typedef bg::model::point
<double, 2, CoordinateSystem
> point_type
;
517 typedef point_type G
;
518 typedef bg::model::box
<point_type
> B
;
519 typedef test_envelope_on_sphere_or_spheroid
<G
, B
> tester
;
522 from_wkt
<G
>("POINT(10 10)"),
526 from_wkt
<G
>("POINT(370 10)"),
529 #ifdef BOOST_GEOMETRY_NORMALIZE_LATITUDE
531 from_wkt
<G
>("POINT(370 -350)"),
535 // north and south poles
537 from_wkt
<G
>("POINT(0 90)"),
540 tester::apply("p04a",
541 from_wkt
<G
>("POINT(10 90)"),
544 tester::apply("p04b",
545 from_wkt
<G
>("POINT(270 90)"),
548 #ifdef BOOST_GEOMETRY_NORMALIZE_LATITUDE
549 tester::apply("p04c",
550 from_wkt
<G
>("POINT(270 450)"),
554 tester::apply("p04d",
555 from_wkt
<G
>("POINT(190 90)"),
558 tester::apply("p04e",
559 from_wkt
<G
>("POINT(-100 90)"),
563 from_wkt
<G
>("POINT(0 -90)"),
566 tester::apply("p05a",
567 from_wkt
<G
>("POINT(10 -90)"),
570 tester::apply("p05b",
571 from_wkt
<G
>("POINT(270 -90)"),
574 #ifdef BOOST_GEOMETRY_NORMALIZE_LATITUDE
575 tester::apply("p05c",
576 from_wkt
<G
>("POINT(270 -450)"),
580 tester::apply("p05d",
581 from_wkt
<G
>("POINT(190 -90)"),
584 tester::apply("p05e",
585 from_wkt
<G
>("POINT(-100 -90)"),
588 tester::apply("p05f",
589 from_wkt
<G
>("POINT(-100 -90)"),
593 BOOST_AUTO_TEST_CASE( envelope_point
)
595 test_envelope_point
<bg::cs::spherical_equatorial
<bg::degree
> >();
596 test_envelope_point
<bg::cs::geographic
<bg::degree
> >();
600 template <typename CoordinateSystem
>
601 void test_envelope_point_with_height()
603 typedef bg::model::point
<double, 3, CoordinateSystem
> point_type
;
604 typedef point_type G
;
605 typedef bg::model::box
<point_type
> B
;
606 typedef test_envelope_on_sphere_or_spheroid
<G
, B
> tester
;
608 tester::apply("ph01",
609 from_wkt
<G
>("POINT(10 10 1256)"),
610 10, 10, 1256, 10, 10, 1256);
613 BOOST_AUTO_TEST_CASE( envelope_point_with_height
)
615 test_envelope_point_with_height
617 bg::cs::spherical_equatorial
<bg::degree
>
619 test_envelope_point_with_height
<bg::cs::geographic
<bg::degree
> >();
623 BOOST_AUTO_TEST_CASE( envelope_segment_sphere
)
625 typedef bg::cs::spherical_equatorial
<bg::degree
> coordinate_system_type
;
626 typedef bg::model::point
<double, 2, coordinate_system_type
> P
;
627 typedef bg::model::segment
<P
> G
;
628 typedef bg::model::box
<P
> B
;
629 typedef test_envelope_on_sphere_or_spheroid
<G
, B
> tester
;
631 double const eps
= std::numeric_limits
<double>::epsilon();
634 from_wkt
<G
>("SEGMENT(10 10,40 40)"),
638 from_wkt
<G
>("SEGMENT(10 10,40 10)"),
639 10, 10, 40, 10.345270046149988);
642 from_wkt<G>("SEGMENT(1 2,70 1)"),
645 tester::apply("s02a",
646 from_wkt
<G
>("SEGMENT(40 10,10 10)"),
647 10, 10, 40, 10.34527004614999);
650 from_wkt
<G
>("SEGMENT(160 10,-170 10)"),
651 160, 10, 190, 10.34527004614999);
653 tester::apply("s03a",
654 from_wkt
<G
>("SEGMENT(-170 10,160 10)"),
655 160, 10, 190, 10.34527004614999);
657 tester::apply("s03b",
658 from_wkt
<G
>("SEGMENT(-170 -10,160 -10)"),
659 160, -10.34527004614999, 190, -10);
662 from_wkt
<G
>("SEGMENT(-40 45,140 60)"),
665 tester::apply("s04a",
666 from_wkt
<G
>("SEGMENT(-40 45,140 25)"),
669 // segment ending at the north pole
671 from_wkt
<G
>("SEGMENT(40 45,80 90)"),
674 // segment starting at the north pole
675 tester::apply("s05a",
676 from_wkt
<G
>("SEGMENT(80 90,40 45)"),
679 // segment ending at the north pole
681 from_wkt
<G
>("SEGMENT(-40 45,80 90)"),
684 // segment starting at the north pole
685 tester::apply("s06a",
686 from_wkt
<G
>("SEGMENT(70 90,-40 45)"),
689 // segment ending at the north pole
691 from_wkt
<G
>("SEGMENT(40 -45,80 90)"),
694 // segment passing through the south pole
696 from_wkt
<G
>("SEGMENT(-170 -45,10 -30)"),
700 from_wkt
<G
>("SEGMENT(1 -45,179 30)"),
701 1, -85.28884376852969, 179, 30,
704 tester::apply("s09a",
705 from_wkt
<G
>("SEGMENT(2 -45,181 30)"),
706 2, -87.63659983704832, 181, 30);
710 from_wkt
<G
>("SEGMENT(0 -45,181 30)"),
711 -179, -87.636599837048323, 0, 30,
715 from_wkt
<G
>("SEGMENT(260 30,20 45)"),
716 -100, 30, 20, 57.93195594009233);
718 tester::apply("s11a",
719 from_wkt
<G
>("SEGMENT(260 45,20 30)"),
720 -100, 30, 20, 57.931955940092337);
722 // segment degenerating to the north pole
724 from_wkt
<G
>("SEGMENT(10 90,20 90)"),
727 // segment degenerating to the south pole
729 from_wkt
<G
>("SEGMENT(10 -90,20 -90)"),
733 from_wkt
<G
>("SEGMENT(20 20,10 30)"),
734 10, 20, 20, 30);//48.87458730907602);
737 from_wkt
<G
>("SEGMENT(50 45,185 45)"),
738 50, 45, 185, 69.05897952775615);
740 // segment that lies on the equator
742 from_wkt
<G
>("SEGMENT(0 0,50 0)"),
745 // segment that lies on the equator
746 tester::apply("s16a",
747 from_wkt
<G
>("SEGMENT(-50 0,50 0)"),
750 // segment that lies on the equator and touches antimeridian
751 tester::apply("s16b",
752 from_wkt
<G
>("SEGMENT(50 0,180 0)"),
755 // segment that lies on the equator and crosses antimeridian
756 tester::apply("s16c",
757 from_wkt
<G
>("SEGMENT(-170 0,160 0)"),
761 from_wkt
<G
>("SEGMENT(140 10, -140 80)"),
764 tester::apply("s17-r",
765 from_wkt
<G
>("SEGMENT(-140 80, 140 10)"),
769 from_wkt
<G
>("SEGMENT(20 10, 100 80)"),
772 tester::apply("s18-r",
773 from_wkt
<G
>("SEGMENT(100 80, 20 10)"),
776 // segment connecting the north and south pole
778 // this should be forbidden actually, as it is not well-defined
779 // with this test we demonstrate that the algorithm still returns
780 // something meaningful
782 from_wkt
<G
>("SEGMENT(10 90,20 -90)"),
785 // https://svn.boost.org/trac/boost/ticket/12106
786 tester::apply("s100_ticket_12106",
787 G(P(11.488323611111111, 53.687086666666673), P(11.488324166666667, 53.687086666666673)),
788 11.488323611111111, 53.687086666666673, 11.488324166666667, 53.687086666666673);
790 double const heps
= eps
/ 2;
792 tester::apply("s101",
793 G(P(1, 1), P(1-heps
, 1-heps
)),
794 1-heps
, 1-heps
, 1, 1);
795 tester::apply("s102",
796 G(P(1, 1), P(1, 1-heps
)),
798 tester::apply("s103",
799 G(P(1, 1), P(1-heps
, 1)),
801 tester::apply("s104",
802 G(P(2, 1), P(1, 1-heps
)),
803 1, 1-heps
, 2, 1.000038070652770505);
804 tester::apply("s105",
805 G(P(1, 2), P(1-heps
, 1)),
809 BOOST_AUTO_TEST_CASE( envelope_segment_spherical_polar
)
811 typedef bg::cs::spherical
<bg::degree
> coordinate_system_type
;
812 typedef bg::model::point
<double, 2, coordinate_system_type
> P
;
813 typedef bg::model::segment
<P
> G
;
814 typedef bg::model::box
<P
> B
;
815 typedef test_envelope_on_sphere_or_spheroid
<G
, B
> tester
;
818 from_wkt
<G
>("SEGMENT(10 10,40 40)"),
822 from_wkt
<G
>("SEGMENT(10 80,40 80)"),
823 10, 90 - 10.345270046149988, 40, 80);
826 from_wkt
<G
>("SEGMENT(160 80,-170 80)"),
827 160, 90 - 10.34527004614999, 190, 80);
829 // segment ending at the north pole
831 from_wkt
<G
>("SEGMENT(40 45,80 0)"),
836 BOOST_AUTO_TEST_CASE( envelope_segment_spheroid
)
838 typedef bg::cs::geographic
<bg::degree
> coordinate_system_type
;
839 typedef bg::model::point
<double, 2, coordinate_system_type
> P
;
840 typedef bg::model::segment
<P
> G
;
841 typedef bg::model::box
<P
> B
;
842 typedef test_envelope_on_sphere_or_spheroid
<G
, B
> tester
;
844 double const eps
= std::numeric_limits
<double>::epsilon();
847 from_wkt
<G
>("SEGMENT(10 10,40 40)"),
851 from_wkt
<G
>("SEGMENT(10 10,40 10)"),
852 10, 10, 40, 10.347587605817942);
854 tester::apply("s02a",
855 from_wkt
<G
>("SEGMENT(40 10,10 10)"),
856 10, 10, 40, 10.347587605817942);
859 from_wkt
<G
>("SEGMENT(160 10,-170 10)"),
860 160, 10, 190, 10.347587605817942);
862 tester::apply("s03a",
863 from_wkt
<G
>("SEGMENT(-170 10,160 10)"),
864 160, 10, 190, 10.347587605817942);
866 tester::apply("s03b",
867 from_wkt
<G
>("SEGMENT(-170 -10,160 -10)"),
868 160, -10.347587605817942, 190, -10);
871 from_wkt
<G
>("SEGMENT(-40 45,140 60)"),
874 tester::apply("s04a",
875 from_wkt
<G
>("SEGMENT(-40 45,140 25)"),
878 // segment ending at the north pole
880 from_wkt
<G
>("SEGMENT(40 45,80 90)"),
883 // segment starting at the north pole
884 tester::apply("s05a",
885 from_wkt
<G
>("SEGMENT(80 90,40 45)"),
888 // segment ending at the north pole
890 from_wkt
<G
>("SEGMENT(-40 45,80 90)"),
893 // segment starting at the north pole
894 tester::apply("s06a",
895 from_wkt
<G
>("SEGMENT(70 90,-40 45)"),
898 // segment ending at the north pole
900 from_wkt
<G
>("SEGMENT(40 -45,80 90)"),
903 // segment passing through the south pole
905 from_wkt
<G
>("SEGMENT(-170 -45,10 -30)"),
909 from_wkt
<G
>("SEGMENT(1 -45,179 30)"),
910 1, rng(-85.392785243526134, -85.392785243525253), 179, 30);
912 tester::apply("s09a",
913 from_wkt
<G
>("SEGMENT(2 -45,181 30)"),
914 2, rng(-87.689300911353811, -87.689300911353371), 181, 30);
918 from_wkt
<G
>("SEGMENT(0 -45,181 30)"),
919 -179, rng(-87.689300911353797, -87.689300911353385), 0, 30);
922 from_wkt
<G
>("SEGMENT(260 30,20 45)"),
923 -100, 30, 20, rng(57.990810958016482, 57.990810958016965));
925 tester::apply("s11a",
926 from_wkt
<G
>("SEGMENT(260 45,20 30)"),
927 -100, 30, 20, rng(57.990810958016453, 57.990810958016965));
929 // segment degenerating to the north pole
931 from_wkt
<G
>("SEGMENT(10 90,20 90)"),
934 // segment degenerating to the south pole
936 from_wkt
<G
>("SEGMENT(10 -90,20 -90)"),
940 from_wkt
<G
>("SEGMENT(20 20,10 30)"),
941 10, 20, 20, 30);//48.87458730907602);
944 from_wkt
<G
>("SEGMENT(50 45,185 45)"),
945 50, 45, 185, rng(69.098479073902851, 69.098479073903178));
947 // segment that lies on the equator
949 from_wkt
<G
>("SEGMENT(0 0,50 0)"),
952 // segment that lies on the equator
953 tester::apply("s16a",
954 from_wkt
<G
>("SEGMENT(-50 0,50 0)"),
957 // segment that lies on the equator and touches antimeridian
958 tester::apply("s16b",
959 from_wkt
<G
>("SEGMENT(50 0,180 0)"),
962 // segment that lies on the equator and crosses antimeridian
963 tester::apply("s16c",
964 from_wkt
<G
>("SEGMENT(-170 0,160 0)"),
968 from_wkt
<G
>("SEGMENT(140 10, -140 80)"),
971 tester::apply("s17-r",
972 from_wkt
<G
>("SEGMENT(-140 80, 140 10)"),
976 from_wkt
<G
>("SEGMENT(20 10, 100 80)"),
979 tester::apply("s18-r",
980 from_wkt
<G
>("SEGMENT(100 80, 20 10)"),
983 // segment connecting the north and south pole
985 // this should be forbidden actually, as it is not well-defined
986 // with this test we demonstrate that the algorithm still returns
987 // something meaningful
989 from_wkt
<G
>("SEGMENT(10 90,20 -90)"),
992 // https://svn.boost.org/trac/boost/ticket/12106
993 tester::apply("s100_ticket_12106",
994 G(P(11.488323611111111, 53.687086666666673), P(11.488324166666667, 53.687086666666673)),
995 11.488323611111111, 53.687086666666673, 11.488324166666667, 53.687086666666673);
997 double const heps
= eps
/ 2;
999 tester::apply("s101",
1000 G(P(1, 1), P(1-heps
, 1-heps
)),
1001 1-heps
, 1-heps
, 1, 1);
1002 tester::apply("s102",
1003 G(P(1, 1), P(1, 1-heps
)),
1005 tester::apply("s103",
1006 G(P(1, 1), P(1-heps
, 1)),
1008 tester::apply("s104",
1009 G(P(2, 1), P(1, 1-heps
)),
1010 1, 1-heps
, 2, rng(1.0000383271568751, 1.0000383271569036));
1011 tester::apply("s105",
1012 G(P(1, 2), P(1-heps
, 1)),
1016 BOOST_AUTO_TEST_CASE( envelope_segment_spheroid_with_strategy_thomas
)
1019 typedef bg::cs::geographic
<bg::degree
> coordinate_system_type
;
1020 typedef bg::model::point
<double, 2, coordinate_system_type
> P
;
1021 typedef bg::model::segment
<P
> G
;
1022 typedef bg::model::box
<P
> B
;
1023 typedef test_envelope_on_sphere_or_spheroid
1027 test_reverse_geometry
<G
>::value
,
1028 bg::strategy::thomas
1031 tester::apply("s01",
1032 from_wkt
<G
>("SEGMENT(10 10,40 40)"),
1035 tester::apply("s02",
1036 from_wkt
<G
>("SEGMENT(10 10,40 10)"),
1037 10, 10, 40, 10.347587605817942);
1039 tester::apply("s02a",
1040 from_wkt
<G
>("SEGMENT(40 10,10 10)"),
1041 10, 10, 40, 10.347587605817942);
1043 tester::apply("s03",
1044 from_wkt
<G
>("SEGMENT(160 10,-170 10)"),
1045 160, 10, 190, 10.347587605817942);
1047 tester::apply("s03a",
1048 from_wkt
<G
>("SEGMENT(-170 10,160 10)"),
1049 160, 10, 190, 10.347587605817942);
1051 tester::apply("s03b",
1052 from_wkt
<G
>("SEGMENT(-170 -10,160 -10)"),
1053 160, -10.347587605817942, 190, -10);
1055 tester::apply("s04",
1056 from_wkt
<G
>("SEGMENT(-40 45,140 60)"),
1059 tester::apply("s04a",
1060 from_wkt
<G
>("SEGMENT(-40 45,140 25)"),
1063 // segment ending at the north pole
1064 tester::apply("s05",
1065 from_wkt
<G
>("SEGMENT(40 45,80 90)"),
1068 // segment starting at the north pole
1069 tester::apply("s05a",
1070 from_wkt
<G
>("SEGMENT(80 90,40 45)"),
1073 // segment ending at the north pole
1074 tester::apply("s06",
1075 from_wkt
<G
>("SEGMENT(-40 45,80 90)"),
1078 // segment starting at the north pole
1079 tester::apply("s06a",
1080 from_wkt
<G
>("SEGMENT(70 90,-40 45)"),
1083 // segment ending at the north pole
1084 tester::apply("s07",
1085 from_wkt
<G
>("SEGMENT(40 -45,80 90)"),
1088 // segment passing through the south pole
1089 tester::apply("s08",
1090 from_wkt
<G
>("SEGMENT(-170 -45,10 -30)"),
1091 -170, -90, 10, -30);
1093 tester::apply("s09",
1094 from_wkt
<G
>("SEGMENT(1 -45,179 30)"),
1095 1, rng(-85.392785243526134, -85.392785243525253), 179, 30);
1097 tester::apply("s09a",
1098 from_wkt
<G
>("SEGMENT(2 -45,181 30)"),
1099 2, rng(-87.689300911353811, -87.689300911353371), 181, 30);
1101 // very long segment
1102 tester::apply("s10",
1103 from_wkt
<G
>("SEGMENT(0 -45,181 30)"),
1104 -179, rng(-87.689300911353797, -87.689300911353385), 0, 30);
1106 tester::apply("s11",
1107 from_wkt
<G
>("SEGMENT(260 30,20 45)"),
1108 -100, 30, 20, rng(57.990810958016482, 57.990810958016965));
1110 tester::apply("s11a",
1111 from_wkt
<G
>("SEGMENT(260 45,20 30)"),
1112 -100, 30, 20, rng(57.990810958016453, 57.990810958016965));
1114 // segment degenerating to the north pole
1115 tester::apply("s12",
1116 from_wkt
<G
>("SEGMENT(10 90,20 90)"),
1119 // segment degenerating to the south pole
1120 tester::apply("s13",
1121 from_wkt
<G
>("SEGMENT(10 -90,20 -90)"),
1124 tester::apply("s14",
1125 from_wkt
<G
>("SEGMENT(20 20,10 30)"),
1126 10, 20, 20, 30);//48.87458730907602);
1128 tester::apply("s15",
1129 from_wkt
<G
>("SEGMENT(50 45,185 45)"),
1130 50, 45, 185, rng(69.098479073902851, 69.098479073903178));
1132 // segment that lies on the equator
1133 tester::apply("s16",
1134 from_wkt
<G
>("SEGMENT(0 0,50 0)"),
1137 // segment that lies on the equator
1138 tester::apply("s16a",
1139 from_wkt
<G
>("SEGMENT(-50 0,50 0)"),
1142 // segment that lies on the equator and touches antimeridian
1143 tester::apply("s16b",
1144 from_wkt
<G
>("SEGMENT(50 0,180 0)"),
1147 // segment that lies on the equator and crosses antimeridian
1148 tester::apply("s16c",
1149 from_wkt
<G
>("SEGMENT(-170 0,160 0)"),
1152 tester::apply("s17",
1153 from_wkt
<G
>("SEGMENT(140 10, -140 80)"),
1156 tester::apply("s17-r",
1157 from_wkt
<G
>("SEGMENT(-140 80, 140 10)"),
1160 tester::apply("s18",
1161 from_wkt
<G
>("SEGMENT(20 10, 100 80)"),
1164 tester::apply("s18-r",
1165 from_wkt
<G
>("SEGMENT(100 80, 20 10)"),
1170 BOOST_AUTO_TEST_CASE( envelope_segment_spheroid_with_strategy_andoyer
)
1173 typedef bg::cs::geographic
<bg::degree
> coordinate_system_type
;
1174 typedef bg::model::point
<double, 2, coordinate_system_type
> P
;
1175 typedef bg::model::segment
<P
> G
;
1176 typedef bg::model::box
<P
> B
;
1177 typedef test_envelope_on_sphere_or_spheroid
1181 test_reverse_geometry
<G
>::value
,
1182 bg::strategy::andoyer
1185 tester::apply("s01",
1186 from_wkt
<G
>("SEGMENT(10 10,40 40)"),
1189 tester::apply("s02",
1190 from_wkt
<G
>("SEGMENT(10 10,40 10)"),
1191 10, 10, 40, 10.34758709960203);
1193 tester::apply("s02a",
1194 from_wkt
<G
>("SEGMENT(40 10,10 10)"),
1195 10, 10, 40, 10.34758709960203);
1197 tester::apply("s03",
1198 from_wkt
<G
>("SEGMENT(160 10,-170 10)"),
1199 160, 10, 190, 10.34758709960203);
1201 tester::apply("s03a",
1202 from_wkt
<G
>("SEGMENT(-170 10,160 10)"),
1203 160, 10, 190, 10.34758709960203);
1205 tester::apply("s03b",
1206 from_wkt
<G
>("SEGMENT(-170 -10,160 -10)"),
1207 160, -10.34758709960203, 190, -10);
1209 tester::apply("s04",
1210 from_wkt
<G
>("SEGMENT(-40 45,140 60)"),
1213 tester::apply("s04a",
1214 from_wkt
<G
>("SEGMENT(-40 45,140 25)"),
1217 // segment ending at the north pole
1218 tester::apply("s05",
1219 from_wkt
<G
>("SEGMENT(40 45,80 90)"),
1222 // segment starting at the north pole
1223 tester::apply("s05a",
1224 from_wkt
<G
>("SEGMENT(80 90,40 45)"),
1227 // segment ending at the north pole
1228 tester::apply("s06",
1229 from_wkt
<G
>("SEGMENT(-40 45,80 90)"),
1232 // segment starting at the north pole
1233 tester::apply("s06a",
1234 from_wkt
<G
>("SEGMENT(70 90,-40 45)"),
1237 // segment ending at the north pole
1238 tester::apply("s07",
1239 from_wkt
<G
>("SEGMENT(40 -45,80 90)"),
1242 // segment passing through the south pole
1243 tester::apply("s08",
1244 from_wkt
<G
>("SEGMENT(-170 -45,10 -30)"),
1245 -170, -90, 10, -30);
1247 tester::apply("s09",
1248 from_wkt
<G
>("SEGMENT(1 -45,179 30)"),
1249 1, rng(-85.394745211091248, -85.394745211090353), 179, 30);
1251 tester::apply("s09a",
1252 from_wkt
<G
>("SEGMENT(2 -45,181 30)"),
1253 2, rng(-87.690317839849726, -87.690317839849271), 181, 30);
1255 // very long segment
1256 tester::apply("s10",
1257 from_wkt
<G
>("SEGMENT(0 -45,181 30)"),
1258 -179, rng(-87.69031783984974, -87.690317839849271), 0, 30);
1260 tester::apply("s11",
1261 from_wkt
<G
>("SEGMENT(260 30,20 45)"),
1262 -100, 30, 20, rng(57.990742552279649, 57.990742552280153));
1264 tester::apply("s11a",
1265 from_wkt
<G
>("SEGMENT(260 45,20 30)"),
1266 -100, 30, 20, rng(57.99074255227962, 57.990742552280118));
1268 // segment degenerating to the north pole
1269 tester::apply("s12",
1270 from_wkt
<G
>("SEGMENT(10 90,20 90)"),
1273 // segment degenerating to the south pole
1274 tester::apply("s13",
1275 from_wkt
<G
>("SEGMENT(10 -90,20 -90)"),
1278 tester::apply("s14",
1279 from_wkt
<G
>("SEGMENT(20 20,10 30)"),
1280 10, 20, 20, 30);//48.87458730907602);
1282 tester::apply("s15",
1283 from_wkt
<G
>("SEGMENT(50 45,185 45)"),
1284 50, 45, 185, rng(69.098446893408124, 69.09844689340845));
1286 // segment that lies on the equator
1287 tester::apply("s16",
1288 from_wkt
<G
>("SEGMENT(0 0,50 0)"),
1291 // segment that lies on the equator
1292 tester::apply("s16a",
1293 from_wkt
<G
>("SEGMENT(-50 0,50 0)"),
1296 // segment that lies on the equator and touches antimeridian
1297 tester::apply("s16b",
1298 from_wkt
<G
>("SEGMENT(50 0,180 0)"),
1301 // segment that lies on the equator and crosses antimeridian
1302 tester::apply("s16c",
1303 from_wkt
<G
>("SEGMENT(-170 0,160 0)"),
1306 tester::apply("s17",
1307 from_wkt
<G
>("SEGMENT(140 10, -140 80)"),
1310 tester::apply("s17-r",
1311 from_wkt
<G
>("SEGMENT(-140 80, 140 10)"),
1314 tester::apply("s18",
1315 from_wkt
<G
>("SEGMENT(20 10, 100 80)"),
1318 tester::apply("s18-r",
1319 from_wkt
<G
>("SEGMENT(100 80, 20 10)"),
1322 // segments intersecting pole
1323 tester::apply("s19",
1324 from_wkt
<G
>("SEGMENT(0 0, 180 0)"),
1326 tester::apply("s20",
1327 from_wkt
<G
>("SEGMENT(0 0, -180 0)"),
1329 tester::apply("s21",
1330 from_wkt
<G
>("SEGMENT(0 1, 180 1)"),
1332 std::numeric_limits
<double>::epsilon() * 10);
1333 tester::apply("s22",
1334 from_wkt
<G
>("SEGMENT(0 -1, 180 -1)"),
1336 std::numeric_limits
<double>::epsilon() * 10);
1340 BOOST_AUTO_TEST_CASE( envelope_segment_spheroid_with_strategy_vincenty
)
1343 typedef bg::cs::geographic
<bg::degree
> coordinate_system_type
;
1344 typedef bg::model::point
<double, 2, coordinate_system_type
> P
;
1345 typedef bg::model::segment
<P
> G
;
1346 typedef bg::model::box
<P
> B
;
1347 typedef test_envelope_on_sphere_or_spheroid
1351 test_reverse_geometry
<G
>::value
,
1352 bg::strategy::vincenty
1355 tester::apply("s01",
1356 from_wkt
<G
>("SEGMENT(10 10,40 40)"),
1359 tester::apply("s02",
1360 from_wkt
<G
>("SEGMENT(10 10,40 10)"),
1361 10, 10, 40, rng(10.347587628821937, 10.347587628821941));
1363 tester::apply("s02a",
1364 from_wkt
<G
>("SEGMENT(40 10,10 10)"),
1365 10, 10, 40, rng(10.347587628821937, 10.347587628821941));
1367 tester::apply("s03",
1368 from_wkt
<G
>("SEGMENT(160 10,-170 10)"),
1369 160, 10, 190, rng(10.347587628821937, 10.347587628821941));
1371 tester::apply("s03a",
1372 from_wkt
<G
>("SEGMENT(-170 10,160 10)"),
1373 160, 10, 190, rng(10.347587628821937, 10.347587628821941));
1375 tester::apply("s03b",
1376 from_wkt
<G
>("SEGMENT(-170 -10,160 -10)"),
1377 160, rng(-10.347587628821941, -10.347587628821937), 190, -10);
1379 tester::apply("s04",
1380 from_wkt
<G
>("SEGMENT(-40 45,140 60)"),
1383 tester::apply("s04a",
1384 from_wkt
<G
>("SEGMENT(-40 45,140 25)"),
1387 // segment ending at the north pole
1388 tester::apply("s05",
1389 from_wkt
<G
>("SEGMENT(40 45,80 90)"),
1392 // segment starting at the north pole
1393 tester::apply("s05a",
1394 from_wkt
<G
>("SEGMENT(80 90,40 45)"),
1397 // segment ending at the north pole
1398 tester::apply("s06",
1399 from_wkt
<G
>("SEGMENT(-40 45,80 90)"),
1402 // segment starting at the north pole
1403 tester::apply("s06a",
1404 from_wkt
<G
>("SEGMENT(70 90,-40 45)"),
1407 // segment ending at the north pole
1408 tester::apply("s07",
1409 from_wkt
<G
>("SEGMENT(40 -45,80 90)"),
1412 // segment passing through the south pole
1413 tester::apply("s08",
1414 from_wkt
<G
>("SEGMENT(-170 -45,10 -30)"),
1415 -170, -90, 10, -30);
1417 tester::apply("s09",
1418 from_wkt
<G
>("SEGMENT(1 -45,179 30)"),
1419 1, rng(-85.392840929577218, -85.392840929576352), 179, 30);
1421 tester::apply("s09a",
1422 from_wkt
<G
>("SEGMENT(2 -45,181 30)"),
1423 2, rng(-87.689330275867817, -87.689330275867405), 181, 30);
1425 // very long segment
1426 tester::apply("s10",
1427 from_wkt
<G
>("SEGMENT(0 -45,181 30)"),
1428 -179, rng(-87.689330275867832, -87.689330275867405), 0, 30);
1430 tester::apply("s11",
1431 from_wkt
<G
>("SEGMENT(260 30,20 45)"),
1432 -100, 30, 20, rng(57.990810647056549, 57.990810647057032));
1434 tester::apply("s11a",
1435 from_wkt
<G
>("SEGMENT(260 45,20 30)"),
1436 -100, 30, 20, rng(57.990810647056541, 57.990810647057032));
1438 // segment degenerating to the north pole
1439 tester::apply("s12",
1440 from_wkt
<G
>("SEGMENT(10 90,20 90)"),
1443 // segment degenerating to the south pole
1444 tester::apply("s13",
1445 from_wkt
<G
>("SEGMENT(10 -90,20 -90)"),
1448 tester::apply("s14",
1449 from_wkt
<G
>("SEGMENT(20 20,10 30)"),
1450 10, 20, 20, 30);//48.87458730907602);
1452 tester::apply("s15",
1453 from_wkt
<G
>("SEGMENT(50 45,185 45)"),
1454 50, 45, 185, rng(69.098479136978156, 69.098479136978497));
1456 // segment that lies on the equator
1457 tester::apply("s16",
1458 from_wkt
<G
>("SEGMENT(0 0,50 0)"),
1461 // segment that lies on the equator
1462 tester::apply("s16a",
1463 from_wkt
<G
>("SEGMENT(-50 0,50 0)"),
1466 // segment that lies on the equator and touches antimeridian
1467 tester::apply("s16b",
1468 from_wkt
<G
>("SEGMENT(50 0,180 0)"),
1471 // segment that lies on the equator and crosses antimeridian
1472 tester::apply("s16c",
1473 from_wkt
<G
>("SEGMENT(-170 0,160 0)"),
1476 tester::apply("s17",
1477 from_wkt
<G
>("SEGMENT(140 10, -140 80)"),
1480 tester::apply("s17-r",
1481 from_wkt
<G
>("SEGMENT(-140 80, 140 10)"),
1484 tester::apply("s18",
1485 from_wkt
<G
>("SEGMENT(20 10, 100 80)"),
1488 tester::apply("s18-r",
1489 from_wkt
<G
>("SEGMENT(100 80, 20 10)"),
1494 BOOST_AUTO_TEST_CASE( envelope_segment_sphere_with_height
)
1496 typedef bg::cs::spherical_equatorial
<bg::degree
> coordinate_system_type
;
1497 typedef bg::model::point
<double, 3, coordinate_system_type
> point_type
;
1498 typedef bg::model::segment
<point_type
> G
;
1499 typedef bg::model::box
<point_type
> B
;
1500 typedef test_envelope_on_sphere_or_spheroid
<G
, B
> tester
;
1502 tester::apply("sh01",
1503 from_wkt
<G
>("SEGMENT(10 10 567,40 40 1356)"),
1504 10, 10, 567, 40, 40, 1356);
1506 tester::apply("sh02",
1507 from_wkt
<G
>("SEGMENT(10 10 1356,40 40 567)"),
1508 10, 10, 567, 40, 40, 1356);
1511 BOOST_AUTO_TEST_CASE( envelope_segment_spheroid_with_height
)
1513 typedef bg::cs::geographic
<bg::degree
> coordinate_system_type
;
1514 typedef bg::model::point
<double, 3, coordinate_system_type
> point_type
;
1515 typedef bg::model::segment
<point_type
> G
;
1516 typedef bg::model::box
<point_type
> B
;
1517 typedef test_envelope_on_sphere_or_spheroid
<G
, B
> tester
;
1519 tester::apply("sh01",
1520 from_wkt
<G
>("SEGMENT(10 10 567,40 40 1356)"),
1521 10, 10, 567, 40, 40, 1356);
1523 tester::apply("sh02",
1524 from_wkt
<G
>("SEGMENT(10 10 1356,40 40 567)"),
1525 10, 10, 567, 40, 40, 1356);
1528 template <typename CoordinateSystem
>
1529 void test_envelope_multipoint()
1531 typedef bg::model::point
<double, 2, CoordinateSystem
> P
;
1532 typedef bg::model::multi_point
<P
> G
;
1533 typedef bg::model::box
<P
> B
;
1534 typedef test_envelope_on_sphere_or_spheroid
<G
, B
> tester
;
1537 test_empty_geometry
<CoordinateSystem
, G
>("mp00", "MULTIPOINT()");
1539 tester::apply("mp01",
1540 from_wkt
<G
>("MULTIPOINT(0 0,10 10)"),
1543 tester::apply("mp02",
1544 from_wkt
<G
>("MULTIPOINT(0 10,10 0)"),
1547 tester::apply("mp03",
1548 from_wkt
<G
>("MULTIPOINT(-10 20,0 10,10 0)"),
1551 tester::apply("mp04",
1552 from_wkt
<G
>("MULTIPOINT(-10 20,0 10,10 -15)"),
1555 tester::apply("mp05",
1556 from_wkt
<G
>("MULTIPOINT(-85 10,85 -20)"),
1559 tester::apply("mp06",
1560 from_wkt
<G
>("MULTIPOINT(-95 10,85 -20)"),
1563 tester::apply("mp07",
1564 from_wkt
<G
>("MULTIPOINT(-96 10,85 -20)"),
1565 85, -20, -96+360, 10);
1567 tester::apply("mp08",
1568 from_wkt
<G
>("MULTIPOINT(175 15,-175 -20)"),
1569 175, -20, -175+360, 15);
1571 tester::apply("mp09",
1572 from_wkt
<G
>("MULTIPOINT(170 15,170 20,-175 10,-90 10,10 10)"),
1573 170, 10, 10+360, 20);
1576 tester::apply("mp09a",
1577 from_wkt
<G
>("MULTIPOINT(10 10,170 15,170 20,-175 10,-90 10)"),
1578 170, 10, 10+360, 20);
1581 tester::apply("mp10",
1582 from_wkt
<G
>("MULTIPOINT(10 10,20 90,30 -90)"),
1586 tester::apply("mp11",
1587 from_wkt
<G
>("MULTIPOINT(179 90,-179 -90,10 10)"),
1590 tester::apply("mp11a",
1591 from_wkt
<G
>("MULTIPOINT(10 10,179 90,-179 -90)"),
1595 tester::apply("mp11b",
1596 from_wkt
<G
>("MULTIPOINT(179 90,-179 -90,-90 0)"),
1599 tester::apply("mp11c",
1600 from_wkt
<G
>("MULTIPOINT(-90 0,179 90,-179 -90,-90 0)"),
1603 tester::apply("mp12",
1604 from_wkt
<G
>("MULTIPOINT(170 -30,175 60,-178 10)"),
1605 170, -30, -178+360, 60);
1607 tester::apply("mp13",
1608 from_wkt
<G
>("MULTIPOINT(-170 -30,-175 40,178 50)"),
1609 178, -30, -170+360, 50);
1611 tester::apply("mp13a",
1612 from_wkt
<G
>("MULTIPOINT(-170 -30,178 50)"),
1613 178, -30, -170+360, 50);
1615 tester::apply("mp13b",
1616 from_wkt
<G
>("MULTIPOINT(-170 -30,178 50,-175 40)"),
1617 178, -30, -170+360, 50);
1619 tester::apply("mp15",
1620 from_wkt
<G
>("MULTIPOINT(10 -20)"),
1623 tester::apply("mp16",
1624 from_wkt
<G
>("MULTIPOINT(0 90,10 90)"),
1627 tester::apply("mp17",
1628 from_wkt
<G
>("MULTIPOINT(179 80,-179 -80,10 10)"),
1629 10, -80, -179+360, 80);
1631 tester::apply("mp17a",
1632 from_wkt
<G
>("MULTIPOINT(10 10,179 80,-179 -80)"),
1633 10, -80, -179+360, 80);
1635 tester::apply("mp17b",
1636 from_wkt
<G
>("MULTIPOINT(179 80,-179 -80,-90 0)"),
1637 179, -80, -90+360, 80);
1639 tester::apply("mp17c",
1640 from_wkt
<G
>("MULTIPOINT(-90 0,179 80,-179 -80,-90 0)"),
1641 179, -80, -90+360, 80);
1643 tester::apply("mp18",
1644 from_wkt
<G
>("MULTIPOINT(-170 45,20 25,40 40)"),
1647 #ifdef BOOST_GEOMETRY_NORMALIZE_LATITUDE
1648 tester::apply("mp18a",
1649 from_wkt
<G
>("MULTIPOINT(10 135,20 25,40 40)"),
1653 tester::apply("mp19",
1654 from_wkt
<G
>("MULTIPOINT(350 45,20 25,40 40)"),
1657 #ifdef BOOST_GEOMETRY_NORMALIZE_LATITUDE
1658 tester::apply("mp19a",
1659 from_wkt
<G
>("MULTIPOINT(170 135,20 25,40 40)"),
1663 double eps
= std::numeric_limits
<double>::epsilon();
1664 double heps
= eps
/ 2;
1667 mp
.push_back(P(1, 1));
1668 mp
.push_back(P(1-heps
, 1-heps
));
1669 tester::apply("mp20", mp
, 1-heps
, 1-heps
, 1, 1);
1673 BOOST_AUTO_TEST_CASE( envelope_multipoint
)
1675 test_envelope_multipoint
<bg::cs::spherical_equatorial
<bg::degree
> >();
1676 test_envelope_multipoint
<bg::cs::geographic
<bg::degree
> >();
1680 template <typename CoordinateSystem
>
1681 void test_envelope_multipoint_with_height()
1683 typedef bg::model::point
<double, 3, CoordinateSystem
> point_type
;
1684 typedef bg::model::multi_point
<point_type
> G
;
1685 typedef bg::model::box
<point_type
> B
;
1686 typedef test_envelope_on_sphere_or_spheroid
<G
, B
> tester
;
1689 test_empty_geometry
<CoordinateSystem
, G
>("mph00", "MULTIPOINT()");
1691 tester::apply("mph01",
1692 from_wkt
<G
>("MULTIPOINT(0 0 567,10 10 1456)"),
1693 0, 0, 567, 10, 10, 1456);
1695 tester::apply("mph02",
1696 from_wkt
<G
>("MULTIPOINT(0 0 567,10 10 1456,20 90 967)"),
1697 0, 0, 567, 10, 90, 1456);
1700 BOOST_AUTO_TEST_CASE( envelope_multipoint_with_height
)
1702 test_envelope_multipoint_with_height
1704 bg::cs::spherical_equatorial
<bg::degree
>
1706 test_envelope_multipoint_with_height
<bg::cs::geographic
<bg::degree
> >();
1710 template <typename CoordinateSystem
>
1711 void test_envelope_box()
1713 typedef bg::model::point
<double, 2, CoordinateSystem
> P
;
1714 typedef bg::model::box
<P
> G
;
1715 typedef bg::model::box
<P
> B
;
1716 typedef test_envelope_on_sphere_or_spheroid
<G
, B
> tester
;
1718 tester::apply("b01",
1719 from_wkt
<G
>("BOX(10 10,20 20)"),
1722 #ifdef BOOST_GEOMETRY_NORMALIZE_LATITUDE
1723 tester::apply("b02",
1724 from_wkt
<G
>("BOX(10 370,20 20)"),
1728 // box crosses anti-meridian
1729 tester::apply("b02a",
1730 from_wkt
<G
>("BOX(170 10,-170 20)"),
1733 tester::apply("b03",
1734 from_wkt
<G
>("BOX(-170 10,170 20)"),
1737 tester::apply("b04",
1738 from_wkt
<G
>("BOX(10 10,350 20)"),
1741 tester::apply("b04a",
1742 from_wkt
<G
>("BOX(10 10,-10 20)"),
1746 tester::apply("b05",
1747 from_wkt
<G
>("BOX(0 10,360 20)"),
1750 tester::apply("b05a",
1751 from_wkt
<G
>("BOX(0 10,0 20)"),
1754 // box is almost a band
1755 tester::apply("b06",
1756 from_wkt
<G
>("BOX(10 10,5 20)"),
1759 // initial box is a band that crosses itself
1760 tester::apply("b07",
1761 from_wkt
<G
>("BOX(0 10,540 20)"),
1764 // initial box is a band that crosses itself
1765 tester::apply("b08",
1766 from_wkt
<G
>("BOX(0 10,720 20)"),
1769 tester::apply("b09",
1770 from_wkt
<G
>("BOX(10 10,10 10)"),
1773 tester::apply("b09a",
1774 from_wkt
<G
>("BOX(370 10,370 10)"),
1777 // box contains north and south pole
1778 tester::apply("b10",
1779 from_wkt
<G
>("BOX(0 -90,0 90)"),
1782 // box contains north and south pole
1783 tester::apply("b10a",
1784 from_wkt
<G
>("BOX(10 -90,10 90)"),
1787 // box contains north and south pole
1788 tester::apply("b10b",
1789 from_wkt
<G
>("BOX(0 -90,10 90)"),
1792 // box contains north and south pole
1793 tester::apply("b11",
1794 from_wkt
<G
>("BOX(0 -90,180 90)"),
1797 // box contains north and south pole
1798 tester::apply("b11a",
1799 from_wkt
<G
>("BOX(10 -90,190 90)"),
1802 // box contains north and south pole
1803 tester::apply("b11b",
1804 from_wkt
<G
>("BOX(10 -90,110 90)"),
1807 // box contains north and south pole and is a band
1808 // (box covers the entire spheroid)
1809 tester::apply("b12",
1810 from_wkt
<G
>("BOX(0 -90,360 90)"),
1811 -180, -90, 180, 90);
1813 // box contains north and south pole and is a band
1814 // (box covers the entire spheroid)
1815 tester::apply("b12a",
1816 from_wkt
<G
>("BOX(10 -90,370 90)"),
1817 -180, -90, 180, 90);
1819 // box contains north and south pole and is a band
1820 // (box covers the entire spheroid)
1821 tester::apply("b12b",
1822 from_wkt
<G
>("BOX(-175 -90,185 90)"),
1823 -180, -90, 180, 90);
1825 // box contains north and south pole and is a band
1826 // (box covers the entire spheroid)
1827 tester::apply("b12c",
1828 from_wkt
<G
>("BOX(-175 -90,185 90)"),
1829 -180, -90, 180, 90);
1831 // box contains north and south pole and is a band and is self-intersecting
1832 // (box covers the entire spheroid)
1833 tester::apply("b12d",
1834 from_wkt
<G
>("BOX(-175 -90,186 90)"),
1835 -180, -90, 180, 90);
1837 // box contains north and south pole and is a band and is self-intersecting
1838 // (box covers the entire spheroid)
1839 tester::apply("b12e",
1840 from_wkt
<G
>("BOX(0 -90,540 90)"),
1841 -180, -90, 180, 90);
1843 // box contains north and south pole and is a band and is self-intersecting
1844 // (box covers the entire spheroid)
1845 tester::apply("b12f",
1846 from_wkt
<G
>("BOX(10 -90,540 90)"),
1847 -180, -90, 180, 90);
1850 tester::apply("b13",
1851 from_wkt
<G
>("BOX(180 -10,-180 10)"),
1852 -180, -10, 180, 10);
1854 // box contains north and south pole and is a band
1855 // (box covers the entire spheroid)
1856 tester::apply("b13a",
1857 from_wkt
<G
>("BOX(180 -90,-180 90)"),
1858 -180, -90, 180, 90);
1860 tester::apply("b14",
1861 from_wkt
<G
>("BOX(0 10,30 90)"),
1864 tester::apply("b15",
1865 from_wkt
<G
>("BOX(179 10,178 70)"),
1868 // box contains north pole
1869 tester::apply("b16",
1870 from_wkt
<G
>("BOX(10 40,20 90)"),
1873 tester::apply("b16a",
1874 from_wkt
<G
>("BOX(170 40,-170 90)"),
1877 // box contains south pole
1878 tester::apply("b17",
1879 from_wkt
<G
>("BOX(10 -90,20 40)"),
1882 tester::apply("b17a",
1883 from_wkt
<G
>("BOX(150 -90,-150 40)"),
1886 // box degenerates to the north pole
1887 tester::apply("b98",
1888 from_wkt
<G
>("BOX(10 90,20 90)"),
1891 // box degenerates to the south pole
1892 tester::apply("b99",
1893 from_wkt
<G
>("BOX(10 -90,20 -90)"),
1896 double eps
= std::numeric_limits
<double>::epsilon();
1897 double heps
= eps
/ 2;
1899 tester::apply("b100", G(P(1-heps
, 1-heps
), P(1, 1)), 1-heps
, 1-heps
, 1, 1);
1902 template <typename CoordinateSystem
>
1903 void test_envelope_box_polar()
1905 typedef bg::model::point
<double, 2, CoordinateSystem
> P
;
1906 typedef bg::model::box
<P
> G
;
1907 typedef bg::model::box
<P
> B
;
1908 typedef test_envelope_on_sphere_or_spheroid
<G
, B
> tester
;
1910 tester::apply("b01",
1911 from_wkt
<G
>("BOX(10 10,20 20)"),
1914 tester::apply("b02a",
1915 from_wkt
<G
>("BOX(170 10,-170 20)"),
1918 tester::apply("b10b",
1919 from_wkt
<G
>("BOX(0 0,10 180)"),
1922 tester::apply("b16a",
1923 from_wkt
<G
>("BOX(170 40,-170 180)"),
1927 BOOST_AUTO_TEST_CASE( envelope_box
)
1929 test_envelope_box
<bg::cs::spherical_equatorial
<bg::degree
> >();
1930 test_envelope_box
<bg::cs::geographic
<bg::degree
> >();
1931 test_envelope_box_polar
<bg::cs::spherical
<bg::degree
> >();
1935 template <typename CoordinateSystem
>
1936 void test_envelope_box_with_height()
1938 typedef bg::cs::spherical_equatorial
<bg::degree
> coordinate_system_type
;
1939 typedef bg::model::point
<double, 3, coordinate_system_type
> point_type
;
1940 typedef bg::model::box
<point_type
> G
;
1941 typedef bg::model::box
<point_type
> B
;
1942 typedef test_envelope_on_sphere_or_spheroid
<G
, B
> tester
;
1944 tester::apply("bh01",
1945 from_wkt
<G
>("BOX(10 10 567,20 20 2834)"),
1946 10, 10, 567, 20, 20, 2834);
1948 tester::apply("bh02",
1949 from_wkt
<G
>("BOX(10 10 567,20 20 567)"),
1950 10, 10, 567, 20, 20, 567);
1952 tester::apply("bh03",
1953 from_wkt
<G
>("BOX(0 10 567,170 90 1567)"),
1954 0, 10, 567, 170, 90, 1567);
1957 BOOST_AUTO_TEST_CASE( envelope_box_with_height
)
1959 test_envelope_box_with_height
<bg::cs::spherical_equatorial
<bg::degree
> >();
1960 test_envelope_box_with_height
<bg::cs::geographic
<bg::degree
> >();
1964 BOOST_AUTO_TEST_CASE( envelope_sphere_linestring
)
1966 typedef bg::cs::spherical_equatorial
<bg::degree
> coordinate_system_type
;
1967 typedef bg::model::point
<double, 2, coordinate_system_type
> P
;
1968 typedef bg::model::linestring
<P
> G
;
1969 typedef bg::model::box
<P
> B
;
1970 typedef test_envelope_on_sphere_or_spheroid
<G
, B
> tester
;
1973 test_empty_geometry
<coordinate_system_type
, G
>("l00", "LINESTRING()");
1975 tester::apply("l01",
1976 from_wkt
<G
>("LINESTRING(10 15)"),
1979 tester::apply("l01a",
1980 from_wkt
<G
>("LINESTRING(370 15)"),
1983 tester::apply("l01b",
1984 from_wkt
<G
>("LINESTRING(370 90)"),
1987 tester::apply("l02",
1988 from_wkt
<G
>("LINESTRING(10 10,20 20,10 30)"),
1991 // linestring that circles the entire globe
1992 tester::apply("l03",
1993 from_wkt
<G
>("LINESTRING(-185 0,-170 25,-50 10,10 10,20 20,100 5,180 15)"),
1994 -180, 0, 180, 33.587539971516854,
1995 4.0 * std::numeric_limits
<double>::epsilon());
1997 // linestring that crosses the antimeridian but staying close to it
1998 tester::apply("l04",
1999 from_wkt
<G
>("LINESTRING(-170 10,170 45,160 5,-160 25)"),
2002 // linestring that goes through the north pole (twice)
2003 tester::apply("l05",
2004 from_wkt
<G
>("LINESTRING(-170 80,10 60,20 80,-160 30)"),
2007 // linestring that goes through the north pole (three times)
2008 tester::apply("l05a",
2009 from_wkt
<G
>("LINESTRING(-170 80,10 60,20 80,-160 30,-150 30,30 70)"),
2012 // linestring that goes through the north pole (four times)
2013 tester::apply("l05b",
2014 from_wkt
<G
>("LINESTRING(-170 80,10 60,20 80,-160 30,-150 30,30 70,40 85,-140 25)"),
2017 // linestring that goes through the north pole (five times)
2018 tester::apply("l05c",
2019 from_wkt
<G
>("LINESTRING(-170 80,10 60,20 80,-160 30,-150 30,30 70,40 85,-140 25,-130 25,50 45)"),
2022 // linestring that goes through the north pole (five times)
2023 tester::apply("l05d",
2024 from_wkt
<G
>("LINESTRING(-170 80,10 60,20 80,-160 30,-150 30,30 70,40 85,-140 25,-130 25,50 45,185 45)"),
2027 // linestring that crosses the antimeridian
2028 tester::apply("l06",
2029 from_wkt
<G
>("LINESTRING(-160 85,-170 80,170 40,160 80)"),
2032 // linestring that crosses the antimeridian
2033 tester::apply("l06a",
2034 from_wkt
<G
>("LINESTRING(-130 85,-170 84,170 40,160 80)"),
2035 160, 40, 230, 85.02629680862029);
2037 // linestring that goes through the north pole
2038 tester::apply("l07",
2039 from_wkt
<G
>("LINESTRING(-160 40,-170 90,-140 40,-50 30)"),
2042 // linestring that degenerates to the north pole
2043 tester::apply("l08",
2044 from_wkt
<G
>("LINESTRING(-40 90,-30 90,-140 90,10 90)"),
2047 // linestring with duplicate points
2048 tester::apply("l09",
2049 from_wkt
<G
>("LINESTRING(-40 20,-40 20,-140 85,-10 5,-10 5)"),
2050 -140, 5, -10, 86.184540574427757);
2052 // linestring with duplicate points
2053 tester::apply("l09a",
2054 from_wkt
<G
>("LINESTRING(-40 20,320 20,-140 85,-10 5,350 5)"),
2055 -140, 5, -10, 86.184540574427757);
2057 // linestring that lies on the equator
2058 tester::apply("l10",
2059 from_wkt
<G
>("LINESTRING(0 0,50 0)"),
2062 // linestring that lies on the equator
2063 tester::apply("l10a",
2064 from_wkt
<G
>("LINESTRING(-50 0,50 0)"),
2067 // linestring that lies on the equator and touches antimeridian
2068 tester::apply("l10b",
2069 from_wkt
<G
>("LINESTRING(50 0,180 0)"),
2072 // linestring that lies on the equator and crosses antimeridian
2073 tester::apply("l10c",
2074 from_wkt
<G
>("LINESTRING(-170 0,160 0)"),
2077 // https://github.com/boostorg/geometry/issues/935
2078 tester::apply("github_issue_935",
2079 from_wkt
<G
>("LINESTRING(4.5055430885891123e-05 -2.7518149670422367e-06,\
2080 4.5055130529987143e-05 8.2400127103300943e-07,\
2081 4.5054830174083163e-05 4.3998175091082556e-06)"),
2082 4.5054830174083163e-05, -2.7518149670422367e-06,
2083 4.5055430885891123e-05, 4.3998175091082556e-06);
2086 double eps
= std::numeric_limits
<double>::epsilon();
2087 double heps
= eps
/ 2;
2091 l
.push_back(P(1, 1));
2092 l
.push_back(P(1-heps
, 1-heps
));
2093 tester::apply("l11", l
, 1-heps
, 1-heps
, 1, 1);
2098 l
.push_back(P(0, 0));
2099 l
.push_back(P(1-heps
, 1-heps
));
2100 l
.push_back(P(0, 0));
2101 l
.push_back(P(1, 1));
2102 tester::apply("l12", l
, 0, 0, 1, 1);
2106 BOOST_AUTO_TEST_CASE( envelope_spheroid_linestring
)
2108 typedef bg::cs::geographic
<bg::degree
> coordinate_system_type
;
2109 typedef bg::model::point
<double, 2, coordinate_system_type
> P
;
2110 typedef bg::model::linestring
<P
> G
;
2111 typedef bg::model::box
<P
> B
;
2112 typedef test_envelope_on_sphere_or_spheroid
<G
, B
> tester
;
2115 test_empty_geometry
<coordinate_system_type
, G
>("l00", "LINESTRING()");
2117 tester::apply("l01",
2118 from_wkt
<G
>("LINESTRING(10 15)"),
2121 tester::apply("l01a",
2122 from_wkt
<G
>("LINESTRING(370 15)"),
2125 tester::apply("l01b",
2126 from_wkt
<G
>("LINESTRING(370 90)"),
2129 tester::apply("l02",
2130 from_wkt
<G
>("LINESTRING(10 10,20 20,10 30)"),
2133 // linestring that circles the entire globe
2134 tester::apply("l03",
2135 from_wkt
<G
>("LINESTRING(-185 0,-170 25,-50 10,10 10,20 20,100 5,180 15)"),
2136 -180, 0, 180, rng(33.702476580412359, 33.702476580413318));
2138 // linestring that crosses the antimeridian but staying close to it
2139 tester::apply("l04",
2140 from_wkt
<G
>("LINESTRING(-170 10,170 45,160 5,-160 25)"),
2143 // linestring that goes through the north pole (twice)
2144 tester::apply("l05",
2145 from_wkt
<G
>("LINESTRING(-170 80,10 60,20 80,-160 30)"),
2148 // linestring that goes through the north pole (three times)
2149 tester::apply("l05a",
2150 from_wkt
<G
>("LINESTRING(-170 80,10 60,20 80,-160 30,-150 30,30 70)"),
2153 // linestring that goes through the north pole (four times)
2154 tester::apply("l05b",
2155 from_wkt
<G
>("LINESTRING(-170 80,10 60,20 80,-160 30,-150 30,30 70,40 85,-140 25)"),
2158 // linestring that goes through the north pole (five times)
2159 tester::apply("l05c",
2160 from_wkt
<G
>("LINESTRING(-170 80,10 60,20 80,-160 30,-150 30,30 70,40 85,-140 25,-130 25,50 45)"),
2163 // linestring that goes through the north pole (five times)
2164 tester::apply("l05d",
2165 from_wkt
<G
>("LINESTRING(-170 80,10 60,20 80,-160 30,-150 30,30 70,40 85,-140 25,-130 25,50 45,185 45)"),
2168 // linestring that crosses the antimeridian
2169 tester::apply("l06",
2170 from_wkt
<G
>("LINESTRING(-160 85,-170 80,170 40,160 80)"),
2173 // linestring that crosses the antimeridian
2174 tester::apply("l06a",
2175 from_wkt
<G
>("LINESTRING(-130 85,-170 84,170 40,160 80)"),
2176 160, 40, 230, 85.02630556315151);
2178 // linestring that goes through the north pole
2179 tester::apply("l07",
2180 from_wkt
<G
>("LINESTRING(-160 40,-170 90,-140 40,-50 30)"),
2183 // linestring that degenerates to the north pole
2184 tester::apply("l08",
2185 from_wkt
<G
>("LINESTRING(-40 90,-30 90,-140 90,10 90)"),
2188 // linestring with duplicate points
2189 tester::apply("l09",
2190 from_wkt
<G
>("LINESTRING(-40 20,-40 20,-140 85,-10 5,-10 5)"),
2191 -140, 5, -10, 86.18564770636192);
2193 // linestring with duplicate points
2194 tester::apply("l09a",
2195 from_wkt
<G
>("LINESTRING(-40 20,320 20,-140 85,-10 5,350 5)"),
2196 -140, 5, -10, 86.18564770636192);
2198 // linestring that lies on the equator
2199 tester::apply("l10",
2200 from_wkt
<G
>("LINESTRING(0 0,50 0)"),
2203 // linestring that lies on the equator
2204 tester::apply("l10a",
2205 from_wkt
<G
>("LINESTRING(-50 0,50 0)"),
2208 // linestring that lies on the equator and touches antimeridian
2209 tester::apply("l10b",
2210 from_wkt
<G
>("LINESTRING(50 0,180 0)"),
2213 // linestring that lies on the equator and crosses antimeridian
2214 tester::apply("l10c",
2215 from_wkt
<G
>("LINESTRING(-170 0,160 0)"),
2218 // https://github.com/boostorg/geometry/issues/935
2219 tester::apply("github_issue_935",
2220 from_wkt
<G
>("LINESTRING(4.5055430885891123e-05 -2.7518149670422367e-06,\
2221 4.5055130529987143e-05 8.2400127103300943e-07,\
2222 4.5054830174083163e-05 4.3998175091082556e-06)"),
2223 4.5054830174083163e-05, -2.7518149670422367e-06,
2224 4.5055430885891123e-05, 4.3998175091082556e-06);
2226 double eps
= std::numeric_limits
<double>::epsilon();
2227 double heps
= eps
/ 2;
2231 l
.push_back(P(1, 1));
2232 l
.push_back(P(1-heps
, 1-heps
));
2233 tester::apply("l11", l
, 1-heps
, 1-heps
, 1, 1);
2238 l
.push_back(P(0, 0));
2239 l
.push_back(P(1-heps
, 1-heps
));
2240 l
.push_back(P(0, 0));
2241 l
.push_back(P(1, 1));
2242 tester::apply("l12", l
, 0, 0, 1, 1);
2247 BOOST_AUTO_TEST_CASE( envelope_linestring_sphere_with_height
)
2249 typedef bg::cs::spherical_equatorial
<bg::degree
> coordinate_system_type
;
2250 typedef bg::model::point
<double, 3, coordinate_system_type
> point_type
;
2251 typedef bg::model::linestring
<point_type
> G
;
2252 typedef bg::model::box
<point_type
> B
;
2253 typedef test_envelope_on_sphere_or_spheroid
<G
, B
> tester
;
2256 test_empty_geometry
<coordinate_system_type
, G
>("lh00", "LINESTRING()");
2258 tester::apply("lh01",
2259 from_wkt
<G
>("LINESTRING(10 15 30,20 25 434,30 35 186)"),
2260 10, 15, 30, 30, 35, 434);
2263 BOOST_AUTO_TEST_CASE( envelope_linestring_spheroid_with_height
)
2265 typedef bg::cs::geographic
<bg::degree
> coordinate_system_type
;
2266 typedef bg::model::point
<double, 3, coordinate_system_type
> point_type
;
2267 typedef bg::model::linestring
<point_type
> G
;
2268 typedef bg::model::box
<point_type
> B
;
2269 typedef test_envelope_on_sphere_or_spheroid
<G
, B
> tester
;
2272 test_empty_geometry
<coordinate_system_type
, G
>("lh00", "LINESTRING()");
2274 tester::apply("lh01",
2275 from_wkt
<G
>("LINESTRING(10 15 30,20 25 434,30 35 186)"),
2276 10, 15, 30, 30, 35, 434);
2279 BOOST_AUTO_TEST_CASE( envelope_sphere_multilinestring
)
2281 typedef bg::cs::spherical_equatorial
<bg::degree
> coordinate_system_type
;
2282 typedef bg::model::point
<double, 2, coordinate_system_type
> point_type
;
2283 typedef bg::model::multi_linestring
<bg::model::linestring
<point_type
> > G
;
2284 typedef bg::model::box
<point_type
> B
;
2285 typedef test_envelope_on_sphere_or_spheroid
<G
, B
> tester
;
2287 // empty multilinestring
2288 test_empty_geometry
<coordinate_system_type
, G
>("ml00", "MULTILINESTRING()");
2290 // invalid multilinestring
2291 test_empty_geometry
<coordinate_system_type
, G
>("ml00a",
2292 "MULTILINESTRING(())");
2294 // invalid multilinestring
2295 test_empty_geometry
<coordinate_system_type
, G
>("ml00b",
2296 "MULTILINESTRING((),())");
2298 // invalid multilinestring
2299 tester::apply("ml00c",
2300 from_wkt
<G
>("MULTILINESTRING((10 15),(),())"),
2303 // invalid multilinestring
2304 tester::apply("ml00d",
2305 from_wkt
<G
>("MULTILINESTRING((),(10 15),())"),
2308 tester::apply("ml01",
2309 from_wkt
<G
>("MULTILINESTRING((10 15))"),
2312 #ifdef BOOST_GEOMETRY_TEST_FAILURES
2313 tester::apply("ml01a",
2314 from_wkt
<G
>("MULTILINESTRING((),(),(10 15),())"),
2318 tester::apply("ml02",
2319 from_wkt
<G
>("MULTILINESTRING((-170 40,-100 80,10 40),(-10 25,10 35,100 45),(50 30,150 45,-160 30))"),
2320 -180, 25, 180, 81.113793608034072);
2322 tester::apply("ml03",
2323 from_wkt
<G
>("MULTILINESTRING((-150 40,-100 80,10 40),(-10 25,10 35,100 45),(50 30,150 45,-160 30))"),
2324 -150, 25, 200, 81.113793608034072);
2326 tester::apply("ml04",
2327 from_wkt
<G
>("MULTILINESTRING((-150 40,-100 80),(10 35,100 80))"),
2328 -150, 35, 100, 80.07385383411011);
2330 tester::apply("ml04a",
2331 from_wkt
<G
>("MULTILINESTRING((-150 40,-100 80),(10 35,100 80),(170 25,-160 80))"),
2332 10, 25, 260, 80.07385383411011);
2334 tester::apply("ml05",
2335 from_wkt
<G
>("MULTILINESTRING((-140 40,-100 80),(10 35,100 80))"),
2336 -140, 35, 100, 80.07385383411011);
2338 tester::apply("ml05a",
2339 from_wkt
<G
>("MULTILINESTRING((-140 40,-100 80),(10 35,100 80),(170 25,-160 80))"),
2340 10, 25, 260, 80.07385383411011);
2343 BOOST_AUTO_TEST_CASE( envelope_spheroid_multilinestring
)
2345 typedef bg::cs::geographic
<bg::degree
> coordinate_system_type
;
2346 typedef bg::model::point
<double, 2, coordinate_system_type
> point_type
;
2347 typedef bg::model::multi_linestring
<bg::model::linestring
<point_type
> > G
;
2348 typedef bg::model::box
<point_type
> B
;
2349 typedef test_envelope_on_sphere_or_spheroid
<G
, B
> tester
;
2351 // empty multilinestring
2352 test_empty_geometry
<coordinate_system_type
, G
>("ml00", "MULTILINESTRING()");
2354 // invalid multilinestring
2355 test_empty_geometry
<coordinate_system_type
, G
>("ml00a",
2356 "MULTILINESTRING(())");
2358 // invalid multilinestring
2359 test_empty_geometry
<coordinate_system_type
, G
>("ml00b",
2360 "MULTILINESTRING((),())");
2362 // invalid multilinestring
2363 tester::apply("ml00c",
2364 from_wkt
<G
>("MULTILINESTRING((10 15),(),())"),
2367 // invalid multilinestring
2368 tester::apply("ml00d",
2369 from_wkt
<G
>("MULTILINESTRING((),(10 15),())"),
2372 tester::apply("ml01",
2373 from_wkt
<G
>("MULTILINESTRING((10 15))"),
2376 #ifdef BOOST_GEOMETRY_TEST_FAILURES
2377 tester::apply("ml01a",
2378 from_wkt
<G
>("MULTILINESTRING((),(),(10 15),())"),
2382 tester::apply("ml02",
2383 from_wkt
<G
>("MULTILINESTRING((-170 40,-100 80,10 40),(-10 25,10 35,100 45),(50 30,150 45,-160 30))"),
2384 -180, 25, 180, 81.115885076701147);
2386 tester::apply("ml03",
2387 from_wkt
<G
>("MULTILINESTRING((-150 40,-100 80,10 40),(-10 25,10 35,100 45),(50 30,150 45,-160 30))"),
2388 -150, 25, 200, 81.115885076701147);
2390 tester::apply("ml04",
2391 from_wkt
<G
>("MULTILINESTRING((-150 40,-100 80),(10 35,100 80))"),
2392 -150, 35, 100, rng(80.07385383411011, 80.082544902477267));
2394 tester::apply("ml04a",
2395 from_wkt
<G
>("MULTILINESTRING((-150 40,-100 80),(10 35,100 80),(170 25,-160 80))"),
2396 10, 25, 260, rng(80.07385383411011, 80.082544902477267));
2398 tester::apply("ml05",
2399 from_wkt
<G
>("MULTILINESTRING((-140 40,-100 80),(10 35,100 80))"),
2400 -140, 35, 100, rng(80.07385383411011, 80.082544902477267));
2402 tester::apply("ml05a",
2403 from_wkt
<G
>("MULTILINESTRING((-140 40,-100 80),(10 35,100 80),(170 25,-160 80))"),
2404 10, 25, 260, rng(80.07385383411011, 80.082544902477267));
2408 BOOST_AUTO_TEST_CASE( envelope_multilinestring_sphere_with_height
)
2410 typedef bg::cs::spherical_equatorial
<bg::degree
> coordinate_system_type
;
2411 typedef bg::model::point
<double, 3, coordinate_system_type
> point_type
;
2412 typedef bg::model::multi_linestring
<bg::model::linestring
<point_type
> > G
;
2413 typedef bg::model::box
<point_type
> B
;
2414 typedef test_envelope_on_sphere_or_spheroid
<G
, B
> tester
;
2416 tester::apply("mlh01",
2417 from_wkt
<G
>("MULTILINESTRING((10 15 1000))"),
2418 10, 15, 1000, 10, 15, 1000);
2420 #ifdef BOOST_GEOMETRY_TEST_FAILURES
2421 tester::apply("mlh01a",
2422 from_wkt
<G
>("MULTILINESTRING((),(),(10 15 1000),())"),
2423 10, 15, 1000, 10, 15, 1000);
2426 tester::apply("mlh02",
2427 from_wkt
<G
>("MULTILINESTRING((-170 40 400,-100 80 300),(-10 25 600,10 35 700,120 45 450))"),
2428 -10, 25, 300, 260, 80, 700);
2431 BOOST_AUTO_TEST_CASE( envelope_multilinestring_spheroid_with_height
)
2433 typedef bg::cs::geographic
<bg::degree
> coordinate_system_type
;
2434 typedef bg::model::point
<double, 3, coordinate_system_type
> point_type
;
2435 typedef bg::model::multi_linestring
<bg::model::linestring
<point_type
> > G
;
2436 typedef bg::model::box
<point_type
> B
;
2437 typedef test_envelope_on_sphere_or_spheroid
<G
, B
> tester
;
2439 tester::apply("mlh01",
2440 from_wkt
<G
>("MULTILINESTRING((10 15 1000))"),
2441 10, 15, 1000, 10, 15, 1000);
2443 #ifdef BOOST_GEOMETRY_TEST_FAILURES
2444 tester::apply("mlh01a",
2445 from_wkt
<G
>("MULTILINESTRING((),(),(10 15 1000),())"),
2446 10, 15, 1000, 10, 15, 1000);
2449 tester::apply("mlh02",
2450 from_wkt
<G
>("MULTILINESTRING((-170 40 400,-100 80 300),(-10 25 600,10 35 700,120 45 450))"),
2451 -10, 25, 300, 260, 80, 700);
2454 //Test spherical polygons and rings (geographic should be similar)
2455 BOOST_AUTO_TEST_CASE( envelope_polygon
)
2457 typedef bg::cs::spherical_equatorial
<bg::degree
> coordinate_system_type
;
2458 typedef bg::model::point
<double, 2, coordinate_system_type
> point_type
;
2459 typedef bg::model::polygon
<point_type
> G
;
2460 typedef bg::model::box
<point_type
> B
;
2461 typedef test_envelope_on_sphere_or_spheroid
<G
, B
> tester
;
2463 typedef bg::model::ring
<point_type
> R
;
2464 typedef test_envelope_on_sphere_or_spheroid
<R
, B
> testerR
;
2466 bg::append(ring1
, point_type(0.0, 0.0));
2467 bg::append(ring1
, point_type(0.0, 5.0));
2468 bg::append(ring1
, point_type(5.0, 5.0));
2469 bg::append(ring1
, point_type(5.0, 0.0));
2470 bg::append(ring1
, point_type(0.0, 0.0));
2472 testerR::apply("r01",
2474 0, 0, 5, 5.0047392446083938);
2475 tester::apply("p01",
2476 from_wkt
<G
>("POLYGON((0 0,1 0,1 1,0 1,0 0))"),
2477 0, 0, 1, 1.0000380706527705);
2478 tester::apply("p02",
2479 from_wkt
<G
>("POLYGON((0 0,1 0,1 1,0 1,0 0),(0.5 0.5,0.7 0.5,0.7 0.7,0.5 0.5))"),
2480 0, 0, 1, 1.0000380706527705);
2481 tester::apply("p03",
2482 from_wkt
<G
>("POLYGON((),(0.5 0.5,0.5 0.7,0.7 0.7,0.5 0.5))"),
2483 0.5, 0.5, 0.7, 0.70000106605644807);
2484 tester::apply("p04",
2485 from_wkt
<G
>("POLYGON((),(0.5 0.5,0.5 0.7,0.7 0.7,0.5 0.5),\
2486 (0.7 0.5,0.9 0.5,0.9 0.7,0.7 0.5))"),
2487 0.5, 0.5, 0.9, 0.70000106605644807);
2489 // https://github.com/boostorg/geometry/issues/466
2490 tester::apply("p5-issue466",
2491 from_wkt
<G
>("POLYGON((2.4 48.9021,2.4 48.89,2.3 48.89,2.3 48.9021,2.4 48.9021))"),
2492 2.3, 48.89, 2.4, 48.902110807274966);
2493 tester::apply("p6-issue466",
2494 from_wkt
<G
>("POLYGON((2.4 48.90215,2.4 48.89,2.3 48.89,2.3 48.90215,2.4 48.90215))"),
2495 2.3, 48.89, 2.4, 48.902160807272381);
2496 tester::apply("p7-issue466",
2497 from_wkt
<G
>("POLYGON((2.4 48.9022,2.4 48.89,2.3 48.89,2.3 48.9022,2.4 48.9022))"),
2498 2.3, 48.89, 2.4, 48.902210807269796);
2501 // unit test for rings de-activated for now (current implementation
2502 // for area on the spherical equatorial coordinate system is not complete)
2503 // TODO: re-activate once implementation is done
2504 // right now implementation does not distinguish between ccw and cw rings
2505 BOOST_AUTO_TEST_CASE( envelope_cw_ring
)
2507 typedef bg::cs::spherical_equatorial
<bg::degree
> coordinate_system_type
;
2508 typedef bg::model::point
<double, 2, coordinate_system_type
> point_type
;
2509 typedef bg::model::polygon
<point_type
> G
;
2510 typedef bg::model::box
<point_type
> B
;
2511 typedef test_envelope_on_sphere_or_spheroid
<G
, B
> tester
;
2513 double const eps
= std::numeric_limits
<double>::epsilon();
2515 tester::apply("r01cw",
2516 from_wkt
<G
>("POLYGON((0 10,0 45,50 10,0 10))"),
2519 #ifdef BOOST_GEOMETRY_TEST_ENABLE_FAILING
2520 // ring that contains both the north and south poles in its interior
2521 tester::apply("r01cw-r",
2522 from_wkt
<G
>("POLYGON((0 10,50 10,0 45,0 10))"),
2523 -180, -90, 180, 90);
2526 // ring that contains the north pole in its interior
2527 tester::apply("r02cw",
2528 from_wkt
<G
>("POLYGON((0 0,-50 0,-170 0,180 0,100 0,0 0))"),
2530 // -180, -90, 180, 0);
2532 // ring that contains the south pole in its interior
2533 tester::apply("r02cw-r",
2534 from_wkt
<G
>("POLYGON((0 0,100 0,180 0,-170 0,-50 0,0 0))"),
2536 // -180, 0, 180, 90);
2538 // ring that contains the north pole in its interior
2539 tester::apply("r03cw",
2540 from_wkt
<G
>("POLYGON((0 -10,-50 -10,-170 -10,180 -10,100 -10,0 -10))"),
2541 -180, -19.42540014068282, 180, 90);
2542 // -180, -90, 180, -10);
2544 // ring that contains both the south and north poles in its interior
2545 tester::apply("r03cw-r",
2546 from_wkt
<G
>("POLYGON((0 -10,100 -10,180 -10,-170 -10,-50 -10,0 -10))"),
2547 -180, -90, 180, -10);
2548 // -180, -19.42540014068282, 180, 90);
2550 #ifdef BOOST_GEOMETRY_TEST_ENABLE_FAILING
2551 // ring that has the north pole as vertex and contains the south pole
2552 tester::apply("r04cw",
2553 from_wkt
<G
>("POLYGON((0 0,-50 90,-50 0,0 0))"),
2554 -180, -90, 180, 90);
2557 // ring that has the north pole as vertex
2558 tester::apply("r04cw-r",
2559 from_wkt
<G
>("POLYGON((0 0,-50 0,-50 90,0 0))"),
2562 // ring that crosses antimeridian but does not contain any pole
2563 tester::apply("r05cw",
2564 from_wkt
<G
>("POLYGON((-140 0,140 10,-140 80,-140 0))"),
2567 // ring that crosses antimeridian multiple times but does not
2569 tester::apply("r06cw",
2570 from_wkt
<G
>("POLYGON((-140 10,140 10,140 80,-140 80,-140 10))"),
2571 140, 10, 220, 82.30737118075496,
2574 // ring that crosses antimeridian multiple times but does not
2576 tester::apply("r07cw",
2577 from_wkt
<G
>("POLYGON((-140 10,140 10,180 80,-140 10))"),
2580 // ring that goes through the north pole
2581 tester::apply("r08cw",
2582 from_wkt
<G
>("POLYGON((0 0,-50 0,-50 90,0 0))"),
2585 #ifdef BOOST_GEOMETRY_TEST_ENABLE_FAILING
2586 // ring that goes through the south pole and contains the north pole
2587 tester::apply("r09cw",
2588 from_wkt
<G
>("POLYGON((0 0,0 -90,50 0,0 0))"),
2589 -180, -90, 180, 90);
2592 // ring that goes through the south pole
2593 tester::apply("r09cw-r",
2594 from_wkt
<G
>("POLYGON((0 0,50 0,50 -90,0 0))"),
2597 // ring that goes through both south and north pole
2598 tester::apply("r10cw",
2599 from_wkt
<G
>("POLYGON((50 0,50 -90,40 0,40 90,50 0))"),
2602 // ring that goes through both south and north pole and crosses antimeridian
2603 tester::apply("r11cw",
2604 from_wkt
<G
>("POLYGON((-170 0,-170 -90,160 0,160 90,-170 0))"),
2607 // ring with edge that goes through the north pole and contains
2608 // south pole (the bounding box is the entire globe)
2609 tester::apply("r12cw",
2610 from_wkt
<G
>("POLYGON((-50 40,130 10,170 80,-50 40))"),
2611 -180, -90, 180, 90);
2612 // -180, 10, 180, 90);
2614 // ring with edge that goes through the north pole
2615 tester::apply("r12cw-r",
2616 from_wkt
<G
>("POLYGON((-50 40,170 80,130 10,-50 40))"),
2618 // -180, -90, 180, 90);
2620 // ring that represents a spherical cap near the north pole
2621 tester::apply("r13cw",
2622 from_wkt
<G
>("POLYGON((100 45,0 45,-100 45,-100 90,100 45))"),
2625 #ifdef BOOST_GEOMETRY_TEST_ENABLE_FAILING
2626 // ring that represents the complement of a spherical cap
2627 // near the north pole
2628 tester::apply("r13cw-r",
2629 from_wkt
<G
>("POLYGON((-100 45,0 45,100 45,100 90,-100 45))"),
2630 -180, -90, 180, 90);
2633 // ring that represents the complement of a spherical cap
2634 // that touches the south pole
2635 tester::apply("r14cw",
2636 from_wkt
<G
>("POLYGON((-100 45,0 45,100 45,100 -90,-100 45))"),
2637 -100, -90, 100, 57.26759279038765);
2639 #ifdef BOOST_GEOMETRY_TEST_ENABLE_FAILING
2640 // ring that represents a spherical cap that touches the south pole
2641 tester::apply("r14cw-r",
2642 from_wkt
<G
>("POLYGON((100 45,0 45,-100 45,-100 -90,100 45))"),
2643 -180, -90, 180, 90);
2646 // ring with edge that goes through the south pole
2647 tester::apply("r15cw",
2648 from_wkt
<G
>("POLYGON((-50 -40,130 -10,170 -80,-50 -40))"),
2649 -180, -90, 180, -10);
2651 // ring with edge that goes through the south pole and contains
2652 // north pole (the bounding box is the entire globe)
2653 tester::apply("r15cw-r",
2654 from_wkt
<G
>("POLYGON((-50 -40,170 -80,130 -10,-50 -40))"),
2655 -180, -90, 180, 90);
2657 // ring that does not contain any pole and lies in the lower hemisphere
2658 tester::apply("r16",
2659 from_wkt
<G
>("POLYGON((-50 -80,-50 -40,-30 -40,-30 -80,-50 -80))"),
2660 -50, -80.14892388341609, -30, -40);
2662 #ifdef BOOST_GEOMETRY_TEST_ENABLE_FAILING
2663 // ring that lies in the lower hemisphere and contains both poles
2664 tester::apply("r16-r",
2665 from_wkt
<G
>("POLYGON((-50 -80,-30 -80,-30 -40,-50 -40,-50 -80))"),
2666 -180, -90, 180, 90);
2668 // ring that goes through the south pole and contains the north pole
2669 tester::apply("r17cw",
2670 from_wkt
<G
>("POLYGON((50 0,50 -90,100 0,50 0))"),
2671 -180, -90, 180, 90);
2674 // ring that goes through the south pole
2675 tester::apply("r17cw-r",
2676 from_wkt
<G
>("POLYGON((50 0,100 0,100 -90,50 0))"),
2679 #ifdef BOOST_GEOMETRY_TEST_ENABLE_FAILING
2680 // ring that goes through the south pole and contains the north pole
2681 tester::apply("r18cw",
2682 from_wkt
<G
>("POLYGON((50 0,50 -90,460 0,50 0))"),
2683 -180, -90, 180, 90);
2686 // ring that goes through the south pole
2687 tester::apply("r18cw-r",
2688 from_wkt
<G
>("POLYGON((50 0,460 0,100 -90,50 0))"),
2691 #ifdef BOOST_GEOMETRY_TEST_ENABLE_FAILING
2692 // ring that goes through the south pole and contains the north pole
2693 tester::apply("r19cw",
2694 from_wkt
<G
>("POLYGON((50 0,50 -90,-260 0,50 0))"),
2695 -180, -90, 180, 90);
2698 // ring that goes through the south pole
2699 tester::apply("r19cw-r",
2700 from_wkt
<G
>("POLYGON((50 0,-260 0,100 -90,50 0))"),
2703 // ring that goes through both poles
2704 tester::apply("r20cw",
2705 from_wkt
<G
>("POLYGON((10 0,10 90,20 0,20 -90,10 0))"),
2706 10, -90, 20, 90); // SUCCEEDS FOR WRONG REASON
2708 #ifdef BOOST_GEOMETRY_TEST_ENABLE_FAILING
2709 // ring that goes through both poles
2710 tester::apply("r20cw-r",
2711 from_wkt
<G
>("POLYGON((10 0,10 -90,20 0,20 90,10 0))"),
2712 -180, -90, 180, 90);
2715 // ring that goes through both poles and its boundary forms
2717 tester::apply("r21cw",
2718 from_wkt
<G
>("POLYGON((-10 0,-10 90,170 0,170 -90,-10 0))"),
2719 -10, -90, 170, 90); // SUCCEEDS FOR WRONG REASON
2721 #ifdef BOOST_GEOMETRY_TEST_ENABLE_FAILING
2722 // ring that goes through both poles and its boundary forms
2724 tester::apply("r21cw-r",
2725 from_wkt
<G
>("POLYGON((-10 0,-10 -90,170 0,170 90,-10 0))"),
2729 // From disjoint https://svn.boost.org/trac/boost/ticket/9162
2730 // Polygons containing poles
2731 tester::apply("r22cw",
2732 from_wkt
<G
>("POLYGON((0 80,-90 80,-180 80,90 80,0 80))"),
2734 tester::apply("r23cw",
2735 from_wkt
<G
>("POLYGON((0 -80,90 -80,-180 -80,-90 -80,0 -80))"),
2736 -180, -90, 180, -80);
2737 // Polygons greater than half of the globe
2738 tester::apply("r24cw",
2739 from_wkt
<G
>("POLYGON((0 80,90 80,-180 80,-90 80,0 80))"),
2740 -180, -90, 180, 82.892923889553458);
2741 tester::apply("r25cw",
2742 from_wkt
<G
>("POLYGON((0 -80,-90 -80,-180 -80,90 -80,0 -80))"),
2743 -180, -82.892923889553458, 180, 90);
2745 tester::apply("r26cw",
2746 from_wkt
<G
>("POLYGON((30 0,30 30,90 30, 90 0, 30 0))"),
2747 30, 0, 90, 33.690067525979771);
2749 // Invalid polygons with holes containing poles
2750 tester::apply("r27cw",
2751 from_wkt
<G
>("POLYGON((),(0 80,90 80,-180 80,-90 80,0 80))"),
2753 tester::apply("r28cw",
2754 from_wkt
<G
>("POLYGON((),(0 -80,-90 -80,-180 -80,90 -80,0 -80))"),
2755 -180, -90, 180, -80);
2758 BOOST_AUTO_TEST_CASE(envelope_ccw_ring
)
2760 typedef bg::cs::spherical_equatorial
<bg::degree
> coordinate_system_type
;
2761 typedef bg::model::point
<double, 2, coordinate_system_type
> point_type
;
2762 typedef bg::model::polygon
<point_type
, false> G
;
2763 typedef bg::model::box
<point_type
> B
;
2764 typedef test_envelope_on_sphere_or_spheroid
<G
, B
> tester
;
2766 tester::apply("r27ccw",
2767 from_wkt
<G
>("POLYGON((),(0 80,-90 80,-180 80,90 80,0 80))"),
2769 tester::apply("r28ccw",
2770 from_wkt
<G
>("POLYGON((),(0 -80,90 -80,-180 -80,-90 -80,0 -80))"),
2771 -180, -90, 180, -80);