Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-15 08:35:05

0001 // Boost.Geometry (aka GGL, Generic Geometry Library)
0002 
0003 // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
0004 
0005 // This file was modified by Oracle on 2015-2024.
0006 // Modifications copyright (c) 2015-2024, Oracle and/or its affiliates.
0007 // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
0008 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
0009 
0010 // Use, modification and distribution is subject to the Boost Software License,
0011 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0012 // http://www.boost.org/LICENSE_1_0.txt)
0013 
0014 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_INTERSECTION_BOX_BOX_IMPLEMENTATION_HPP
0015 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_INTERSECTION_BOX_BOX_IMPLEMENTATION_HPP
0016 
0017 
0018 #include <boost/geometry/core/access.hpp>
0019 
0020 
0021 namespace boost { namespace geometry
0022 {
0023 
0024 #ifndef DOXYGEN_NO_DETAIL
0025 namespace detail { namespace intersection
0026 {
0027 
0028 template <std::size_t Dimension, std::size_t DimensionCount>
0029 struct intersection_box_box
0030 {
0031     template
0032     <
0033         typename Box1, typename Box2,
0034         typename BoxOut,
0035         typename Strategy
0036     >
0037     static inline bool apply(Box1 const& box1,
0038             Box2 const& box2,
0039             BoxOut& box_out,
0040             Strategy const& strategy)
0041     {
0042         auto max1 = get<max_corner, Dimension>(box1);
0043         auto min2 = get<min_corner, Dimension>(box2);
0044 
0045         if (max1 < min2)
0046         {
0047             return false;
0048         }
0049 
0050         auto max2 = get<max_corner, Dimension>(box2);
0051         auto min1 = get<min_corner, Dimension>(box1);
0052 
0053         if (max2 < min1)
0054         {
0055             return false;
0056         }
0057 
0058         // Set dimensions of output coordinate
0059         set<min_corner, Dimension>(box_out, min1 < min2 ? min2 : min1);
0060         set<max_corner, Dimension>(box_out, max1 > max2 ? max2 : max1);
0061 
0062         return intersection_box_box<Dimension + 1, DimensionCount>
0063                ::apply(box1, box2, box_out, strategy);
0064     }
0065 };
0066 
0067 template <std::size_t DimensionCount>
0068 struct intersection_box_box<DimensionCount, DimensionCount>
0069 {
0070     template
0071     <
0072         typename Box1, typename Box2,
0073         typename BoxOut,
0074         typename Strategy
0075     >
0076     static inline bool apply(Box1 const&, Box2 const&, BoxOut&, Strategy const&)
0077     {
0078         return true;
0079     }
0080 };
0081 
0082 
0083 }} // namespace detail::intersection
0084 #endif // DOXYGEN_NO_DETAIL
0085 
0086 }} // namespace boost::geometry
0087 
0088 
0089 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_INTERSECTION_BOX_BOX_IMPLEMENTATION_HPP