// Boost.Geometry (aka GGL, Generic Geometry Library) // Copyright (c) 2018-2021 Oracle and/or its affiliates. // Contributed and/or modified by Vissarion Fisikopoulos, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, 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) #ifndef BOOST_GEOMETRY_STRATEGIES_CARTESIAN_DISTANCE_SEGMENT_BOX_HPP #define BOOST_GEOMETRY_STRATEGIES_CARTESIAN_DISTANCE_SEGMENT_BOX_HPP #include #include #include #include #include namespace boost { namespace geometry { namespace strategy { namespace distance { template < typename CalculationType = void, typename Strategy = pythagoras > struct cartesian_segment_box { template struct calculation_type : promote_floating_point < typename strategy::distance::services::return_type < Strategy, PointOfSegment, PointOfBox >::type > {}; typedef cartesian_tag cs_tag; template < typename LessEqual, typename ReturnType, typename SegmentPoint, typename BoxPoint, typename Strategies > inline ReturnType segment_below_of_box(SegmentPoint const& p0, SegmentPoint const& p1, BoxPoint const&, BoxPoint const&, BoxPoint const&, BoxPoint const& bottom_right, Strategies const& strategies) const { // TODO: The strategy should not call the algorithm like that return geometry::detail::distance::segment_to_box_2D < ReturnType, SegmentPoint, BoxPoint, Strategies >::template call_above_of_box < typename LessEqual::other >(p1, p0, bottom_right, strategies); } template static void mirror(SPoint&, SPoint&, BPoint&, BPoint&, BPoint&, BPoint&) {} }; #ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS namespace services { template struct tag > { typedef strategy_tag_distance_segment_box type; }; template struct return_type, PS, PB> : cartesian_segment_box::template calculation_type {}; template struct comparable_type > { // Define a cartesian_segment_box strategy with its underlying point-point // strategy being comparable typedef cartesian_segment_box < CalculationType, typename comparable_type::type > type; }; template struct get_comparable > { typedef typename comparable_type < cartesian_segment_box >::type comparable_type; public : static inline comparable_type apply(cartesian_segment_box const& ) { return comparable_type(); } }; template struct result_from_distance, PS, PB> { private : typedef typename return_type< cartesian_segment_box < CalculationType, Strategy >, PS, PB >::type return_type; public : template static inline return_type apply(cartesian_segment_box const& , T const& value) { Strategy s; return result_from_distance::apply(s, value); } }; template struct default_strategy < segment_tag, box_tag, Segment, Box, cartesian_tag, cartesian_tag > { typedef cartesian_segment_box<> type; }; template struct default_strategy < box_tag, segment_tag, Box, Segment, cartesian_tag, cartesian_tag > { typedef typename default_strategy < segment_tag, box_tag, Segment, Box, cartesian_tag, cartesian_tag >::type type; }; } #endif }} // namespace strategy::distance }} // namespace boost::geometry #endif // BOOST_GEOMETRY_STRATEGIES_CARTESIAN_DISTANCE_SEGMENT_BOX_HPP