// Boost.Geometry (aka GGL, Generic Geometry Library) // Unit Test // Copyright (c) 2007-2011 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2011 Bruno Lalande, Paris, France. // Copyright (c) 2009-2011 Mateusz Loskot, London, UK. // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #include #include #include #include #include #include BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian); template void test_2d() { test_envelope

("POINT(1 1)", 1, 1, 1, 1); test_envelope >("LINESTRING(1 1,2 2)", 1, 2, 1, 2); test_envelope >("POLYGON((1 1,1 3,3 3,3 1,1 1))", 1, 3, 1, 3); test_envelope >("POLYGON((1 1,1 3,3 3,3 1,1 1))", 1, 3, 1, 3); test_envelope >("BOX(1 1,3 3)", 1, 3, 1, 3); // Triangle, closed and open, and CCW. // Note that for the envelope algorithm, // these combinations should theoretically not differ test_envelope >("POLYGON((4 1,0 7,7 9,4 1))", 0, 7, 1, 9); test_envelope >("POLYGON((4 1,0 7,7 9))", 0, 7, 1, 9); test_envelope >("POLYGON((4 1,7 9,0 7,4 1))", 0, 7, 1, 9); test_envelope >("POLYGON((4 1,7 9,0 7))", 0, 7, 1, 9); typedef std::pair segment_type; test_envelope("SEGMENT(1 1,3 3)", 1, 3, 1, 3); } template void test_3d() { test_envelope

("POINT(1 2 3)", 1, 1, 2, 2, 3, 3); test_envelope

("POINT(3 2 1)", 3, 3, 2, 2, 1, 1); test_envelope >("LINESTRING(1 1 1,2 2 2)", 1, 2, 1, 2, 1, 2); test_envelope >("BOX(1 1 1,3 3 3)", 1, 3, 1, 3, 1, 3); } int test_main(int, char* []) { //test_2d(); //test_2d(); //test_2d(); test_2d >(); test_2d >(); test_2d >(); test_2d >(); test_3d(); test_3d >(); #ifdef HAVE_TTMATH test_2d >(); test_3d >(); #endif return 0; }