// Boost.Geometry // Unit Test // Copyright (c) 2022 Barend Gehrels, Amsterdam, the Netherlands. // This file was modified by Oracle on 2024. // Modifications copyright (c) 2024, Oracle and/or its affiliates. // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // 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 template void test_sectionalize_on_const(Geometry const& geometry, std::size_t expected_section_count) { namespace bg = boost::geometry; using point_type = typename bg::point_type::type; using writable_point_type = typename bg::helper_geometry::type; using box_type = bg::model::box; using section_type = bg::sections; using dim_type = std::integer_sequence; section_type sections; bg::sectionalize(geometry, sections); BOOST_CHECK_EQUAL(sections.size(), expected_section_count); } int test_main(int, char* []) { ring_of_const_point shape; // Construct a shape with 2 monotonic sections in x-dimension and 5 in y-dimension shape.emplace_back(0, 0); shape.emplace_back(4, 4); shape.emplace_back(6, 2); shape.emplace_back(8, 4); shape.emplace_back(12, 0); shape.emplace_back(0, 0); // Check if sectionalize (and some other functions) accept this geometry type with const points BOOST_CHECK_CLOSE(28, boost::geometry::area(shape), 0.01); BOOST_CHECK_CLOSE(28.97, boost::geometry::perimeter(shape), 0.01); test_sectionalize_on_const<0>(shape, 2); test_sectionalize_on_const<1>(shape, 5); return 0; }