Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-11-15 09:10:21

0001 // Boost.Geometry (aka GGL, Generic Geometry Library)
0002 
0003 // Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands.
0004 // Copyright (c) 2008-2014 Bruno Lalande, Paris, France.
0005 // Copyright (c) 2009-2014 Mateusz Loskot, London, UK.
0006 
0007 // This file was modified by Oracle on 2013-2017.
0008 // Modifications copyright (c) 2013-2017, Oracle and/or its affiliates.
0009 
0010 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
0011 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
0012 
0013 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
0014 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
0015 
0016 // Use, modification and distribution is subject to the Boost Software License,
0017 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0018 // http://www.boost.org/LICENSE_1_0.txt)
0019 
0020 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_INTERSECTS_INTERFACE_HPP
0021 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_INTERSECTS_INTERFACE_HPP
0022 
0023 
0024 #include <boost/geometry/geometries/concepts/check.hpp>
0025 
0026 #include <boost/geometry/algorithms/detail/disjoint/interface.hpp>
0027 
0028 
0029 namespace boost { namespace geometry
0030 {
0031 
0032 #ifndef DOXYGEN_NO_DETAIL
0033 namespace detail { namespace intersects
0034 {
0035 
0036 // Forward declaration
0037 template <typename Geometry>
0038 struct self_intersects;
0039 
0040 }} // namespace detail::intersects
0041 #endif // DOXYGEN_NO_DETAIL
0042 
0043 
0044 /*!
0045 \brief \brief_check{has at least one intersection (crossing or self-tangency)}
0046 \note This function can be called for one geometry (self-intersection) and
0047     also for two geometries (intersection)
0048 \ingroup intersects
0049 \tparam Geometry \tparam_geometry
0050 \param geometry \param_geometry
0051 \return \return_check{is self-intersecting}
0052 
0053 \qbk{distinguish,one geometry}
0054 \qbk{[def __one_parameter__]}
0055 \qbk{[include reference/algorithms/intersects.qbk]}
0056 */
0057 template <typename Geometry>
0058 inline bool intersects(Geometry const& geometry)
0059 {
0060     return detail::intersects::self_intersects<Geometry>::apply(geometry);
0061 }
0062 
0063 
0064 /*!
0065 \brief \brief_check2{have at least one intersection}
0066 \ingroup intersects
0067 \tparam Geometry1 \tparam_geometry
0068 \tparam Geometry2 \tparam_geometry
0069 \tparam Strategy \tparam_strategy{Intersects}
0070 \param geometry1 \param_geometry
0071 \param geometry2 \param_geometry
0072 \param strategy \param_strategy{intersects}
0073 \return \return_check2{intersect each other}
0074 
0075 \qbk{distinguish,with strategy}
0076 \qbk{[include reference/algorithms/intersects.qbk]}
0077  */
0078 template <typename Geometry1, typename Geometry2, typename Strategy>
0079 inline bool intersects(Geometry1 const& geometry1,
0080                        Geometry2 const& geometry2,
0081                        Strategy const& strategy)
0082 {
0083     concepts::check<Geometry1 const>();
0084     concepts::check<Geometry2 const>();
0085 
0086     return ! geometry::disjoint(geometry1, geometry2, strategy);
0087 }
0088 
0089 
0090 /*!
0091 \brief \brief_check2{have at least one intersection}
0092 \ingroup intersects
0093 \tparam Geometry1 \tparam_geometry
0094 \tparam Geometry2 \tparam_geometry
0095 \param geometry1 \param_geometry
0096 \param geometry2 \param_geometry
0097 \return \return_check2{intersect each other}
0098 
0099 \qbk{distinguish,two geometries}
0100 \qbk{[include reference/algorithms/intersects.qbk]}
0101  */
0102 template <typename Geometry1, typename Geometry2>
0103 inline bool intersects(Geometry1 const& geometry1, Geometry2 const& geometry2)
0104 {
0105     concepts::check<Geometry1 const>();
0106     concepts::check<Geometry2 const>();
0107 
0108     return ! geometry::disjoint(geometry1, geometry2);
0109 }
0110 
0111 
0112 
0113 }} // namespace boost::geometry
0114 
0115 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_INTERSECTS_INTERFACE_HPP