/usr/include/boost/geometry/algorithms/detail/relate
Edit: /usr/include/boost/geometry/algorithms/detail/relate/point_geometry.hpp (7008B)
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2013, 2014, 2015, 2017, 2018.
// Modifications copyright (c) 2013-2018 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_RELATE_POINT_GEOMETRY_HPP
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_RELATE_POINT_GEOMETRY_HPP
#include
//#include
//#include
#include
#include
#include
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace relate {
// non-point geometry
template
struct point_geometry
{
// TODO: interrupt only if the topology check is complex
static const bool interruption_enabled = true;
template
static inline void apply(Point const& point, Geometry const& geometry, Result & result, Strategy const& strategy)
{
int pig = detail::within::point_in_geometry(point, geometry, strategy);
if ( pig > 0 ) // within
{
relate::set(result);
}
else if ( pig == 0 )
{
relate::set(result);
}
else // pig < 0 - not within
{
relate::set(result);
}
relate::set::value, Transpose>(result);
if ( BOOST_GEOMETRY_CONDITION(result.interrupt) )
return;
typedef detail::relate::topology_check
<
Geometry,
typename Strategy::equals_point_point_strategy_type
> tc_t;
if ( relate::may_update(result)
|| relate::may_update(result) )
{
// the point is on the boundary
if ( pig == 0 )
{
// NOTE: even for MLs, if there is at least one boundary point,
// somewhere there must be another one
relate::set(result);
relate::set(result);
}
else
{
// check if there is a boundary in Geometry
tc_t tc(geometry);
if ( tc.has_interior() )
relate::set(result);
if ( tc.has_boundary() )
relate::set(result);
}
}
}
};
// transposed result of point_geometry
template
struct geometry_point
{
// TODO: interrupt only if the topology check is complex
static const bool interruption_enabled = true;
template
static inline void apply(Geometry const& geometry, Point const& point, Result & result, Strategy const& strategy)
{
point_geometry::apply(point, geometry, result, strategy);
}
};
// TODO: rewrite the folowing:
//// NOTE: Those tests should be consistent with within(Point, Box) and covered_by(Point, Box)
//// There is no EPS used in those functions, values are compared using < or <=
//// so comparing MIN and MAX in the same way should be fine
//
//template ::value>
//struct box_has_interior
//{
// static inline bool apply(Box const& box)
// {
// return geometry::get(box) < geometry::get(box)
// && box_has_interior::apply(box);
// }
//};
//
//template
//struct box_has_interior
//{
// static inline bool apply(Box const&) { return true; }
//};
//
//// NOTE: especially important here (see the NOTE above).
//
//template ::value>
//struct box_has_equal_min_max
//{
// static inline bool apply(Box const& box)
// {
// return geometry::get(box) == geometry::get(box)
// && box_has_equal_min_max::apply(box);
// }
//};
//
//template
//struct box_has_equal_min_max
//{
// static inline bool apply(Box const&) { return true; }
//};
//
//template
//struct point_box
//{
// static inline result apply(Point const& point, Box const& box)
// {
// result res;
//
// if ( geometry::within(point, box) ) // this also means that the box has interior
// {
// return result("0FFFFFTTT");
// }
// else if ( geometry::covered_by(point, box) ) // point is on the boundary
// {
// //if ( box_has_interior::apply(box) )
// //{
// // return result("F0FFFFTTT");
// //}
// //else if ( box_has_equal_min_max::apply(box) ) // no boundary outside point
// //{
// // return result("F0FFFFFFT");
// //}
// //else // no interior outside point
// //{
// // return result("F0FFFFFTT");
// //}
// return result("F0FFFF**T");
// }
// else
// {
// /*if ( box_has_interior::apply(box) )
// {
// return result("FF0FFFTTT");
// }
// else
// {
// return result("FF0FFFFTT");
// }*/
// return result("FF0FFF*TT");
// }
//
// return res;
// }
//};
//
//template
//struct box_point
//{
// static inline result apply(Box const& box, Point const& point)
// {
// if ( geometry::within(point, box) )
// return result("0FTFFTFFT");
// else if ( geometry::covered_by(point, box) )
// return result("FF*0F*FFT");
// else
// return result("FF*FFT0FT");
// }
//};
}} // namespace detail::relate
#endif // DOXYGEN_NO_DETAIL
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_RELATE_POINT_GEOMETRY_HPP