]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/geometry/algorithms/detail/intersects/interface.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / geometry / algorithms / detail / intersects / interface.hpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2
3 // Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands.
4 // Copyright (c) 2008-2014 Bruno Lalande, Paris, France.
5 // Copyright (c) 2009-2014 Mateusz Loskot, London, UK.
6
7 // This file was modified by Oracle on 2013-2017.
8 // Modifications copyright (c) 2013-2017, Oracle and/or its affiliates.
9
10 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
11 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
12
13 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
14 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
15
16 // Use, modification and distribution is subject to the Boost Software License,
17 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
18 // http://www.boost.org/LICENSE_1_0.txt)
19
20 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_INTERSECTS_INTERFACE_HPP
21 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_INTERSECTS_INTERFACE_HPP
22
23
24 #include <boost/geometry/geometries/concepts/check.hpp>
25
26 #include <boost/geometry/algorithms/detail/disjoint/interface.hpp>
27
28
29 namespace boost { namespace geometry
30 {
31
32 #ifndef DOXYGEN_NO_DETAIL
33 namespace detail { namespace intersects
34 {
35
36 // Forward declaration
37 template <typename Geometry>
38 struct self_intersects;
39
40 }} // namespace detail::intersects
41 #endif // DOXYGEN_NO_DETAIL
42
43
44 /*!
45 \brief \brief_check{has at least one intersection (crossing or self-tangency)}
46 \note This function can be called for one geometry (self-intersection) and
47 also for two geometries (intersection)
48 \ingroup intersects
49 \tparam Geometry \tparam_geometry
50 \param geometry \param_geometry
51 \return \return_check{is self-intersecting}
52
53 \qbk{distinguish,one geometry}
54 \qbk{[def __one_parameter__]}
55 \qbk{[include reference/algorithms/intersects.qbk]}
56 */
57 template <typename Geometry>
58 inline bool intersects(Geometry const& geometry)
59 {
60 return detail::intersects::self_intersects<Geometry>::apply(geometry);
61 }
62
63
64 /*!
65 \brief \brief_check2{have at least one intersection}
66 \ingroup intersects
67 \tparam Geometry1 \tparam_geometry
68 \tparam Geometry2 \tparam_geometry
69 \tparam Strategy \tparam_strategy{Intersects}
70 \param geometry1 \param_geometry
71 \param geometry2 \param_geometry
72 \param strategy \param_strategy{intersects}
73 \return \return_check2{intersect each other}
74
75 \qbk{distinguish,with strategy}
76 \qbk{[include reference/algorithms/intersects.qbk]}
77 */
78 template <typename Geometry1, typename Geometry2, typename Strategy>
79 inline bool intersects(Geometry1 const& geometry1,
80 Geometry2 const& geometry2,
81 Strategy const& strategy)
82 {
83 concepts::check<Geometry1 const>();
84 concepts::check<Geometry2 const>();
85
86 return ! geometry::disjoint(geometry1, geometry2, strategy);
87 }
88
89
90 /*!
91 \brief \brief_check2{have at least one intersection}
92 \ingroup intersects
93 \tparam Geometry1 \tparam_geometry
94 \tparam Geometry2 \tparam_geometry
95 \param geometry1 \param_geometry
96 \param geometry2 \param_geometry
97 \return \return_check2{intersect each other}
98
99 \qbk{distinguish,two geometries}
100 \qbk{[include reference/algorithms/intersects.qbk]}
101 */
102 template <typename Geometry1, typename Geometry2>
103 inline bool intersects(Geometry1 const& geometry1, Geometry2 const& geometry2)
104 {
105 concepts::check<Geometry1 const>();
106 concepts::check<Geometry2 const>();
107
108 return ! geometry::disjoint(geometry1, geometry2);
109 }
110
111
112
113 }} // namespace boost::geometry
114
115 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_INTERSECTS_INTERFACE_HPP