1 // Boost.Geometry (aka GGL, Generic Geometry Library)
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.
7 // This file was modified by Oracle on 2013-2017.
8 // Modifications copyright (c) 2013-2017, Oracle and/or its affiliates.
10 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
11 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
13 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
14 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
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)
20 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_INTERSECTS_INTERFACE_HPP
21 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_INTERSECTS_INTERFACE_HPP
24 #include <boost/geometry/geometries/concepts/check.hpp>
26 #include <boost/geometry/algorithms/detail/disjoint/interface.hpp>
29 namespace boost { namespace geometry
32 #ifndef DOXYGEN_NO_DETAIL
33 namespace detail { namespace intersects
36 // Forward declaration
37 template <typename Geometry>
38 struct self_intersects;
40 }} // namespace detail::intersects
41 #endif // DOXYGEN_NO_DETAIL
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)
49 \tparam Geometry \tparam_geometry
50 \param geometry \param_geometry
51 \return \return_check{is self-intersecting}
53 \qbk{distinguish,one geometry}
54 \qbk{[def __one_parameter__]}
55 \qbk{[include reference/algorithms/intersects.qbk]}
57 template <typename Geometry>
58 inline bool intersects(Geometry const& geometry)
60 return detail::intersects::self_intersects<Geometry>::apply(geometry);
65 \brief \brief_check2{have at least one intersection}
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}
75 \qbk{distinguish,with strategy}
76 \qbk{[include reference/algorithms/intersects.qbk]}
78 template <typename Geometry1, typename Geometry2, typename Strategy>
79 inline bool intersects(Geometry1 const& geometry1,
80 Geometry2 const& geometry2,
81 Strategy const& strategy)
83 concepts::check<Geometry1 const>();
84 concepts::check<Geometry2 const>();
86 return ! geometry::disjoint(geometry1, geometry2, strategy);
91 \brief \brief_check2{have at least one intersection}
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}
99 \qbk{distinguish,two geometries}
100 \qbk{[include reference/algorithms/intersects.qbk]}
102 template <typename Geometry1, typename Geometry2>
103 inline bool intersects(Geometry1 const& geometry1, Geometry2 const& geometry2)
105 concepts::check<Geometry1 const>();
106 concepts::check<Geometry2 const>();
108 return ! geometry::disjoint(geometry1, geometry2);
113 }} // namespace boost::geometry
115 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_INTERSECTS_INTERFACE_HPP