|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r76905 - in branches/release/libs/geometry: doc doc/concept doc/doxy doc/generated doc/html doc/reference doc/reference/algorithms doc/src doc/src/docutils/tools/support_status doc/src/examples/algorithms example test test/algorithms test/algorithms/detail/sections test/algorithms/overlay test/algorithms/overlay/robustness test/io/wkt test/multi/algorithms test/robustness test/robustness/convex_hull test/strategies test/util
From: barend.gehrels_at_[hidden]
Date: 2012-02-05 13:48:30
Author: barendgehrels
Date: 2012-02-05 13:48:26 EST (Sun, 05 Feb 2012)
New Revision: 76905
URL: http://svn.boost.org/trac/boost/changeset/76905
Log:
Merged libs/geometry fixes since 2011-01-15
Added:
branches/release/libs/geometry/doc/generated/correct_status.qbk
- copied unchanged from r76903, /trunk/libs/geometry/doc/generated/correct_status.qbk
branches/release/libs/geometry/doc/generated/covered_by_status.qbk
- copied unchanged from r76903, /trunk/libs/geometry/doc/generated/covered_by_status.qbk
branches/release/libs/geometry/test/robustness/
- copied from r76903, /trunk/libs/geometry/test/robustness/
branches/release/libs/geometry/test/robustness/convex_hull/
- copied from r76903, /trunk/libs/geometry/test/robustness/convex_hull/
branches/release/libs/geometry/test/robustness/convex_hull/random_multi_points.cpp
- copied unchanged from r76903, /trunk/libs/geometry/test/robustness/convex_hull/random_multi_points.cpp
branches/release/libs/geometry/test/robustness/convex_hull/random_multi_points.sln
- copied unchanged from r76903, /trunk/libs/geometry/test/robustness/convex_hull/random_multi_points.sln
branches/release/libs/geometry/test/robustness/convex_hull/random_multi_points.vcproj
- copied unchanged from r76903, /trunk/libs/geometry/test/robustness/convex_hull/random_multi_points.vcproj
branches/release/libs/geometry/test/util/calculation_type.cpp
- copied unchanged from r76903, /trunk/libs/geometry/test/util/calculation_type.cpp
branches/release/libs/geometry/test/util/calculation_type.vcproj
- copied unchanged from r76903, /trunk/libs/geometry/test/util/calculation_type.vcproj
Properties modified:
branches/release/libs/geometry/doc/ (props changed)
branches/release/libs/geometry/doc/Jamfile.v2 (props changed)
branches/release/libs/geometry/doc/about_documentation.qbk (props changed)
branches/release/libs/geometry/doc/acknowledgments.qbk (props changed)
branches/release/libs/geometry/doc/concept/ (props changed)
branches/release/libs/geometry/doc/copyright_note_policy.txt (props changed)
branches/release/libs/geometry/doc/design_rationale.qbk (props changed)
branches/release/libs/geometry/doc/doxy/ (props changed)
branches/release/libs/geometry/doc/generated/ (props changed)
branches/release/libs/geometry/doc/geometry.qbk (props changed)
branches/release/libs/geometry/doc/html/ (props changed)
branches/release/libs/geometry/doc/imports.qbk (props changed)
branches/release/libs/geometry/doc/introduction.qbk (props changed)
branches/release/libs/geometry/doc/make_qbk.py (props changed)
branches/release/libs/geometry/doc/matrix.qbk (props changed)
branches/release/libs/geometry/doc/quickref.xml (props changed)
branches/release/libs/geometry/doc/quickstart.qbk (props changed)
branches/release/libs/geometry/doc/readme.txt (props changed)
branches/release/libs/geometry/doc/reference/ (props changed)
branches/release/libs/geometry/doc/reference.qbk (props changed)
branches/release/libs/geometry/doc/release_notes.qbk (contents, props changed)
branches/release/libs/geometry/doc/src/ (props changed)
branches/release/libs/geometry/example/ (props changed)
branches/release/libs/geometry/test/ (props changed)
Text files modified:
branches/release/libs/geometry/doc/generated/convert_status.qbk | 6 +-
branches/release/libs/geometry/doc/generated/within_status.qbk | 12 ++++++-
branches/release/libs/geometry/doc/reference/algorithms/convert.qbk | 3 +
branches/release/libs/geometry/doc/release_notes.qbk | 16 +++++++--
branches/release/libs/geometry/doc/src/docutils/tools/support_status/support_status.cpp | 19 ++++++++++-
branches/release/libs/geometry/doc/src/examples/algorithms/convex_hull.cpp | 2
branches/release/libs/geometry/doc/src/examples/algorithms/create_svg_overlay.hpp | 5 +++
branches/release/libs/geometry/doc/src/examples/algorithms/create_svg_two.hpp | 4 ++
branches/release/libs/geometry/doc/src/examples/algorithms/expand.cpp | 2 +
branches/release/libs/geometry/test/algorithms/area.cpp | 20 ++++++++++++
branches/release/libs/geometry/test/algorithms/centroid.cpp | 30 +++++++++++++++++-
branches/release/libs/geometry/test/algorithms/correct.cpp | 2
branches/release/libs/geometry/test/algorithms/detail/sections/sectionalize.cpp | 35 ++++++++++++++++++++++
branches/release/libs/geometry/test/algorithms/disjoint.cpp | 55 ++++++++++++++++++++++++++++++++++
branches/release/libs/geometry/test/algorithms/distance.cpp | 45 ++++++++++++++++++++++++++++
branches/release/libs/geometry/test/algorithms/intersects.cpp | 5 +++
branches/release/libs/geometry/test/algorithms/overlay/get_turn_info.cpp | 6 +++
branches/release/libs/geometry/test/algorithms/overlay/overlay_cases.hpp | 6 +++
branches/release/libs/geometry/test/algorithms/overlay/robustness/interior_triangles.cpp | 10 -----
branches/release/libs/geometry/test/algorithms/overlay/robustness/intersection_pies.cpp | 10 +-----
branches/release/libs/geometry/test/algorithms/overlay/robustness/intersection_stars.cpp | 15 --------
branches/release/libs/geometry/test/algorithms/overlay/robustness/intersects.cpp | 9 -----
branches/release/libs/geometry/test/algorithms/overlay/robustness/random_ellipses_stars.cpp | 15 +--------
branches/release/libs/geometry/test/algorithms/overlay/robustness/recursive_polygons.cpp | 17 +---------
branches/release/libs/geometry/test/algorithms/overlay/robustness/star_comb.cpp | 15 +--------
branches/release/libs/geometry/test/algorithms/overlay/robustness/test_overlay_p_q.hpp | 41 +++++++++++++++----------
branches/release/libs/geometry/test/algorithms/overlay/traverse.cpp | 41 +++++++++++++++++--------
branches/release/libs/geometry/test/algorithms/test_convex_hull.hpp | 3 +
branches/release/libs/geometry/test/algorithms/within.cpp | 25 +++++++++++++++
branches/release/libs/geometry/test/geometry_test_common.hpp | 6 +-
branches/release/libs/geometry/test/io/wkt/wkt.cpp | 63 ++++++++++++++++++++++-----------------
branches/release/libs/geometry/test/io/wkt/wkt.vcproj | 4 +-
branches/release/libs/geometry/test/multi/algorithms/multi_convex_hull.cpp | 21 ++++++++++++
branches/release/libs/geometry/test/multi/algorithms/multi_difference.cpp | 2
branches/release/libs/geometry/test/multi/algorithms/multi_union.cpp | 2
branches/release/libs/geometry/test/strategies/pythagoras.cpp | 44 +++++++++++++++++++++++++++
branches/release/libs/geometry/test/strategies/segment_intersection_collinear.cpp | 14 +++++---
branches/release/libs/geometry/test/util/Jamfile.v2 | 1
branches/release/libs/geometry/test/util/select_most_precise.cpp | 27 ++--------------
branches/release/libs/geometry/test/util/util_tests.sln | 6 +++
40 files changed, 471 insertions(+), 193 deletions(-)
Modified: branches/release/libs/geometry/doc/generated/convert_status.qbk
==============================================================================
--- branches/release/libs/geometry/doc/generated/convert_status.qbk (original)
+++ branches/release/libs/geometry/doc/generated/convert_status.qbk 2012-02-05 13:48:26 EST (Sun, 05 Feb 2012)
@@ -7,7 +7,7 @@
[[Linestring][ [$img/nyi.png] ][ [$img/ok.png] ][ [$img/nyi.png] ][ [$img/ok.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ]]
[[Ring][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/ok.png] ][ [$img/nyi.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ]]
[[Polygon][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/ok.png] ][ [$img/nyi.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ]]
-[[MultiPoint][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/ok.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ]]
-[[MultiLinestring][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/ok.png] ][ [$img/nyi.png] ]]
-[[MultiPolygon][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/ok.png] ]]
+[[MultiPoint][ [$img/ok.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/ok.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ]]
+[[MultiLinestring][ [$img/nyi.png] ][ [$img/ok.png] ][ [$img/nyi.png] ][ [$img/ok.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/ok.png] ][ [$img/nyi.png] ]]
+[[MultiPolygon][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/ok.png] ][ [$img/nyi.png] ][ [$img/ok.png] ][ [$img/ok.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/ok.png] ]]
]
Modified: branches/release/libs/geometry/doc/generated/within_status.qbk
==============================================================================
--- branches/release/libs/geometry/doc/generated/within_status.qbk (original)
+++ branches/release/libs/geometry/doc/generated/within_status.qbk 2012-02-05 13:48:26 EST (Sun, 05 Feb 2012)
@@ -1,5 +1,13 @@
[heading Supported geometries]
[table
-[[ ][Box][Ring][Polygon][MultiPolygon]]
-[[Point][[$img/ok.png]][[$img/ok.png]][[$img/ok.png]][[$img/ok.png]]]
+[[ ][Point][Segment][Box][Linestring][Ring][Polygon][MultiPoint][MultiLinestring][MultiPolygon]]
+[[Point][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ]]
+[[Segment][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ]]
+[[Box][ [$img/ok.png] ][ [$img/nyi.png] ][ [$img/ok.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ]]
+[[Linestring][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ]]
+[[Ring][ [$img/ok.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ]]
+[[Polygon][ [$img/ok.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ]]
+[[MultiPoint][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ]]
+[[MultiLinestring][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ]]
+[[MultiPolygon][ [$img/ok.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ][ [$img/nyi.png] ]]
]
Modified: branches/release/libs/geometry/doc/reference/algorithms/convert.qbk
==============================================================================
--- branches/release/libs/geometry/doc/reference/algorithms/convert.qbk (original)
+++ branches/release/libs/geometry/doc/reference/algorithms/convert.qbk 2012-02-05 13:48:26 EST (Sun, 05 Feb 2012)
@@ -15,6 +15,9 @@
(where assign is modelled as target := source)]
[include generated/convert_status.qbk]
+[note In this status matrix above: columns are source types
+ and rows are target types. So a box can be converted to a ring, polygon
+ or multi-polygon, but not vice versa.]
[heading Complexity]
Linear
Modified: branches/release/libs/geometry/doc/release_notes.qbk
==============================================================================
--- branches/release/libs/geometry/doc/release_notes.qbk (original)
+++ branches/release/libs/geometry/doc/release_notes.qbk 2012-02-05 13:48:26 EST (Sun, 05 Feb 2012)
@@ -16,6 +16,10 @@
[heading Boost 1.49]
[/=================]
+[*Breaking changes]
+
+* point_xy was accidentally included in one of the headerfiles. If the point_xy class is used, it should be included explicitly now.
+
[*Bugfixes]
* bugfix: distance for multi-geometries ignored specified distance strategy. Fixed
@@ -24,12 +28,15 @@
* bugfix: multi DSV did not correctly use settings, fixed
* bugfix: self-intersections could sometimes be missed (introduced in 1.48), fixed
* bugfix: convex hull crashed on empty range (e.g. empty multi point), fixed
+* bugfix: area/centroid/side/intersection/distance did not work for "int" type filled with large (but not overflowing) integers. Fixed.
+* bugfix: disjoint/intersect did not work for degenerate linestrings. Fixed.
[*Solved tickets]
+* [@https://svn.boost.org/trac/boost/ticket/6019 6019] convex_hull / area, fixed.
+* [@https://svn.boost.org/trac/boost/ticket/6021 6021] convex_hull / append (multipoint), fixed.
* [@https://svn.boost.org/trac/boost/ticket/6028 6028] Documentation: closure, fixed.
* [@https://svn.boost.org/trac/boost/ticket/6178 6178] Missing headerfile, fixed.
-* [@https://svn.boost.org/trac/boost/ticket/6021 6021] convex hull of multipoint, fixed.
[*Additional functionality]
@@ -40,13 +47,14 @@
[*Documentation]
-* updated support status
+* updated support status in several algorithms
[*Internal changes]
-* updates in specializations/not_implemented for distance/convert/assign/area
+* updates in specializations/not_implemented for distance/convert/assign/area/with/covered_by
* move of wkt/dsv to io folder, making domains redundant
-* strategy concepts assigned to zero to avoid clang warnings (patched by Vishnu)
+* warnings: strategy concepts assigned to zero to avoid clang warnings (patched by Vishnu)
+* warnings: there were several unused parameters, for which gcc/clang warned. Fixed.
[/=================]
[heading Boost 1.48]
Modified: branches/release/libs/geometry/doc/src/docutils/tools/support_status/support_status.cpp
==============================================================================
--- branches/release/libs/geometry/doc/src/docutils/tools/support_status/support_status.cpp (original)
+++ branches/release/libs/geometry/doc/src/docutils/tools/support_status/support_status.cpp 2012-02-05 13:48:26 EST (Sun, 05 Feb 2012)
@@ -20,12 +20,21 @@
#include <boost/geometry/core/cs.hpp>
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/multi/geometries/multi_geometries.hpp>
-#include <boost/geometry/multi/multi.hpp>
#include <boost/geometry/algorithms/append.hpp>
#include <boost/geometry/algorithms/area.hpp>
+#include <boost/geometry/algorithms/clear.hpp>
#include <boost/geometry/algorithms/convert.hpp>
#include <boost/geometry/algorithms/convex_hull.hpp>
+#include <boost/geometry/algorithms/correct.hpp>
+#include <boost/geometry/algorithms/covered_by.hpp>
#include <boost/geometry/algorithms/distance.hpp>
+#include <boost/geometry/multi/algorithms/append.hpp>
+#include <boost/geometry/multi/algorithms/area.hpp>
+#include <boost/geometry/multi/algorithms/clear.hpp>
+#include <boost/geometry/multi/algorithms/convert.hpp>
+#include <boost/geometry/multi/algorithms/correct.hpp>
+#include <boost/geometry/multi/algorithms/covered_by.hpp>
+#include <boost/geometry/multi/algorithms/distance.hpp>
#include <boost/geometry/strategies/strategies.hpp>
#include "text_outputter.hpp"
@@ -71,7 +80,10 @@
DECLARE_UNARY_ALGORITHM (clear)
DECLARE_BINARY_ALGORITHM(convert)
DECLARE_UNARY_ALGORITHM (convex_hull)
+DECLARE_UNARY_ALGORITHM (correct)
+DECLARE_BINARY_ALGORITHM(covered_by)
DECLARE_BINARY_ALGORITHM(distance)
+DECLARE_BINARY_ALGORITHM(within)
template <template <typename> class Dispatcher, typename Outputter, typename G>
@@ -158,7 +170,7 @@
Outputter outputter(name);
outputter.header(name);
- outputter.template table_header();
+ outputter.table_header();
boost::mpl::for_each<Types>(unary_test<Dispatcher, Outputter>(outputter));
outputter.table_footer();
@@ -185,7 +197,10 @@
test_unary_algorithm<clear, all_types, OutputFactory>("clear");
test_binary_algorithm<convert, all_types, all_types, OutputFactory>("convert");
test_unary_algorithm<convex_hull, all_types, OutputFactory>("convex_hull");
+ test_unary_algorithm<correct, all_types, OutputFactory>("correct");
+ test_binary_algorithm<covered_by, all_types, all_types, OutputFactory>("covered_by");
test_binary_algorithm<distance, all_types, all_types, OutputFactory>("distance");
+ test_binary_algorithm<within, all_types, all_types, OutputFactory>("within");
}
Modified: branches/release/libs/geometry/doc/src/examples/algorithms/convex_hull.cpp
==============================================================================
--- branches/release/libs/geometry/doc/src/examples/algorithms/convex_hull.cpp (original)
+++ branches/release/libs/geometry/doc/src/examples/algorithms/convex_hull.cpp 2012-02-05 13:48:26 EST (Sun, 05 Feb 2012)
@@ -37,7 +37,7 @@
<< "hull: " << dsv(hull) << std::endl
;
- /*<-*/ create_svg("envelope.svg", poly, hull); /*->*/
+ /*<-*/ create_svg("hull.svg", poly, hull); /*->*/
return 0;
}
Modified: branches/release/libs/geometry/doc/src/examples/algorithms/create_svg_overlay.hpp
==============================================================================
--- branches/release/libs/geometry/doc/src/examples/algorithms/create_svg_overlay.hpp (original)
+++ branches/release/libs/geometry/doc/src/examples/algorithms/create_svg_overlay.hpp 2012-02-05 13:48:26 EST (Sun, 05 Feb 2012)
@@ -44,6 +44,11 @@
mapper.text(boost::geometry::return_centroid<point_type>(g), out.str(),
"fill:rgb(0,0,0);font-family:Arial;font-size:10px");
}
+#else
+ boost::ignore_unused_variable_warning(filename);
+ boost::ignore_unused_variable_warning(a);
+ boost::ignore_unused_variable_warning(b);
+ boost::ignore_unused_variable_warning(range);
#endif
}
Modified: branches/release/libs/geometry/doc/src/examples/algorithms/create_svg_two.hpp
==============================================================================
--- branches/release/libs/geometry/doc/src/examples/algorithms/create_svg_two.hpp (original)
+++ branches/release/libs/geometry/doc/src/examples/algorithms/create_svg_two.hpp 2012-02-05 13:48:26 EST (Sun, 05 Feb 2012)
@@ -40,6 +40,10 @@
{
mapper.map(b, "opacity:0.8;fill:none;stroke:rgb(255,128,0);stroke-width:4;stroke-dasharray:1,7;stroke-linecap:round");
}
+#else
+ boost::ignore_unused_variable_warning(filename);
+ boost::ignore_unused_variable_warning(a);
+ boost::ignore_unused_variable_warning(b);
#endif
}
Modified: branches/release/libs/geometry/doc/src/examples/algorithms/expand.cpp
==============================================================================
--- branches/release/libs/geometry/doc/src/examples/algorithms/expand.cpp (original)
+++ branches/release/libs/geometry/doc/src/examples/algorithms/expand.cpp 2012-02-05 13:48:26 EST (Sun, 05 Feb 2012)
@@ -14,6 +14,8 @@
#include <list>
#include <boost/geometry.hpp>
+#include <boost/geometry/geometries/box.hpp>
+#include <boost/geometry/geometries/point_xy.hpp>
int main()
{
Modified: branches/release/libs/geometry/test/algorithms/area.cpp
==============================================================================
--- branches/release/libs/geometry/test/algorithms/area.cpp (original)
+++ branches/release/libs/geometry/test/algorithms/area.cpp 2012-02-05 13:48:26 EST (Sun, 05 Feb 2012)
@@ -204,6 +204,24 @@
test_empty_input(ring_empty);
}
+void test_large_integers()
+{
+ typedef bg::model::point<int, 2, bg::cs::cartesian> int_point_type;
+ typedef bg::model::point<double, 2, bg::cs::cartesian> double_point_type;
+
+ bg::model::polygon<int_point_type> int_poly;
+ bg::model::polygon<double_point_type> double_poly;
+
+ std::string const polygon_li = "POLYGON((1872000 528000,1872000 192000,1536119 192000,1536000 528000,1200000 528000,1200000 863880,1536000 863880,1872000 863880,1872000 528000))";
+ bg::read_wkt(polygon_li, int_poly);
+ bg::read_wkt(polygon_li, double_poly);
+
+ double int_area = bg::area(int_poly);
+ double double_area = bg::area(double_poly);
+
+ BOOST_CHECK_CLOSE(int_area, double_area, 0.0001);
+}
+
int test_main(int, char* [])
{
test_all<bg::model::point<int, 2, bg::cs::cartesian> >();
@@ -222,6 +240,8 @@
test_spherical<bg::model::point<ttmath_big, 2, bg::cs::spherical_equatorial<bg::degree> > >();
#endif
+ test_large_integers();
+
test_empty_input<bg::model::d2::point_xy<int> >();
return 0;
Modified: branches/release/libs/geometry/test/algorithms/centroid.cpp
==============================================================================
--- branches/release/libs/geometry/test/algorithms/centroid.cpp (original)
+++ branches/release/libs/geometry/test/algorithms/centroid.cpp 2012-02-05 13:48:26 EST (Sun, 05 Feb 2012)
@@ -101,11 +101,34 @@
test_centroid_exception<bg::model::ring<P> >();
}
+void test_large_integers()
+{
+ typedef bg::model::point<int, 2, bg::cs::cartesian> int_point_type;
+ typedef bg::model::point<double, 2, bg::cs::cartesian> double_point_type;
+
+ bg::model::polygon<int_point_type> int_poly;
+ bg::model::polygon<double_point_type> double_poly;
+
+ std::string const polygon_li = "POLYGON((1872000 528000,1872000 192000,1536119 192000,1536000 528000,1200000 528000,1200000 863880,1536000 863880,1872000 863880,1872000 528000))";
+ bg::read_wkt(polygon_li, int_poly);
+ bg::read_wkt(polygon_li, double_poly);
+
+ int_point_type int_centroid;
+ double_point_type double_centroid;
+
+ bg::centroid(int_poly, int_centroid);
+ bg::centroid(double_poly, double_centroid);
+
+ int_point_type double_centroid_as_int;
+ bg::assign(int_centroid, double_centroid_as_int);
+
+ BOOST_CHECK_EQUAL(bg::get<0>(int_centroid), bg::get<0>(double_centroid_as_int));
+ BOOST_CHECK_EQUAL(bg::get<1>(int_centroid), bg::get<1>(double_centroid_as_int));
+}
+
int test_main(int, char* [])
{
- test_exceptions<bg::model::d2::point_xy<double> >();
-
test_2d<bg::model::d2::point_xy<double> >();
test_2d<boost::tuple<float, float> >();
test_2d<bg::model::d2::point_xy<float> >();
@@ -119,5 +142,8 @@
test_3d<boost::tuple<ttmath_big, ttmath_big, ttmath_big> >();
#endif
+ test_large_integers();
+ test_exceptions<bg::model::d2::point_xy<double> >();
+
return 0;
}
Modified: branches/release/libs/geometry/test/algorithms/correct.cpp
==============================================================================
--- branches/release/libs/geometry/test/algorithms/correct.cpp (original)
+++ branches/release/libs/geometry/test/algorithms/correct.cpp 2012-02-05 13:48:26 EST (Sun, 05 Feb 2012)
@@ -170,7 +170,7 @@
//test_all<float[2]>(); not yet because cannot be copied, for polygon
//test_all<double[2]>();
- //test_all<point_xy<int> >();
+ test_all<bg::model::d2::point_xy<int> >();
test_all<bg::model::d2::point_xy<float> >();
test_all<bg::model::d2::point_xy<double> >();
Modified: branches/release/libs/geometry/test/algorithms/detail/sections/sectionalize.cpp
==============================================================================
--- branches/release/libs/geometry/test/algorithms/detail/sections/sectionalize.cpp (original)
+++ branches/release/libs/geometry/test/algorithms/detail/sections/sectionalize.cpp 2012-02-05 13:48:26 EST (Sun, 05 Feb 2012)
@@ -297,8 +297,43 @@
4, "0..4|4..5|5..8|8..11", "+|-|+|-");
}
+void test_large_integers()
+{
+ typedef bg::model::point<int, 2, bg::cs::cartesian> int_point_type;
+ typedef bg::model::point<double, 2, bg::cs::cartesian> double_point_type;
+
+ std::string const polygon_li = "POLYGON((1872000 528000,1872000 192000,1536119 192000,1536000 528000,1200000 528000,1200000 863880,1536000 863880,1872000 863880,1872000 528000))";
+ bg::model::polygon<int_point_type> int_poly;
+ bg::model::polygon<double_point_type> double_poly;
+ bg::read_wkt(polygon_li, int_poly);
+ bg::read_wkt(polygon_li, double_poly);
+
+ bg::sections<bg::model::box<int_point_type>, 1> int_sections;
+ bg::sections<bg::model::box<double_point_type>, 1> double_sections;
+
+ bg::sectionalize<false>(int_poly, int_sections);
+ bg::sectionalize<false>(double_poly, double_sections);
+
+ bool equally_sized = int_sections.size() == double_sections.size();
+ BOOST_CHECK(equally_sized);
+ if (! equally_sized)
+ {
+ return;
+ }
+
+ for (unsigned int i = 0; i < int_sections.size(); i++)
+ {
+ BOOST_CHECK(int_sections[i].begin_index == double_sections[i].begin_index);
+ BOOST_CHECK(int_sections[i].count == double_sections[i].count);
+ }
+
+}
+
+
int test_main(int, char* [])
{
+ test_large_integers();
+
//test_all<bg::model::d2::point_xy<float> >();
test_all<bg::model::d2::point_xy<double> >();
Modified: branches/release/libs/geometry/test/algorithms/disjoint.cpp
==============================================================================
--- branches/release/libs/geometry/test/algorithms/disjoint.cpp (original)
+++ branches/release/libs/geometry/test/algorithms/disjoint.cpp 2012-02-05 13:48:26 EST (Sun, 05 Feb 2012)
@@ -112,6 +112,61 @@
test_disjoint<ls, ls>("ls/ls 2", "linestring(0 0,1 1)", "linestring(1 0,2 1)", true);
test_disjoint<segment, segment>("s/s 1", "linestring(0 0,1 1)", "linestring(1 0,0 1)", false);
test_disjoint<segment, segment>("s/s 2", "linestring(0 0,1 1)", "linestring(1 0,2 1)", true);
+
+ // Degenerate linestrings
+ {
+ // Submitted by Zachary on the Boost.Geometry Mailing List, on 2012-01-29
+ std::string const a = "linestring(100 10, 0 10)";
+ std::string const b = "linestring(50 10, 50 10)"; // one point only, with same y-coordinate
+ std::string const c = "linestring(100 10, 100 10)"; // idem, at left side
+ test_disjoint<ls, ls>("dls/dls 1", a, b, false);
+ test_disjoint<ls, ls>("dls/dls 2", b, a, false);
+ test_disjoint<segment, segment>("ds/ds 1", a, b, false);
+ test_disjoint<segment, segment>("ds/ds 2", b, a, false);
+ test_disjoint<ls, ls>("dls/dls 1", a, c, false);
+ }
+
+ // Linestrings making angles normally ignored
+ {
+ // These (non-disjoint) cases
+ // correspond to the test "segment_intersection_collinear"
+
+ // Collinear ('a')
+ // a1---------->a2
+ // b1--->b2
+ test_disjoint<ls, ls>("n1", "linestring(2 0,0 6)", "linestring(0 0,2 0)", false);
+
+ // a1---------->a2
+ // b1--->b2
+ test_disjoint<ls, ls>("n7", "linestring(2 0,6 0)", "linestring(6 0,8 0)", false);
+
+ // Collinear - opposite ('f')
+ // a1---------->a2
+ // b2<---b1
+ test_disjoint<ls, ls>("o1", "linestring(2 0,6 0)", "linestring(2 0,0 0)", false);
+ }
+
+ {
+ // Starting in the middle ('s')
+ // b2
+ // ^
+ // |
+ // |
+ // a1--------b1----->a2
+ test_disjoint<ls, ls>("case_s", "linestring(0 0,4 0)", "linestring(2 0,2 2)", false);
+
+ // Collinear, but disjoint
+ test_disjoint<ls, ls>("c-d", "linestring(2 0,6 0)", "linestring(7 0,8 0)", true);
+
+ // Parallel, disjoint
+ test_disjoint<ls, ls>("c-d", "linestring(2 0,6 0)", "linestring(2 1,6 1)", true);
+
+ // Error still there until 1.48 (reported "error", was reported to disjoint, so that's why it did no harm)
+ test_disjoint<ls, ls>("case_recursive_boxes_1",
+ "linestring(10 7,10 6)", "linestring(10 10,10 9)", true);
+
+ }
+
// TODO test_disjoint<segment, ls>("s/ls 1", "linestring(0 0,1 1)", "linestring(1 0,0 1)", false);
// TODO test_disjoint<segment, ls>("s/ls 2", "linestring(0 0,1 1)", "linestring(1 0,2 1)", true);
// TODO test_disjoint<ls, segment>("ls/s 1", "linestring(0 0,1 1)", "linestring(1 0,0 1)", false);
Modified: branches/release/libs/geometry/test/algorithms/distance.cpp
==============================================================================
--- branches/release/libs/geometry/test/algorithms/distance.cpp (original)
+++ branches/release/libs/geometry/test/algorithms/distance.cpp 2012-02-05 13:48:26 EST (Sun, 05 Feb 2012)
@@ -244,6 +244,49 @@
test_empty_input(p, ring_empty);
}
+void test_large_integers()
+{
+ typedef bg::model::point<int, 2, bg::cs::cartesian> int_point_type;
+ typedef bg::model::point<double, 2, bg::cs::cartesian> double_point_type;
+
+ // point-point
+ {
+ std::string const a = "POINT(2544000 528000)";
+ std::string const b = "POINT(2768040 528000)";
+ int_point_type ia, ib;
+ double_point_type da, db;
+ bg::read_wkt(a, ia);
+ bg::read_wkt(b, ib);
+ bg::read_wkt(a, da);
+ bg::read_wkt(b, db);
+
+ BOOST_AUTO(idist, bg::distance(ia, ib));
+ BOOST_AUTO(ddist, bg::distance(da, db));
+
+ BOOST_CHECK_MESSAGE(std::abs(idist - ddist) < 0.1,
+ "within<a double> different from within<an int>");
+ }
+ // Point-segment
+ {
+ std::string const a = "POINT(2600000 529000)";
+ std::string const b = "LINESTRING(2544000 528000, 2768040 528000)";
+ int_point_type ia;
+ double_point_type da;
+ bg::model::segment<int_point_type> ib;
+ bg::model::segment<double_point_type> db;
+ bg::read_wkt(a, ia);
+ bg::read_wkt(b, ib);
+ bg::read_wkt(a, da);
+ bg::read_wkt(b, db);
+
+ BOOST_AUTO(idist, bg::distance(ia, ib));
+ BOOST_AUTO(ddist, bg::distance(da, db));
+
+ BOOST_CHECK_MESSAGE(std::abs(idist - ddist) < 0.1,
+ "within<a double> different from within<an int>");
+ }
+}
+
int test_main(int, char* [])
{
#ifdef TEST_ARRAY
@@ -253,6 +296,8 @@
//test_all<test::test_point>(); // located here because of 3D
#endif
+ test_large_integers();
+
test_all<bg::model::d2::point_xy<int> >();
test_all<boost::tuple<float, float> >();
test_all<bg::model::d2::point_xy<float> >();
Modified: branches/release/libs/geometry/test/algorithms/intersects.cpp
==============================================================================
--- branches/release/libs/geometry/test/algorithms/intersects.cpp (original)
+++ branches/release/libs/geometry/test/algorithms/intersects.cpp 2012-02-05 13:48:26 EST (Sun, 05 Feb 2012)
@@ -11,6 +11,8 @@
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
+#include <boost/geometry/util/rational.hpp>
+
template <typename P>
void test_all()
@@ -118,6 +120,9 @@
{
test_all<bg::model::d2::point_xy<double> >();
+ test_all<bg::model::d2::point_xy<boost::rational<int> > >();
+
+
#if defined(HAVE_TTMATH)
test_all<bg::model::d2::point_xy<ttmath_big> >();
#endif
Modified: branches/release/libs/geometry/test/algorithms/overlay/get_turn_info.cpp
==============================================================================
--- branches/release/libs/geometry/test/algorithms/overlay/get_turn_info.cpp (original)
+++ branches/release/libs/geometry/test/algorithms/overlay/get_turn_info.cpp 2012-02-05 13:48:26 EST (Sun, 05 Feb 2012)
@@ -47,7 +47,11 @@
typedef std::vector<turn_info> tp_vector;
turn_info model;
tp_vector info;
- bg::detail::overlay::get_turn_info<P, P, turn_info>::apply(pi, pj, pk, qi, qj, qk,
+ bg::detail::overlay::get_turn_info
+ <
+ P, P, turn_info,
+ bg::detail::overlay::assign_null_policy
+ >::apply(pi, pj, pk, qi, qj, qk,
model, std::back_inserter(info));
Modified: branches/release/libs/geometry/test/algorithms/overlay/overlay_cases.hpp
==============================================================================
--- branches/release/libs/geometry/test/algorithms/overlay/overlay_cases.hpp (original)
+++ branches/release/libs/geometry/test/algorithms/overlay/overlay_cases.hpp 2012-02-05 13:48:26 EST (Sun, 05 Feb 2012)
@@ -469,7 +469,8 @@
};
-
+// ticket_17 is keyholed, so has a hole formed by an deliberate intersection
+// This will fail the intersection/traversal process
static std::string ticket_17[2] = {
"POLYGON ((-122.28139163 37.37319149,-122.28100699 37.37273669,-122.28002186 37.37303123,-122.27979681 37.37290072,-122.28007349 37.37240493,-122.27977334 37.37220360,-122.27819720 37.37288580,-122.27714184 37.37275161,-122.27678628 37.37253167,-122.27766437 37.37180973,-122.27804382 37.37121453,-122.27687664 37.37101354,-122.27645829 37.37203386,-122.27604423 37.37249110,-122.27632234 37.37343339,-122.27760980 37.37391082,-122.27812478 37.37800320,-122.26117222 37.39121007,-122.25572289 37.39566631,-122.25547269 37.39564971,-122.25366304 37.39552993,-122.24919976 37.39580268,-122.24417933 37.39366907,-122.24051443 37.39094143,-122.23246277 37.38100418,-122.23606766 37.38141338,-122.24001587 37.37738940,-122.23666848 37.37609347,-122.23057450 37.37882170,-122.22679803 37.37807143,-122.22525727 37.37448817,-122.22523229 37.37443000,-122.23083199 37.37609347,-122.23033486 37.37777891,-122.23169030 37.37732117,-122.23229178 37.37709687,-122.23237761 37.37631249,-122.23297776 37.37438834,-122.23872850 37.37
165986,-122.24044511 37.36934068,-122.24671067 37.36865847,-122.24825570 37.36981819,-122.25151719 37.36947713,-122.25357721 37.36756706,-122.26001451 37.36579354,-122.25615213 37.36545239,-122.25486458 37.36245083,-122.25357721 37.36108651,-122.25194642 37.36013139,-122.24885652 37.35958557,-122.24911401 37.35849399,-122.25357721 37.35808470,-122.25675286 37.35897159,-122.25855539 37.35753887,-122.26181687 37.35828939,-122.26713837 37.35897159,-122.26782510 37.36108651,-122.26662339 37.36456559,-122.27288911 37.36722601,-122.27366159 37.36531602,-122.27168740 37.36470213,-122.27391900 37.36374701,-122.27074326 37.36245083,-122.27134408 37.35951742,-122.27426240 37.36135926,-122.27709482 37.36115474,-122.27966974 37.36231438,-122.27958391 37.36463382,-122.27572152 37.36463382,-122.27563569 37.36524779,-122.27700899 37.36593000,-122.27709482 37.36763529,-122.27554978 37.36838573,-122.27667254 37.36931478,-122.27677932 37.36932073,-122.27769362 37.36853987,-122.27942490 37.36830803,-122.28178776 37.36677917,-1
22.28509559 37.36443500,-122.28845129 37.36413744,-122.29194403 37.36695946,-122.29382577 37.36726817,-122.29600414 37.36898512,-122.29733083 37.36995398,-122.29593239 37.37141436,-122.29416649 37.37075898,-122.29325026 37.37108436,-122.29652910 37.37311697,-122.29584237 37.37374461,-122.29537583 37.37573372,-122.29487677 37.37752502,-122.30923212 37.37593011,-122.31122484 37.38230086,-122.31467994 37.38092472,-122.31715663 37.38252181,-122.32307970 37.38166978,-122.31985618 37.37667694,-122.32210304 37.37580220,-122.32581446 37.37589532,-122.32401730 37.37331839,-122.32960417 37.37189020,-122.33465527 37.37331906,-122.33425328 37.37623680,-122.33620676 37.37726132,-122.33397986 37.37822382,-122.33358918 37.38036590,-122.33202637 37.37986918,-122.33147954 37.38101784,-122.33394080 37.38198017,-122.33545239 37.38587943,-122.33478058 37.38785697,-122.33386050 37.38723721,-122.33350041 37.38571137,-122.33122003 37.38548891,-122.33140008 37.38650606,-122.33366042 37.38817490,-122.33244019 37.39157602,-122.332981
57 37.39419201,-122.33164013 37.39477028,-122.33202017 37.39518351,-122.33358038 37.39499282,-122.33376050 37.39597811,-122.33550067 37.39734478,-122.33556069 37.39481797,-122.33344040 37.39292676,-122.33638094 37.38892189,-122.34240644 37.38852719,-122.34906293 37.38726898,-122.35072321 37.39338769,-122.34910291 37.39445252,-122.34796272 37.39410291,-122.34449043 37.39640534,-122.34500223 37.39729709,-122.34936291 37.39670910,-122.35098322 37.39531066,-122.35364623 37.39554510,-122.35434369 37.39612111,-122.35798429 37.39600988,-122.35768430 37.39478621,-122.36334519 37.39206871,-122.36604726 37.39203267,-122.36778592 37.39335592,-122.36518870 37.40022011,-122.36554552 37.40247752,-122.36370519 37.40331974,-122.36270506 37.40530591,-122.36320512 37.40670418,-122.36149849 37.40851392,-122.36730580 37.41054938,-122.37263720 37.41378932,-122.37161871 37.42076600,-122.36566153 37.42006292,-122.36520547 37.42742106,-122.37165953 37.43661157,-122.35943972 37.44459022,-122.35356359 37.44600810,-122.33792254 37.457
96329,-122.35228518 37.47478091,-122.35127080 37.48181199,-122.34867342 37.48487322,-122.34359717 37.48801082,-122.33388431 37.48677650,-122.33142321 37.48429747,-122.32929580 37.48473149,-122.32609609 37.48291144,-122.32344850 37.48228229,-122.31924364 37.48410234,-122.31677299 37.48114051,-122.31431751 37.47848973,-122.31259201 37.47682190,-122.31515972 37.47568196,-122.31691389 37.47360309,-122.31292494 37.46960081,-122.31130153 37.46937743,-122.30889894 37.47124987,-122.30612839 37.47011613,-122.30149630 37.46568378,-122.30064277 37.46363784,-122.29283821 37.45922376,-122.28630141 37.45415497,-122.28883099 37.44629920,-122.28316717 37.44197138,-122.27554148 37.42297597,-122.25597410 37.40553692,-122.25196579 37.40129593,-122.25012043 37.40049143,-122.24823207 37.39897758,-122.24754551 37.39740941,-122.24778582 37.39621607,-122.24934787 37.39599102,-122.25005170 37.39871849,-122.25222328 37.39863668,-122.25342491 37.39737529,-122.25520162 37.39667289,-122.25528737 37.39522726,-122.27747460 37.37809616,-12
2.27977493 37.37858717,-122.28157729 37.37920106,-122.28322534 37.37952846,-122.28416939 37.38092656,-122.28621223 37.37984219,-122.28638389 37.37613857,-122.28382607 37.37843722,-122.27930278 37.37718220,-122.28196361 37.37652740,-122.28295058 37.37568167,-122.28216101 37.37523148,-122.28114822 37.37543608,-122.27934569 37.37528613,-122.27996369 37.37448121,-122.28104521 37.37454944,-122.28185197 37.37422883,-122.28290767 37.37474038,-122.28376597 37.37467224,-122.28428104 37.37399012,-122.28402346 37.37338989,-122.28610922 37.37364914,-122.28651264 37.37327388,-122.28672722 37.37207343,-122.28628398 37.37205448,-122.28574460 37.37166682,-122.28479711 37.37200981,-122.28327731 37.37137228,-122.28285511 37.37100700,-122.28279409 37.37125669,-122.28315527 37.37173756,-122.28321872 37.37220569,-122.28187007 37.37231918,-122.28193109 37.37294908,-122.28139163 37.37319149))",
"BOX(-122.280 37.377,-122.277 37.379)"};
@@ -512,6 +513,9 @@
};
+// Send on ggl-list by Christoph/Angus at 2011-08-19/20
+// This polygon combination fails to union in <float> but do in <double> or <ttmath>
+// It had previosly an error which has been fixed at 2011-08-30
static std::string ggl_list_20110820_christophe[2] =
{
"POLYGON((17.763942722600319 32.23605727739968,19.192448808558737 30.807551191441263,16.000000000000000 30.000000000000000,17.763942722600319 32.236057277399681))",
Modified: branches/release/libs/geometry/test/algorithms/overlay/robustness/interior_triangles.cpp
==============================================================================
--- branches/release/libs/geometry/test/algorithms/overlay/robustness/interior_triangles.cpp (original)
+++ branches/release/libs/geometry/test/algorithms/overlay/robustness/interior_triangles.cpp 2012-02-05 13:48:26 EST (Sun, 05 Feb 2012)
@@ -17,6 +17,7 @@
#define BOOST_GEOMETRY_NO_BOOST_TEST
#define BOOST_GEOMETRY_TIME_OVERLAY
+#include <test_overlay_p_q.hpp>
#include <boost/program_options.hpp>
#include <boost/random/linear_congruential.hpp>
@@ -25,15 +26,6 @@
#include <boost/random/variate_generator.hpp>
#include <boost/timer.hpp>
-#include <test_overlay_p_q.hpp>
-
-#include <boost/geometry/geometry.hpp>
-#include <boost/geometry/multi/multi.hpp>
-#include <boost/geometry/multi/geometries/multi_polygon.hpp>
-#include <boost/geometry/io/wkt/wkt.hpp>
-#include <boost/geometry/extensions/io/svg/svg_mapper.hpp>
-
-
template <typename Polygon>
inline void make_polygon(Polygon& polygon, int count_x, int count_y, int index, int offset)
{
Modified: branches/release/libs/geometry/test/algorithms/overlay/robustness/intersection_pies.cpp
==============================================================================
--- branches/release/libs/geometry/test/algorithms/overlay/robustness/intersection_pies.cpp (original)
+++ branches/release/libs/geometry/test/algorithms/overlay/robustness/intersection_pies.cpp 2012-02-05 13:48:26 EST (Sun, 05 Feb 2012)
@@ -7,20 +7,14 @@
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
-#include <iostream>
-#include <string>
#define BOOST_GEOMETRY_REPORT_OVERLAY_ERROR
#define BOOST_GEOMETRY_NO_BOOST_TEST
-#include <boost/program_options.hpp>
-#include <boost/timer.hpp>
-
#include <test_overlay_p_q.hpp>
-#include <boost/geometry/geometry.hpp>
-#include <boost/geometry/multi/multi.hpp>
-
+#include <boost/program_options.hpp>
+#include <boost/timer.hpp>
template <typename Polygon>
inline void make_pie(Polygon& polygon,
Modified: branches/release/libs/geometry/test/algorithms/overlay/robustness/intersection_stars.cpp
==============================================================================
--- branches/release/libs/geometry/test/algorithms/overlay/robustness/intersection_stars.cpp (original)
+++ branches/release/libs/geometry/test/algorithms/overlay/robustness/intersection_stars.cpp 2012-02-05 13:48:26 EST (Sun, 05 Feb 2012)
@@ -12,25 +12,12 @@
#define BOOST_GEOMETRY_NO_BOOST_TEST
-// For mixing int/float
-#if defined(_MSC_VER)
-#pragma warning( disable : 4267 )
-#endif
+#include <test_overlay_p_q.hpp>
#include <boost/program_options.hpp>
-
-//#include <algorithms/test_intersection.hpp>
-//#include <algorithms/test_overlay.hpp>
-
-
#include <boost/timer.hpp>
-#include <boost/geometry/geometry.hpp>
-#include <test_overlay_p_q.hpp>
-
-
-
template <typename Polygon>
inline void make_star(Polygon& polygon,
int count, double factor1, double factor2, long double offset = 0)
Modified: branches/release/libs/geometry/test/algorithms/overlay/robustness/intersects.cpp
==============================================================================
--- branches/release/libs/geometry/test/algorithms/overlay/robustness/intersects.cpp (original)
+++ branches/release/libs/geometry/test/algorithms/overlay/robustness/intersects.cpp 2012-02-05 13:48:26 EST (Sun, 05 Feb 2012)
@@ -17,6 +17,7 @@
#define BOOST_GEOMETRY_NO_BOOST_TEST
//#define BOOST_GEOMETRY_TIME_OVERLAY
+#include <test_overlay_p_q.hpp>
#include <boost/program_options.hpp>
#include <boost/random/linear_congruential.hpp>
@@ -25,14 +26,6 @@
#include <boost/random/variate_generator.hpp>
#include <boost/timer.hpp>
-#include <test_overlay_p_q.hpp>
-
-#include <boost/geometry/geometry.hpp>
-#include <boost/geometry/multi/multi.hpp>
-#include <boost/geometry/multi/geometries/multi_polygon.hpp>
-#include <boost/geometry/io/wkt/wkt.hpp>
-#include <boost/geometry/extensions/io/svg/svg_mapper.hpp>
-
template <typename MultiPolygon>
inline void make_polygon(MultiPolygon& mp, int count_x, int count_y, int index, int width_x)
Modified: branches/release/libs/geometry/test/algorithms/overlay/robustness/random_ellipses_stars.cpp
==============================================================================
--- branches/release/libs/geometry/test/algorithms/overlay/robustness/random_ellipses_stars.cpp (original)
+++ branches/release/libs/geometry/test/algorithms/overlay/robustness/random_ellipses_stars.cpp 2012-02-05 13:48:26 EST (Sun, 05 Feb 2012)
@@ -7,16 +7,12 @@
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
-#include <iostream>
-#include <sstream>
-#include <fstream>
-#include <iomanip>
-#include <string>
-
#define BOOST_GEOMETRY_REPORT_OVERLAY_ERROR
#define BOOST_GEOMETRY_NO_BOOST_TEST
+#include <test_overlay_p_q.hpp>
+
#include <boost/program_options.hpp>
#include <boost/timer.hpp>
#include <boost/random/linear_congruential.hpp>
@@ -25,13 +21,6 @@
#include <boost/random/variate_generator.hpp>
-#include <test_overlay_p_q.hpp>
-
-#include <boost/geometry/geometry.hpp>
-
-#include <boost/geometry/geometries/point_xy.hpp>
-
-
struct star_params
{
int count; // points of ellipse, not of star
Modified: branches/release/libs/geometry/test/algorithms/overlay/robustness/recursive_polygons.cpp
==============================================================================
--- branches/release/libs/geometry/test/algorithms/overlay/robustness/recursive_polygons.cpp (original)
+++ branches/release/libs/geometry/test/algorithms/overlay/robustness/recursive_polygons.cpp 2012-02-05 13:48:26 EST (Sun, 05 Feb 2012)
@@ -7,15 +7,10 @@
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
-#include <iostream>
-#include <sstream>
-#include <fstream>
-#include <iomanip>
-#include <string>
-
#define BOOST_GEOMETRY_REPORT_OVERLAY_ERROR
#define BOOST_GEOMETRY_NO_BOOST_TEST
+#include <test_overlay_p_q.hpp>
#include <boost/program_options.hpp>
#include <boost/random/linear_congruential.hpp>
@@ -24,15 +19,6 @@
#include <boost/random/variate_generator.hpp>
#include <boost/timer.hpp>
-#include <test_overlay_p_q.hpp>
-
-#include <boost/geometry/geometry.hpp>
-#include <boost/geometry/multi/multi.hpp>
-#include <boost/geometry/geometries/point_xy.hpp>
-#include <boost/geometry/multi/geometries/multi_polygon.hpp>
-#include <boost/geometry/io/wkt/wkt.hpp>
-#include <boost/geometry/extensions/io/svg/svg_mapper.hpp>
-
template <typename Polygon, typename Generator>
inline void make_polygon(Polygon& polygon, Generator& generator, bool triangular)
@@ -98,6 +84,7 @@
std::ostringstream out;
out << "recursive_box_" << index++ << "_" << level;
+
if (! test_overlay_p_q
<
polygon,
Modified: branches/release/libs/geometry/test/algorithms/overlay/robustness/star_comb.cpp
==============================================================================
--- branches/release/libs/geometry/test/algorithms/overlay/robustness/star_comb.cpp (original)
+++ branches/release/libs/geometry/test/algorithms/overlay/robustness/star_comb.cpp 2012-02-05 13:48:26 EST (Sun, 05 Feb 2012)
@@ -7,17 +7,14 @@
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
-#include <iostream>
-#include <sstream>
-#include <fstream>
-#include <iomanip>
-#include <string>
#define BOOST_GEOMETRY_REPORT_OVERLAY_ERROR
#define BOOST_GEOMETRY_NO_BOOST_TEST
#define BOOST_GEOMETRY_TIME_OVERLAY
+#include <test_overlay_p_q.hpp>
+
#include <boost/program_options.hpp>
#include <boost/random/linear_congruential.hpp>
#include <boost/random/uniform_int.hpp>
@@ -26,14 +23,6 @@
#include <boost/timer.hpp>
#include <star_comb.hpp>
-#include <test_overlay_p_q.hpp>
-
-#include <boost/geometry/geometry.hpp>
-#include <boost/geometry/multi/multi.hpp>
-#include <boost/geometry/geometries/point_xy.hpp>
-#include <boost/geometry/multi/geometries/multi_polygon.hpp>
-#include <boost/geometry/io/wkt/wkt.hpp>
-#include <boost/geometry/extensions/io/svg/svg_mapper.hpp>
template <typename Polygon>
Modified: branches/release/libs/geometry/test/algorithms/overlay/robustness/test_overlay_p_q.hpp
==============================================================================
--- branches/release/libs/geometry/test/algorithms/overlay/robustness/test_overlay_p_q.hpp (original)
+++ branches/release/libs/geometry/test/algorithms/overlay/robustness/test_overlay_p_q.hpp 2012-02-05 13:48:26 EST (Sun, 05 Feb 2012)
@@ -15,6 +15,8 @@
//#define BOOST_GEOMETRY_ROBUSTNESS_USE_DIFFERENCE
+#include <geometry_test_common.hpp>
+
// For mixing int/float
#if defined(_MSC_VER)
#pragma warning( disable : 4244 )
@@ -22,19 +24,13 @@
#endif
-#include <boost/geometry/geometry.hpp>
-
-#include <boost/geometry/io/wkt/wkt.hpp>
-
-#include <boost/geometry/multi/multi.hpp>
+#include <boost/geometry.hpp>
+#include <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/multi/geometries/multi_polygon.hpp>
-#include <boost/geometry/multi/io/wkt/wkt.hpp>
-
-#include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp>
#include <boost/geometry/extensions/io/svg/svg_mapper.hpp>
-#include <geometry_test_common.hpp>
-
+#include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp>
struct p_q_settings
{
@@ -51,6 +47,19 @@
{}
};
+template <typename Geometry>
+inline typename bg::default_area_result<Geometry>::type p_q_area(Geometry const& g)
+{
+ try
+ {
+ return bg::area(g);
+ }
+ catch(bg::empty_input_exception const&)
+ {
+ return 0;
+ }
+}
+
template <typename OutputType, typename CalculationType, typename G1, typename G2>
static bool test_overlay_p_q(std::string const& caseid,
G1 const& p, G2 const& q,
@@ -63,15 +72,15 @@
bg::model::multi_polygon<OutputType> out_i, out_u, out_d, out_d2;
- CalculationType area_p = bg::area(p);
- CalculationType area_q = bg::area(q);
+ CalculationType area_p = p_q_area(p);
+ CalculationType area_q = p_q_area(q);
CalculationType area_d1 = 0, area_d2 = 0;
bg::intersection(p, q, out_i);
- CalculationType area_i = bg::area(out_i);
+ CalculationType area_i = p_q_area(out_i);
bg::union_(p, q, out_u);
- CalculationType area_u = bg::area(out_u);
+ CalculationType area_u = p_q_area(out_u);
double sum = (area_p + area_q) - area_u - area_i;
@@ -81,8 +90,8 @@
{
bg::difference(p, q, out_d);
bg::difference(q, p, out_d2);
- area_d1 = bg::area(out_d);
- area_d2 = bg::area(out_d2);
+ area_d1 = p_q_area(out_d);
+ area_d2 = p_q_area(out_d2);
double sum_d1 = (area_u - area_q) - area_d1;
double sum_d2 = (area_u - area_p) - area_d2;
bool wrong_d1 = std::abs(sum_d1) > settings.tolerance;
Modified: branches/release/libs/geometry/test/algorithms/overlay/traverse.cpp
==============================================================================
--- branches/release/libs/geometry/test/algorithms/overlay/traverse.cpp (original)
+++ branches/release/libs/geometry/test/algorithms/overlay/traverse.cpp 2012-02-05 13:48:26 EST (Sun, 05 Feb 2012)
@@ -23,16 +23,18 @@
#include <geometry_test_common.hpp>
-//#define BOOST_GEOMETRY_DEBUG_ENRICH
+// #define BOOST_GEOMETRY_DEBUG_ENRICH
//#define BOOST_GEOMETRY_DEBUG_RELATIVE_ORDER
-#define BOOST_GEOMETRY_REPORT_OVERLAY_ERROR
-#define BOOST_GEOMETRY_DEBUG_SEGMENT_IDENTIFIER
+// #define BOOST_GEOMETRY_REPORT_OVERLAY_ERROR
+// #define BOOST_GEOMETRY_DEBUG_SEGMENT_IDENTIFIER
#define BOOST_GEOMETRY_TEST_OVERLAY_NOT_EXCHANGED
-
+#ifdef BOOST_GEOMETRY_DEBUG_ENRICH
+# define BOOST_GEOMETRY_DEBUG_IDENTIFIER
+#endif
#include <boost/geometry/algorithms/detail/overlay/turn_info.hpp>
#include <boost/geometry/algorithms/detail/overlay/enrichment_info.hpp>
@@ -756,11 +758,11 @@
test_traverse<polygon, polygon, operation_union>::apply("hv3", 1, 1624.22079205664, hv_3[0], hv_3[1], deviation);
test_traverse<polygon, polygon, operation_intersection>::apply("hv3", 1, 1623.8265057282042, hv_3[0], hv_3[1], deviation);
- test_traverse<polygon, polygon, operation_union>::apply("hv4", 1, 1626.5146964146334, hv_4[0], hv_4[1], deviation);
- test_traverse<polygon, polygon, operation_intersection>::apply("hv4", 1, 1626.2580370864305, hv_4[0], hv_4[1], deviation);
if (! is_float)
{
+ test_traverse<polygon, polygon, operation_union>::apply("hv4", 1, 1626.5146964146334, hv_4[0], hv_4[1], deviation);
+ test_traverse<polygon, polygon, operation_intersection>::apply("hv4", 1, 1626.2580370864305, hv_4[0], hv_4[1], deviation);
test_traverse<polygon, polygon, operation_union>::apply("hv5", 1, 1624.2158307261871, hv_5[0], hv_5[1], deviation);
test_traverse<polygon, polygon, operation_intersection>::apply("hv5", 1, 1623.4506071521519, hv_5[0], hv_5[1], deviation);
@@ -884,16 +886,27 @@
test_traverse<polygon, polygon, operation_union>::apply("geos_4",
1, 2304.41633605957,
geos_4[0], geos_4[1]);
+
+ if (! is_float)
+ {
- return;
-
- // Cases below still have errors
+#if defined(_MSC_VER)
+ double const expected = if_typed_tt<T>(3.63794e-17, 0.0);
+#else
+ double const expected = if_typed<T, long double>(2.77555756156289135106e-17, 0.0);
+#endif
- // ticket#17
- test_traverse<polygon, box, operation_intersection>::apply("ticket_17", 2, 2.687433027e-006,
- ticket_17[0], ticket_17[1], 0.1);
- test_traverse<polygon, box, operation_union>::apply("ticket_17", 3, 0.00922511561516,
- ticket_17[0], ticket_17[1], 0.1);
+ // Calculate intersection/union of two triangles. Robustness case.
+ // ttmath can form a very small intersection triangle
+ // (which is even not accomplished by SQL Server/PostGIS)
+ std::string const caseid = "ggl_list_20110820_christophe";
+ test_traverse<polygon, polygon, operation_intersection>::apply(caseid,
+ 1, expected,
+ ggl_list_20110820_christophe[0], ggl_list_20110820_christophe[1]);
+ test_traverse<polygon, polygon, operation_union>::apply(caseid,
+ 1, 67.3550722317627,
+ ggl_list_20110820_christophe[0], ggl_list_20110820_christophe[1]);
+ }
}
template <typename T>
Modified: branches/release/libs/geometry/test/algorithms/test_convex_hull.hpp
==============================================================================
--- branches/release/libs/geometry/test/algorithms/test_convex_hull.hpp (original)
+++ branches/release/libs/geometry/test/algorithms/test_convex_hull.hpp 2012-02-05 13:48:26 EST (Sun, 05 Feb 2012)
@@ -40,7 +40,8 @@
<< " detected: " << n);
- BOOST_CHECK(bg::num_points(geometry) == size_original);
+ // We omit this check as it is not important for the hull algorithm
+ // BOOST_CHECK(bg::num_points(geometry) == size_original);
typename bg::default_area_result<Geometry>::type ah = bg::area(hull);
if (reverse)
Modified: branches/release/libs/geometry/test/algorithms/within.cpp
==============================================================================
--- branches/release/libs/geometry/test/algorithms/within.cpp (original)
+++ branches/release/libs/geometry/test/algorithms/within.cpp 2012-02-05 13:48:26 EST (Sun, 05 Feb 2012)
@@ -218,8 +218,33 @@
}
+void test_large_integers()
+{
+ typedef bg::model::point<int, 2, bg::cs::cartesian> int_point_type;
+ typedef bg::model::point<double, 2, bg::cs::cartesian> double_point_type;
+
+ std::string const polygon_li = "POLYGON((1872000 528000,1872000 192000,1536119 192000,1536000 528000,1200000 528000,1200000 863880,1536000 863880,1872000 863880,1872000 528000))";
+ bg::model::polygon<int_point_type> int_poly;
+ bg::model::polygon<double_point_type> double_poly;
+ bg::read_wkt(polygon_li, int_poly);
+ bg::read_wkt(polygon_li, double_poly);
+
+ std::string const point_li = "POINT(1592000 583950)";
+ int_point_type int_point;
+ double_point_type double_point;
+ bg::read_wkt(point_li, int_point);
+ bg::read_wkt(point_li, double_point);
+
+ bool wi = bg::within(int_point, int_poly);
+ bool wd = bg::within(double_point, double_poly);
+
+ BOOST_CHECK_MESSAGE(wi == wd, "within<a double> different from within<an int>");
+}
+
int test_main( int , char* [] )
{
+ test_large_integers();
+
test_all<bg::model::d2::point_xy<int> >();
test_all<bg::model::d2::point_xy<double> >();
Modified: branches/release/libs/geometry/test/geometry_test_common.hpp
==============================================================================
--- branches/release/libs/geometry/test/geometry_test_common.hpp (original)
+++ branches/release/libs/geometry/test/geometry_test_common.hpp 2012-02-05 13:48:26 EST (Sun, 05 Feb 2012)
@@ -111,11 +111,11 @@
#endif
-template <typename CoordinateType, typename T>
-inline T if_typed_tt(T value_tt, T value)
+template <typename CoordinateType, typename T1, typename T2>
+inline T1 if_typed_tt(T1 value_tt, T2 value)
{
#if defined(HAVE_TTMATH)
- return boost::is_same<CoordinateType, ttmath_big>::value ? value_tt : value;
+ return boost::is_same<CoordinateType, ttmath_big>::type::value ? value_tt : value;
#else
return value;
#endif
Modified: branches/release/libs/geometry/test/io/wkt/wkt.cpp
==============================================================================
--- branches/release/libs/geometry/test/io/wkt/wkt.cpp (original)
+++ branches/release/libs/geometry/test/io/wkt/wkt.cpp 2012-02-05 13:48:26 EST (Sun, 05 Feb 2012)
@@ -12,7 +12,6 @@
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
-//#include <iostream>
#include <sstream>
#include <string>
@@ -58,40 +57,27 @@
BOOST_CHECK_CLOSE(double(bg::perimeter(geometry)), peri, 0.0001);
}
- // String comparison: only for int/double/float etc
- // GMP/CLN add +e01, L0, etc
- if (boost::is_fundamental
- <
- typename bg::coordinate_type<G>::type
- >::type::value)
- {
- std::ostringstream out;
- out << bg::wkt(geometry);
- BOOST_CHECK_EQUAL(boost::to_upper_copy(out.str()),
- boost::to_upper_copy(wkt));
- }
+ std::ostringstream out;
+ out << bg::wkt(geometry);
+ BOOST_CHECK_EQUAL(boost::to_upper_copy(out.str()),
+ boost::to_upper_copy(wkt));
}
template <typename G>
void test_relaxed_wkt(std::string const& wkt, std::string const& expected)
{
- if (boost::is_fundamental
- <
- typename bg::coordinate_type<G>::type
- >::type::value)
- {
- std::string e;
- G geometry;
- bg::read_wkt(wkt, geometry);
- std::ostringstream out;
- out << bg::wkt(geometry);
+ std::string e;
+ G geometry;
+ bg::read_wkt(wkt, geometry);
+ std::ostringstream out;
+ out << bg::wkt(geometry);
- BOOST_CHECK_EQUAL(boost::to_upper_copy(out.str()), boost::to_upper_copy(expected));
- }
+ BOOST_CHECK_EQUAL(boost::to_upper_copy(out.str()), boost::to_upper_copy(expected));
}
+
template <typename G>
void test_wrong_wkt(std::string const& wkt, std::string const& start)
{
@@ -106,8 +92,29 @@
e = ex.what();
boost::to_lower(e);
}
- BOOST_CHECK_MESSAGE(boost::starts_with(e, start), " Expected:"
- << start << " Got:" << e << " with WKT: " << wkt);
+ catch(...)
+ {
+ e = "other exception";
+ }
+
+ bool check = true;
+
+#if defined(HAVE_TTMATH)
+ // For ttmath we skip bad lexical casts
+ typedef typename bg::coordinate_type<G>::type ct;
+
+ if (boost::is_same<ct, ttmath_big>::type::value
+ && boost::starts_with(start, "bad lexical cast"))
+ {
+ check = false;
+ }
+#endif
+
+ if (check)
+ {
+ BOOST_CHECK_MESSAGE(boost::starts_with(e, start), " Expected:"
+ << start << " Got:" << e << " with WKT: " << wkt);
+ }
}
template <typename G>
@@ -126,7 +133,7 @@
using namespace boost::geometry;
typedef bg::model::point<T, 2, bg::cs::cartesian> P;
- test_wkt<P >("POINT(1 2)", 1);
+ test_wkt<P>("POINT(1 2)", 1);
test_wkt<bg::model::linestring<P> >("LINESTRING(1 1,2 2,3 3)", 3, 2 * sqrt(2.0));
test_wkt<bg::model::polygon<P> >("POLYGON((0 0,0 4,4 4,4 0,0 0)"
",(1 1,1 2,2 2,2 1,1 1),(1 1,1 2,2 2,2 1,1 1))", 15, 0, 18, 24);
Modified: branches/release/libs/geometry/test/io/wkt/wkt.vcproj
==============================================================================
--- branches/release/libs/geometry/test/io/wkt/wkt.vcproj (original)
+++ branches/release/libs/geometry/test/io/wkt/wkt.vcproj 2012-02-05 13:48:26 EST (Sun, 05 Feb 2012)
@@ -20,7 +20,7 @@
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)\wkt"
ConfigurationType="1"
- InheritedPropertySheets="..\..\boost.vsprops"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
CharacterSet="1"
>
<Tool
@@ -93,7 +93,7 @@
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)\wkt"
ConfigurationType="1"
- InheritedPropertySheets="..\..\boost.vsprops"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
CharacterSet="1"
WholeProgramOptimization="1"
>
Modified: branches/release/libs/geometry/test/multi/algorithms/multi_convex_hull.cpp
==============================================================================
--- branches/release/libs/geometry/test/multi/algorithms/multi_convex_hull.cpp (original)
+++ branches/release/libs/geometry/test/multi/algorithms/multi_convex_hull.cpp 2012-02-05 13:48:26 EST (Sun, 05 Feb 2012)
@@ -47,9 +47,28 @@
typedef bg::model::multi_point<P> mp;
typedef bg::model::multi_linestring<bg::model::linestring<P> > ml;
typedef bg::model::multi_polygon<bg::model::polygon<P> > mpoly;
- test_geometry<mp>("multipoint((1.1 1.1), (2.5 2.1), (3.1 3.1), (4.9 1.1), (3.1 1.9))", 5, 4, 3.8);
+
+ // All points below in upper-points and lower-points
+ test_geometry<mp>("MULTIPOINT((0 0),(5 0),(1 1),(4 1))", -1, 5, 4.0);
+ test_geometry<mp>("MULTIPOINT((0 1),(5 1),(1 0),(4 0))", -1, 5, 4.0);
+
+ // All points in vertical line (this delivers an empty polygon with 2 points and a closing point)
+ test_geometry<mp>("MULTIPOINT((1 0),(5 0),(3 0),(4 0),(2 0))", -1, 3, 0.0);
+
+ // One point only
+ test_geometry<mp>("MULTIPOINT((1 0))", -1, 3, 0.0);
+
+ // Problem of 6019, reproduced by the convex hull robustness test:
+ test_geometry<mp>("MULTIPOINT((2 9),(1 3),(9 4),(1 1),(1 0),(7 9),(2 5),(3 7),(3 6),(2 4))",
+ -1, 6, 48.0);
+
+ // Ticket 6019:
+ test_geometry<mp>("MULTIPOINT((0 53),(0 103),(0 53),(0 3),(0 3),(0 0),(1 0),(1 1),(2 1),(2 0),(2 0),(2 0),(3 0),(3 1),(4 1),(4 0),(5 0),(0 3),(10 3),(10 2),(10 2),(10 2),(5 2),(5 0),(5 0),(55 0),(105 0))",
+ -1, 4, 5407.5);
// Ticket 6021:
test_geometry<mp>("multipoint((0 53), (0 103), (1 53))", 3, 4, 25);
+
+ test_geometry<mp>("multipoint((1.1 1.1), (2.5 2.1), (3.1 3.1), (4.9 1.1), (3.1 1.9))", 5, 4, 3.8);
test_geometry<ml>("multilinestring((2 4, 3 4, 3 5), (4 3,4 4,5 4))", 6, 5, 3.0);
test_geometry<mpoly>("multipolygon(((1 4,1 6,2 5,3 5,4 6,4 4,1 4)), ((4 2,4 3,6 3,6 2,4 2)))", 12, 7, 14.0);
Modified: branches/release/libs/geometry/test/multi/algorithms/multi_difference.cpp
==============================================================================
--- branches/release/libs/geometry/test/multi/algorithms/multi_difference.cpp (original)
+++ branches/release/libs/geometry/test/multi/algorithms/multi_difference.cpp 2012-02-05 13:48:26 EST (Sun, 05 Feb 2012)
@@ -175,7 +175,7 @@
test_all<bg::model::d2::point_xy<double> >();
#ifdef HAVE_TTMATH
- //test_all<bg::model::d2::point_xy<ttmath_big> >();
+ test_all<bg::model::d2::point_xy<ttmath_big> >();
#endif
return 0;
Modified: branches/release/libs/geometry/test/multi/algorithms/multi_union.cpp
==============================================================================
--- branches/release/libs/geometry/test/multi/algorithms/multi_union.cpp (original)
+++ branches/release/libs/geometry/test/multi/algorithms/multi_union.cpp 2012-02-05 13:48:26 EST (Sun, 05 Feb 2012)
@@ -134,7 +134,7 @@
test_all<bg::model::d2::point_xy<double> >();
#ifdef HAVE_TTMATH
- //test_all<bg::model::d2::point_xy<ttmath_big> >();
+ test_all<bg::model::d2::point_xy<ttmath_big> >();
#endif
return 0;
Modified: branches/release/libs/geometry/test/strategies/pythagoras.cpp
==============================================================================
--- branches/release/libs/geometry/test/strategies/pythagoras.cpp (original)
+++ branches/release/libs/geometry/test/strategies/pythagoras.cpp 2012-02-05 13:48:26 EST (Sun, 05 Feb 2012)
@@ -233,6 +233,43 @@
"987654.32100001", "876543.21900001");
}
+template <typename CoordinateType>
+void test_integer(bool check_types)
+{
+ typedef bg::model::point<CoordinateType, 2, bg::cs::cartesian> point_type;
+
+ point_type p1, p2;
+ bg::assign_values(p1, 12345678, 23456789);
+ bg::assign_values(p2, 98765432, 87654321);
+
+ typedef bg::strategy::distance::pythagoras
+ <
+ point_type
+ > pythagoras_type;
+ pythagoras_type pythagoras;
+ BOOST_AUTO(distance, pythagoras.apply(p1, p2));
+ BOOST_CHECK_CLOSE(distance, 107655455.02347542, 0.001);
+
+ typedef typename bg::strategy::distance::services::comparable_type
+ <
+ pythagoras_type
+ >::type comparable_type;
+ comparable_type comparable;
+ BOOST_AUTO(cdistance, comparable.apply(p1, p2));
+ BOOST_CHECK_EQUAL(cdistance, 11589696996311540);
+
+ typedef BOOST_TYPEOF(cdistance) cdistance_type;
+ typedef BOOST_TYPEOF(distance) distance_type;
+
+ distance_type distance2 = sqrt(distance_type(cdistance));
+ BOOST_CHECK_CLOSE(distance, distance2, 0.001);
+
+ if (check_types)
+ {
+ BOOST_CHECK((boost::is_same<distance_type, double>::type::value));
+ BOOST_CHECK((boost::is_same<cdistance_type, boost::long_long_type>::type::value));
+ }
+}
template <typename P1, typename P2>
@@ -284,6 +321,10 @@
int test_main(int, char* [])
{
+ test_integer<int>(true);
+ test_integer<boost::long_long_type>(true);
+ test_integer<double>(false);
+
test_all_3d<int[3]>();
test_all_3d<float[3]>();
test_all_3d<double[3]>();
@@ -303,7 +344,8 @@
test_services<double[3], test::test_point, float>();
- time_compare<bg::model::point<double, 2, bg::cs::cartesian> >(10000);
+ // TODO move this to another non-unit test
+ // time_compare<bg::model::point<double, 2, bg::cs::cartesian> >(10000);
#if defined(HAVE_TTMATH)
Modified: branches/release/libs/geometry/test/strategies/segment_intersection_collinear.cpp
==============================================================================
--- branches/release/libs/geometry/test/strategies/segment_intersection_collinear.cpp (original)
+++ branches/release/libs/geometry/test/strategies/segment_intersection_collinear.cpp 2012-02-05 13:48:26 EST (Sun, 05 Feb 2012)
@@ -58,11 +58,6 @@
int expected_x2 = -99, int expected_y2 = -99)
{
-
-//#ifdef REPORT
- std::cout << "Case: " << case_id << std::endl;
-//#endif
-
typedef typename bg::coordinate_type<P>::type coordinate_type;
typedef bg::model::referring_segment<const P> segment_type;
@@ -243,6 +238,15 @@
6, 0, 2, 0,
'e', true, 0, 0,
2, 0, 6, 0);
+
+ // a1---------->a2
+ // b2<----------b1
+ test_segment_intersection<P>("case_recursive_boxes_1",
+ 10, 7, 10, 6,
+ 10, 10, 10, 9,
+ 'd', false, 0, 0,
+ -1, -1, -1, -1);
+
}
int test_main(int, char* [])
Modified: branches/release/libs/geometry/test/util/Jamfile.v2
==============================================================================
--- branches/release/libs/geometry/test/util/Jamfile.v2 (original)
+++ branches/release/libs/geometry/test/util/Jamfile.v2 2012-02-05 13:48:26 EST (Sun, 05 Feb 2012)
@@ -10,6 +10,7 @@
test-suite boost-geometry-util
:
+ [ run calculation_type.cpp ]
[ run for_each_coordinate.cpp ]
[ run rational.cpp ]
[ run select_most_precise.cpp ]
Modified: branches/release/libs/geometry/test/util/select_most_precise.cpp
==============================================================================
--- branches/release/libs/geometry/test/util/select_most_precise.cpp (original)
+++ branches/release/libs/geometry/test/util/select_most_precise.cpp 2012-02-05 13:48:26 EST (Sun, 05 Feb 2012)
@@ -18,33 +18,14 @@
#include <boost/geometry/util/select_most_precise.hpp>
-#include <boost/mpl/int.hpp>
+struct user_defined {};
-
-using namespace boost::geometry;
-
-struct user_defined
-{
-};
-
-template <typename T> struct check_selection : public boost::mpl::int_<0> {};
-
-template <> struct check_selection<short int> : public boost::mpl::int_<1> {};
-template <> struct check_selection<int> : public boost::mpl::int_<2> {};
-template <> struct check_selection<float> : public boost::mpl::int_<11> {};
-template <> struct check_selection<double> : public boost::mpl::int_<12> {};
-template <> struct check_selection<long double> : public boost::mpl::int_<13> {};
-template <> struct check_selection<user_defined> : public boost::mpl::int_<99> {};
-
-template <> struct check_selection<void> : public boost::mpl::int_<98> {};
-
-
-template <typename T1, typename T2, typename TypeToBeSelected>
+template <typename T1, typename T2, typename ExpectedType>
void test()
{
typedef typename bg::select_most_precise<T1, T2>::type type;
- BOOST_CHECK_EQUAL(check_selection<type>::type::value,
- check_selection<TypeToBeSelected>::type::value);
+
+ BOOST_CHECK((boost::is_same<type, ExpectedType>::type::value));
}
int test_main(int, char* [])
Modified: branches/release/libs/geometry/test/util/util_tests.sln
==============================================================================
--- branches/release/libs/geometry/test/util/util_tests.sln (original)
+++ branches/release/libs/geometry/test/util/util_tests.sln 2012-02-05 13:48:26 EST (Sun, 05 Feb 2012)
@@ -10,6 +10,8 @@
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rational", "rational.vcproj", "{6ABF6324-C1DC-4687-9895-B4CE2B27446F}"
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "calculation_type", "calculation_type.vcproj", "{CF8FE803-A26B-4553-B605-9C28225B5595}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@@ -36,6 +38,10 @@
{6ABF6324-C1DC-4687-9895-B4CE2B27446F}.Debug|Win32.Build.0 = Debug|Win32
{6ABF6324-C1DC-4687-9895-B4CE2B27446F}.Release|Win32.ActiveCfg = Release|Win32
{6ABF6324-C1DC-4687-9895-B4CE2B27446F}.Release|Win32.Build.0 = Release|Win32
+ {CF8FE803-A26B-4553-B605-9C28225B5595}.Debug|Win32.ActiveCfg = Debug|Win32
+ {CF8FE803-A26B-4553-B605-9C28225B5595}.Debug|Win32.Build.0 = Debug|Win32
+ {CF8FE803-A26B-4553-B605-9C28225B5595}.Release|Win32.ActiveCfg = Release|Win32
+ {CF8FE803-A26B-4553-B605-9C28225B5595}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk