File indexing completed on 2025-09-15 08:35:15
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_POINT_IS_EQUAL_OR_SPIKE_HPP
0019 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_POINT_IS_EQUAL_OR_SPIKE_HPP
0020
0021 #include <boost/geometry/algorithms/detail/direction_code.hpp>
0022 #include <boost/geometry/core/cs.hpp>
0023 #include <boost/geometry/strategies/side.hpp>
0024 #include <boost/geometry/util/constexpr.hpp>
0025 #include <boost/geometry/util/math.hpp>
0026
0027
0028 namespace boost { namespace geometry
0029 {
0030
0031
0032 #ifndef DOXYGEN_NO_DETAIL
0033 namespace detail
0034 {
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046 template
0047 <
0048 typename Point1, typename Point2, typename Point3,
0049 typename SideStrategy
0050 >
0051 inline bool point_is_spike_or_equal(Point1 const& last_point,
0052 Point2 const& segment_a,
0053 Point3 const& segment_b,
0054 SideStrategy const& strategy)
0055 {
0056 using cs_tag = typename SideStrategy::cs_tag;
0057
0058 int const side = strategy.apply(segment_a, segment_b, last_point);
0059 if (side == 0)
0060 {
0061
0062 return direction_code<cs_tag>(segment_a, segment_b, last_point) < 1;
0063 }
0064 return false;
0065 }
0066
0067 template
0068 <
0069 typename Point1,
0070 typename Point2,
0071 typename Point3,
0072 typename SideStrategy
0073 >
0074 inline bool point_is_collinear(Point1 const& last_point,
0075 Point2 const& segment_a,
0076 Point3 const& segment_b,
0077 SideStrategy const& strategy)
0078 {
0079 int const side = strategy.apply(segment_a, segment_b, last_point);
0080 if (side == 0)
0081 {
0082 return true;
0083 }
0084 return false;
0085 }
0086
0087
0088
0089
0090
0091 template
0092 <
0093 typename Point1,
0094 typename Point2,
0095 typename Point3,
0096 typename SideStrategy
0097 >
0098 inline bool is_spike_or_equal(Point1 const& a,
0099 Point2 const& b,
0100 Point3 const& c,
0101 SideStrategy const& strategy)
0102 {
0103 return point_is_spike_or_equal(c, a, b, strategy);
0104 }
0105
0106
0107 }
0108 #endif
0109
0110 }}
0111
0112
0113 #endif