]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/test/algorithms/distance/distance.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / geometry / test / algorithms / distance / distance.cpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2 // Unit Test
3
4 // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
5 // Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
6 // Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
7
8 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
9 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
10
11 // Use, modification and distribution is subject to the Boost Software License,
12 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
13 // http://www.boost.org/LICENSE_1_0.txt)
14
15
16 #include <string>
17 #include <sstream>
18
19 #include "test_distance.hpp"
20
21 #include <boost/mpl/if.hpp>
22 #include <boost/array.hpp>
23
24 #include <boost/geometry/geometries/geometries.hpp>
25 #include <boost/geometry/geometries/point_xy.hpp>
26 #include <boost/geometry/geometries/adapted/c_array.hpp>
27 #include <boost/geometry/geometries/adapted/boost_tuple.hpp>
28
29 #include <test_common/test_point.hpp>
30 #include <test_geometries/custom_segment.hpp>
31 #include <test_geometries/wrapped_boost_array.hpp>
32
33 #include <boost/variant/variant.hpp>
34
35 BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian)
36 BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
37
38 // Register boost array as a linestring
39 namespace boost { namespace geometry { namespace traits
40 {
41 template <typename Point, std::size_t PointCount>
42 struct tag< boost::array<Point, PointCount> >
43 {
44 typedef linestring_tag type;
45 };
46
47 }}}
48
49 template <typename P>
50 void test_distance_point()
51 {
52 namespace services = bg::strategy::distance::services;
53 typedef typename bg::default_distance_result<P>::type return_type;
54
55 // Basic, trivial test
56
57 P p1;
58 bg::set<0>(p1, 1);
59 bg::set<1>(p1, 1);
60
61 P p2;
62 bg::set<0>(p2, 2);
63 bg::set<1>(p2, 2);
64
65 return_type d = bg::distance(p1, p2);
66 BOOST_CHECK_CLOSE(d, return_type(1.4142135), 0.001);
67
68 // Test specifying strategy manually
69 typename services::default_strategy
70 <
71 bg::point_tag, bg::point_tag, P
72 >::type strategy;
73
74 d = bg::distance(p1, p2, strategy);
75 BOOST_CHECK_CLOSE(d, return_type(1.4142135), 0.001);
76
77 {
78 // Test custom strategy
79 BOOST_CONCEPT_ASSERT( (bg::concepts::PointDistanceStrategy<taxicab_distance, P, P>) );
80
81 typedef typename services::return_type<taxicab_distance, P, P>::type cab_return_type;
82 BOOST_MPL_ASSERT((boost::is_same<cab_return_type, typename bg::coordinate_type<P>::type>));
83
84 taxicab_distance tcd;
85 cab_return_type d = bg::distance(p1, p2, tcd);
86
87 BOOST_CHECK( bg::math::abs(d - cab_return_type(2)) <= cab_return_type(0.01) );
88 }
89
90 {
91 // test comparability
92
93 typedef typename services::default_strategy
94 <
95 bg::point_tag, bg::point_tag, P
96 >::type strategy_type;
97 typedef typename services::comparable_type<strategy_type>::type comparable_strategy_type;
98
99 strategy_type strategy;
100 comparable_strategy_type comparable_strategy = services::get_comparable<strategy_type>::apply(strategy);
101 return_type comparable = services::result_from_distance<comparable_strategy_type, P, P>::apply(comparable_strategy, 3);
102
103 BOOST_CHECK_CLOSE(comparable, return_type(9), 0.001);
104 }
105 }
106
107 template <typename P>
108 void test_distance_segment()
109 {
110 typedef typename bg::default_distance_result<P>::type return_type;
111
112 P s1; bg::set<0>(s1, 1); bg::set<1>(s1, 1);
113 P s2; bg::set<0>(s2, 4); bg::set<1>(s2, 4);
114
115 // Check points left, right, projected-left, projected-right, on segment
116 P p1; bg::set<0>(p1, 0); bg::set<1>(p1, 1);
117 P p2; bg::set<0>(p2, 1); bg::set<1>(p2, 0);
118 P p3; bg::set<0>(p3, 3); bg::set<1>(p3, 1);
119 P p4; bg::set<0>(p4, 1); bg::set<1>(p4, 3);
120 P p5; bg::set<0>(p5, 3); bg::set<1>(p5, 3);
121
122 bg::model::referring_segment<P const> const seg(s1, s2);
123
124 return_type d1 = bg::distance(p1, seg);
125 return_type d2 = bg::distance(p2, seg);
126 return_type d3 = bg::distance(p3, seg);
127 return_type d4 = bg::distance(p4, seg);
128 return_type d5 = bg::distance(p5, seg);
129
130 BOOST_CHECK_CLOSE(d1, return_type(1), 0.001);
131 BOOST_CHECK_CLOSE(d2, return_type(1), 0.001);
132 BOOST_CHECK_CLOSE(d3, return_type(1.4142135), 0.001);
133 BOOST_CHECK_CLOSE(d4, return_type(1.4142135), 0.001);
134 BOOST_CHECK_CLOSE(d5, return_type(0), 0.001);
135
136 // Reverse case: segment/point instead of point/segment
137 return_type dr1 = bg::distance(seg, p1);
138 return_type dr2 = bg::distance(seg, p2);
139
140 BOOST_CHECK_CLOSE(dr1, d1, 0.001);
141 BOOST_CHECK_CLOSE(dr2, d2, 0.001);
142
143 // Test specifying strategy manually:
144 // 1) point-point-distance
145 typename bg::strategy::distance::services::default_strategy
146 <
147 bg::point_tag, bg::point_tag, P
148 >::type pp_strategy;
149 d1 = bg::distance(p1, seg, pp_strategy);
150 BOOST_CHECK_CLOSE(d1, return_type(1), 0.001);
151
152 // 2) point-segment-distance
153 typename bg::strategy::distance::services::default_strategy
154 <
155 bg::point_tag, bg::segment_tag, P
156 >::type ps_strategy;
157 d1 = bg::distance(p1, seg, ps_strategy);
158 BOOST_CHECK_CLOSE(d1, return_type(1), 0.001);
159
160 // 3) custom point strategy
161 taxicab_distance tcd;
162 d1 = bg::distance(p1, seg, tcd);
163 BOOST_CHECK_CLOSE(d1, return_type(1), 0.001);
164 }
165
166 template <typename Point, typename Geometry, typename T>
167 void test_distance_linear(std::string const& wkt_point, std::string const& wkt_geometry, T const& expected)
168 {
169 Point p;
170 bg::read_wkt(wkt_point, p);
171
172 Geometry g;
173 bg::read_wkt(wkt_geometry, g);
174
175 typedef typename bg::default_distance_result<Point>::type return_type;
176 return_type d = bg::distance(p, g);
177
178 // For point-to-linestring (or point-to-polygon), both a point-strategy and a point-segment-strategy can be specified.
179 // Test this.
180 return_type ds1 = bg::distance(p, g, bg::strategy::distance::pythagoras<>());
181 return_type ds2 = bg::distance(p, g, bg::strategy::distance::projected_point<>());
182
183 BOOST_CHECK_CLOSE(d, return_type(expected), 0.001);
184 BOOST_CHECK_CLOSE(ds1, return_type(expected), 0.001);
185 BOOST_CHECK_CLOSE(ds2, return_type(expected), 0.001);
186 }
187
188 template <typename P>
189 void test_distance_array_as_linestring()
190 {
191 typedef typename bg::default_distance_result<P>::type return_type;
192
193 // Normal array does not have
194 boost::array<P, 2> points;
195 bg::set<0>(points[0], 1);
196 bg::set<1>(points[0], 1);
197 bg::set<0>(points[1], 3);
198 bg::set<1>(points[1], 3);
199
200 P p;
201 bg::set<0>(p, 2);
202 bg::set<1>(p, 1);
203
204 return_type d = bg::distance(p, points);
205 BOOST_CHECK_CLOSE(d, return_type(0.70710678), 0.001);
206
207 bg::set<0>(p, 5); bg::set<1>(p, 5);
208 d = bg::distance(p, points);
209 BOOST_CHECK_CLOSE(d, return_type(2.828427), 0.001);
210 }
211
212
213 // code moved from the distance unit test in multi/algorithms -- start
214 template <typename Geometry1, typename Geometry2>
215 void test_distance(std::string const& wkt1, std::string const& wkt2, double expected)
216 {
217 Geometry1 g1;
218 Geometry2 g2;
219 bg::read_wkt(wkt1, g1);
220 bg::read_wkt(wkt2, g2);
221 typename bg::default_distance_result<Geometry1, Geometry2>::type d = bg::distance(g1, g2);
222
223 BOOST_CHECK_CLOSE(d, expected, 0.0001);
224 }
225
226 template <typename Geometry1, typename Geometry2, typename Strategy>
227 void test_distance(Strategy const& strategy, std::string const& wkt1,
228 std::string const& wkt2, double expected)
229 {
230 Geometry1 g1;
231 Geometry2 g2;
232 bg::read_wkt(wkt1, g1);
233 bg::read_wkt(wkt2, g2);
234 typename bg::default_distance_result<Geometry1, Geometry2>::type d = bg::distance(g1, g2, strategy);
235
236 BOOST_CHECK_CLOSE(d, expected, 0.0001);
237 }
238
239
240 template <typename P>
241 void test_2d()
242 {
243 typedef bg::model::multi_point<P> mp;
244 typedef bg::model::multi_linestring<bg::model::linestring<P> > ml;
245 test_distance<P, P>("POINT(0 0)", "POINT(1 1)", sqrt(2.0));
246 test_distance<P, mp>("POINT(0 0)", "MULTIPOINT((1 1),(1 0),(0 2))", 1.0);
247 test_distance<mp, P>("MULTIPOINT((1 1),(1 0),(0 2))", "POINT(0 0)", 1.0);
248 test_distance<mp, mp>("MULTIPOINT((1 1),(1 0),(0 2))", "MULTIPOINT((2 2),(2 3))", sqrt(2.0));
249 test_distance<P, ml>("POINT(0 0)", "MULTILINESTRING((1 1,2 2),(1 0,2 0),(0 2,0 3))", 1.0);
250 test_distance<ml, P>("MULTILINESTRING((1 1,2 2),(1 0,2 0),(0 2,0 3))", "POINT(0 0)", 1.0);
251 test_distance<ml, mp>("MULTILINESTRING((1 1,2 2),(1 0,2 0),(0 2,0 3))", "MULTIPOINT((0 0),(1 1))", 0.0);
252
253 // Test with a strategy
254 bg::strategy::distance::pythagoras<> pyth;
255 test_distance<P, P>(pyth, "POINT(0 0)", "POINT(1 1)", sqrt(2.0));
256 test_distance<P, mp>(pyth, "POINT(0 0)", "MULTIPOINT((1 1),(1 0),(0 2))", 1.0);
257 test_distance<mp, P>(pyth, "MULTIPOINT((1 1),(1 0),(0 2))", "POINT(0 0)", 1.0);
258 }
259
260
261 template <typename P>
262 void test_3d()
263 {
264 typedef bg::model::multi_point<P> mp;
265 test_distance<P, P>("POINT(0 0 0)", "POINT(1 1 1)", sqrt(3.0));
266 test_distance<P, mp>("POINT(0 0 0)", "MULTIPOINT((1 1 1),(1 0 0),(0 1 2))", 1.0);
267 test_distance<mp, mp>("MULTIPOINT((1 1 1),(1 0 0),(0 0 2))", "MULTIPOINT((2 2 2),(2 3 4))", sqrt(3.0));
268 }
269
270
271 template <typename P1, typename P2>
272 void test_mixed()
273 {
274 typedef bg::model::multi_point<P1> mp1;
275 typedef bg::model::multi_point<P2> mp2;
276
277 test_distance<P1, P2>("POINT(0 0)", "POINT(1 1)", sqrt(2.0));
278
279 test_distance<P1, mp1>("POINT(0 0)", "MULTIPOINT((1 1),(1 0),(0 2))", 1.0);
280 test_distance<P1, mp2>("POINT(0 0)", "MULTIPOINT((1 1),(1 0),(0 2))", 1.0);
281 test_distance<P2, mp1>("POINT(0 0)", "MULTIPOINT((1 1),(1 0),(0 2))", 1.0);
282 test_distance<P2, mp2>("POINT(0 0)", "MULTIPOINT((1 1),(1 0),(0 2))", 1.0);
283
284 // Test automatic reversal
285 test_distance<mp1, P1>("MULTIPOINT((1 1),(1 0),(0 2))", "POINT(0 0)", 1.0);
286 test_distance<mp1, P2>("MULTIPOINT((1 1),(1 0),(0 2))", "POINT(0 0)", 1.0);
287 test_distance<mp2, P1>("MULTIPOINT((1 1),(1 0),(0 2))", "POINT(0 0)", 1.0);
288 test_distance<mp2, P2>("MULTIPOINT((1 1),(1 0),(0 2))", "POINT(0 0)", 1.0);
289
290 // Test multi-multi using different point types for each
291 test_distance<mp1, mp2>("MULTIPOINT((1 1),(1 0),(0 2))", "MULTIPOINT((2 2),(2 3))", sqrt(2.0));
292
293 // Test with a strategy
294 using namespace bg::strategy::distance;
295
296 test_distance<P1, P2>(pythagoras<>(), "POINT(0 0)", "POINT(1 1)", sqrt(2.0));
297
298 test_distance<P1, mp1>(pythagoras<>(), "POINT(0 0)", "MULTIPOINT((1 1),(1 0),(0 2))", 1.0);
299 test_distance<P1, mp2>(pythagoras<>(), "POINT(0 0)", "MULTIPOINT((1 1),(1 0),(0 2))", 1.0);
300 test_distance<P2, mp1>(pythagoras<>(), "POINT(0 0)", "MULTIPOINT((1 1),(1 0),(0 2))", 1.0);
301 test_distance<P2, mp2>(pythagoras<>(), "POINT(0 0)", "MULTIPOINT((1 1),(1 0),(0 2))", 1.0);
302
303 // Most interesting: reversal AND a strategy (note that the stategy must be reversed automatically
304 test_distance<mp1, P1>(pythagoras<>(), "MULTIPOINT((1 1),(1 0),(0 2))", "POINT(0 0)", 1.0);
305 test_distance<mp1, P2>(pythagoras<>(), "MULTIPOINT((1 1),(1 0),(0 2))", "POINT(0 0)", 1.0);
306 test_distance<mp2, P1>(pythagoras<>(), "MULTIPOINT((1 1),(1 0),(0 2))", "POINT(0 0)", 1.0);
307 test_distance<mp2, P2>(pythagoras<>(), "MULTIPOINT((1 1),(1 0),(0 2))", "POINT(0 0)", 1.0);
308 }
309 // code moved from the distance unit test in multi/algorithms -- end
310
311
312
313
314 template <typename P>
315 void test_all()
316 {
317 test_distance_point<P>();
318 test_distance_segment<P>();
319 test_distance_array_as_linestring<P>();
320
321 test_geometry<P, bg::model::segment<P> >("POINT(1 3)", "LINESTRING(1 1,4 4)", sqrt(2.0));
322 test_geometry<P, bg::model::segment<P> >("POINT(3 1)", "LINESTRING(1 1,4 4)", sqrt(2.0));
323
324 test_geometry<P, P>("POINT(1 1)", "POINT(2 2)", sqrt(2.0));
325 test_geometry<P, P>("POINT(0 0)", "POINT(0 3)", 3.0);
326 test_geometry<P, P>("POINT(0 0)", "POINT(4 0)", 4.0);
327 test_geometry<P, P>("POINT(0 3)", "POINT(4 0)", 5.0);
328 test_geometry<P, bg::model::linestring<P> >("POINT(1 3)", "LINESTRING(1 1,4 4)", sqrt(2.0));
329 test_geometry<P, bg::model::linestring<P> >("POINT(3 1)", "LINESTRING(1 1,4 4)", sqrt(2.0));
330 test_geometry<P, bg::model::linestring<P> >("POINT(50 50)", "LINESTRING(50 40, 40 50)", sqrt(50.0));
331 test_geometry<P, bg::model::linestring<P> >("POINT(50 50)", "LINESTRING(50 40, 40 50, 0 90)", sqrt(50.0));
332 test_geometry<bg::model::linestring<P>, P>("LINESTRING(1 1,4 4)", "POINT(1 3)", sqrt(2.0));
333 test_geometry<bg::model::linestring<P>, P>("LINESTRING(50 40, 40 50)", "POINT(50 50)", sqrt(50.0));
334 test_geometry<bg::model::linestring<P>, P>("LINESTRING(50 40, 40 50, 0 90)", "POINT(50 50)", sqrt(50.0));
335
336 // Rings
337 test_geometry<P, bg::model::ring<P> >("POINT(1 3)", "POLYGON((1 1,4 4,5 0,1 1))", sqrt(2.0));
338 test_geometry<P, bg::model::ring<P> >("POINT(3 1)", "POLYGON((1 1,4 4,5 0,1 1))", 0.0);
339 // other way round
340 test_geometry<bg::model::ring<P>, P>("POLYGON((1 1,4 4,5 0,1 1))", "POINT(3 1)", 0.0);
341 // open ring
342 test_geometry<P, bg::model::ring<P, true, false> >("POINT(1 3)", "POLYGON((4 4,5 0,1 1))", sqrt(2.0));
343
344 // Polygons
345 test_geometry<P, bg::model::polygon<P> >("POINT(1 3)", "POLYGON((1 1,4 4,5 0,1 1))", sqrt(2.0));
346 test_geometry<P, bg::model::polygon<P> >("POINT(3 1)", "POLYGON((1 1,4 4,5 0,1 1))", 0.0);
347 // other way round
348 test_geometry<bg::model::polygon<P>, P>("POLYGON((1 1,4 4,5 0,1 1))", "POINT(3 1)", 0.0);
349 // open polygon
350 test_geometry<P, bg::model::polygon<P, true, false> >("POINT(1 3)", "POLYGON((4 4,5 0,1 1))", sqrt(2.0));
351
352 // Polygons with holes
353 std::string donut = "POLYGON ((0 0,1 9,8 1,0 0),(1 1,4 1,1 4,1 1))";
354 test_geometry<P, bg::model::polygon<P> >("POINT(2 2)", donut, 0.5 * sqrt(2.0));
355 test_geometry<P, bg::model::polygon<P> >("POINT(3 3)", donut, 0.0);
356 // other way round
357 test_geometry<bg::model::polygon<P>, P>(donut, "POINT(2 2)", 0.5 * sqrt(2.0));
358 // open
359 test_geometry<P, bg::model::polygon<P, true, false> >("POINT(2 2)", "POLYGON ((0 0,1 9,8 1),(1 1,4 1,1 4))", 0.5 * sqrt(2.0));
360
361 // Should (currently) give compiler assertion
362 // test_geometry<bg::model::polygon<P>, bg::model::polygon<P> >(donut, donut, 0.5 * sqrt(2.0));
363
364 // DOES NOT COMPILE - cannot do read_wkt (because boost::array is not variably sized)
365 // test_geometry<P, boost::array<P, 2> >("POINT(3 1)", "LINESTRING(1 1,4 4)", sqrt(2.0));
366
367 test_geometry<P, test::wrapped_boost_array<P, 2> >("POINT(3 1)", "LINESTRING(1 1,4 4)", sqrt(2.0));
368
369 test_distance_linear<P, bg::model::linestring<P> >("POINT(3 1)", "LINESTRING(1 1,4 4)", sqrt(2.0));
370 }
371
372 template <typename P>
373 void test_empty_input()
374 {
375 P p;
376 bg::model::linestring<P> line_empty;
377 bg::model::polygon<P> poly_empty;
378 bg::model::ring<P> ring_empty;
379 bg::model::multi_point<P> mp_empty;
380 bg::model::multi_linestring<bg::model::linestring<P> > ml_empty;
381
382 test_empty_input(p, line_empty);
383 test_empty_input(p, poly_empty);
384 test_empty_input(p, ring_empty);
385
386 test_empty_input(p, mp_empty);
387 test_empty_input(p, ml_empty);
388 test_empty_input(mp_empty, mp_empty);
389
390 // Test behaviour if one of the inputs is empty
391 bg::model::multi_point<P> mp;
392 mp.push_back(p);
393 test_empty_input(mp_empty, mp);
394 test_empty_input(mp, mp_empty);
395 }
396
397 void test_large_integers()
398 {
399 typedef bg::model::point<int, 2, bg::cs::cartesian> int_point_type;
400 typedef bg::model::point<double, 2, bg::cs::cartesian> double_point_type;
401
402 // point-point
403 {
404 std::string const a = "POINT(2544000 528000)";
405 std::string const b = "POINT(2768040 528000)";
406 int_point_type ia, ib;
407 double_point_type da, db;
408 bg::read_wkt(a, ia);
409 bg::read_wkt(b, ib);
410 bg::read_wkt(a, da);
411 bg::read_wkt(b, db);
412
413 BOOST_AUTO(idist, bg::distance(ia, ib));
414 BOOST_AUTO(ddist, bg::distance(da, db));
415
416 BOOST_CHECK_MESSAGE(std::abs(idist - ddist) < 0.1,
417 "within<a double> different from within<an int>");
418 }
419 // Point-segment
420 {
421 std::string const a = "POINT(2600000 529000)";
422 std::string const b = "LINESTRING(2544000 528000, 2768040 528000)";
423 int_point_type ia;
424 double_point_type da;
425 bg::model::segment<int_point_type> ib;
426 bg::model::segment<double_point_type> db;
427 bg::read_wkt(a, ia);
428 bg::read_wkt(b, ib);
429 bg::read_wkt(a, da);
430 bg::read_wkt(b, db);
431
432 BOOST_AUTO(idist, bg::distance(ia, ib));
433 BOOST_AUTO(ddist, bg::distance(da, db));
434
435 BOOST_CHECK_MESSAGE(std::abs(idist - ddist) < 0.1,
436 "within<a double> different from within<an int>");
437 }
438 }
439
440 template <typename T>
441 void test_variant()
442 {
443 typedef bg::model::point<T, 2, bg::cs::cartesian> point_type;
444 typedef bg::model::segment<point_type> segment_type;
445 typedef bg::model::box<point_type> box_type;
446 typedef boost::variant<point_type, segment_type, box_type> variant_type;
447
448 point_type point;
449 std::string const point_li = "POINT(1 3)";
450 bg::read_wkt(point_li, point);
451
452 segment_type seg;
453 std::string const seg_li = "LINESTRING(1 1,4 4)";
454 bg::read_wkt(seg_li, seg);
455
456 variant_type v1, v2;
457
458 BOOST_MPL_ASSERT((
459 boost::is_same
460 <
461 typename bg::distance_result
462 <
463 variant_type, variant_type, bg::default_strategy
464 >::type,
465 double
466 >
467 ));
468
469 // Default strategy
470 v1 = point;
471 v2 = point;
472 BOOST_CHECK_CLOSE(bg::distance(v1, v2), bg::distance(point, point), 0.0001);
473 BOOST_CHECK_CLOSE(bg::distance(v1, point), bg::distance(point, point), 0.0001);
474 BOOST_CHECK_CLOSE(bg::distance(point, v2), bg::distance(point, point), 0.0001);
475 v1 = point;
476 v2 = seg;
477 BOOST_CHECK_CLOSE(bg::distance(v1, v2), bg::distance(point, seg), 0.0001);
478 BOOST_CHECK_CLOSE(bg::distance(v1, seg), bg::distance(point, seg), 0.0001);
479 BOOST_CHECK_CLOSE(bg::distance(point, v2), bg::distance(point, seg), 0.0001);
480
481 // User defined strategy
482 v1 = point;
483 v2 = point;
484 bg::strategy::distance::haversine<double> s;
485 //BOOST_CHECK_CLOSE(bg::distance(v1, v2, s), bg::distance(point, point, s), 0.0001);
486 //BOOST_CHECK_CLOSE(bg::distance(v1, point, s), bg::distance(point, point, s), 0.0001);
487 //BOOST_CHECK_CLOSE(bg::distance(point, v2, s), bg::distance(point, point, s), 0.0001);
488 }
489
490 int test_main(int, char* [])
491 {
492 #ifdef TEST_ARRAY
493 //test_all<int[2]>();
494 //test_all<float[2]>();
495 //test_all<double[2]>();
496 //test_all<test::test_point>(); // located here because of 3D
497 #endif
498
499 test_large_integers();
500
501 test_all<bg::model::d2::point_xy<int> >();
502 test_all<boost::tuple<float, float> >();
503 test_all<bg::model::d2::point_xy<float> >();
504 test_all<bg::model::d2::point_xy<double> >();
505
506 #ifdef HAVE_TTMATH
507 test_all<bg::model::d2::point_xy<ttmath_big> >();
508 #endif
509
510 test_empty_input<bg::model::d2::point_xy<int> >();
511
512 // below are the test cases moved here from the distance unit test
513 // in test/multi/algorithms
514 test_2d<boost::tuple<float, float> >();
515 test_2d<bg::model::d2::point_xy<float> >();
516 test_2d<bg::model::d2::point_xy<double> >();
517
518 test_3d<boost::tuple<float, float, float> >();
519 test_3d<bg::model::point<double, 3, bg::cs::cartesian> >();
520
521 test_mixed<bg::model::d2::point_xy<float>, bg::model::d2::point_xy<double> >();
522
523 #ifdef HAVE_TTMATH
524 test_2d<bg::model::d2::point_xy<ttmath_big> >();
525 test_mixed<bg::model::d2::point_xy<ttmath_big>, bg::model::d2::point_xy<double> >();
526 #endif
527
528 test_empty_input<bg::model::d2::point_xy<int> >();
529
530 test_variant<double>();
531 test_variant<int>();
532
533 return 0;
534 }