File indexing completed on 2026-08-21 08:45:59
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_POSITION_CODE_HPP
0010 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_POSITION_CODE_HPP
0011
0012 #include <boost/geometry/algorithms/detail/direction_code.hpp>
0013
0014 namespace boost { namespace geometry
0015 {
0016
0017 #ifndef DOXYGEN_NO_DETAIL
0018 namespace detail
0019 {
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033 template <typename Point, typename SideStrategy>
0034 int get_position_code(Point const& p1, Point const& p2, Point const& point, SideStrategy const& side_strategy)
0035 {
0036 using cs_tag = typename SideStrategy::cs_tag;
0037 auto const side = side_strategy.apply(p1, p2, point);
0038 if (side == 1)
0039 {
0040
0041 return 4;
0042 }
0043 else if (side == -1)
0044 {
0045
0046 return 2;
0047 }
0048
0049
0050 auto const dir_code = direction_code<cs_tag>(p1, p2, point);
0051 if (dir_code == -1)
0052 {
0053
0054 return 1;
0055 }
0056 else if (dir_code == 1)
0057 {
0058
0059 return 3;
0060 }
0061
0062
0063 return 0;
0064 }
0065
0066 }
0067 #endif
0068
0069 }}
0070
0071 #endif