C++ 如何确定(x,y)点是否位于由边界点列表定义的多边形内

C++ 如何确定(x,y)点是否位于由边界点列表定义的多边形内,c++,boost,geometry,computational-geometry,boost-geometry,C++,Boost,Geometry,Computational Geometry,Boost Geometry,我有一个很大的点列表,这些点定义了一些(不一定是凸的)形状的边界。然后我有一些查询点(x,y),我想确定(x,y)是否在我的点边界定义的区域内 所以,这个问题很简单。如何确定查询点是否位于边界点形成的形状内?有没有一个很好的助推模块?我正在查看boost::geometry,但还没有找到任何东西。似乎您正在中查找,不是吗 他们在页面上给出的示例实际上是多边形中的点: #include <iostream> #include <list> #include <bo

我有一个很大的点列表,这些点定义了一些(不一定是凸的)形状的边界。然后我有一些查询点
(x,y)
,我想确定
(x,y)
是否在我的点边界定义的区域内


所以,这个问题很简单。如何确定查询点是否位于边界点形成的形状内?有没有一个很好的助推模块?我正在查看
boost::geometry
,但还没有找到任何东西。

似乎您正在
中查找
,不是吗

他们在页面上给出的示例实际上是多边形中的点:

#include <iostream>
#include <list>

#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/polygon.hpp>

#include <boost/geometry/domains/gis/io/wkt/wkt.hpp>


int main()
{
    typedef boost::geometry::model::d2::point_xy<double> point_type;
    typedef boost::geometry::model::polygon<point_type> polygon_type;

    polygon_type poly;
    boost::geometry::read_wkt(
        "POLYGON((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2,3.7 1.6,3.4 2,4.1 3,5.3 2.6,5.4 1.2,4.9 0.8,2.9 0.7,2 1.3)"
            "(4.0 2.0, 4.2 1.4, 4.8 1.9, 4.4 2.2, 4.0 2.0))", poly);

    point_type p(4, 1);

    std::cout << "within: " << (boost::geometry::within(p, poly) ? "yes" : "no") << std::endl;

    return 0;
}
#包括
#包括
#包括
#包括
#包括
#包括
int main()
{
typedef boost::geometry::model::d2::point\u xy point\u type;
typedef boost::geometry::model::polygon_type;
多边形_型多边形;
boost::geometry::read_wkt(
“多边形((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2,3.7 1.6,3.4 2,4.1 3,5.3 2.6,5.4 1.2,4.9 0.8,2.9 0.7,2 1.3)”
“(4.02.0、4.21.4、4.81.9、4.42.2、4.02.0)),保利);
点_型p(4,1);

std::cout强制性维基百科链接:对于Boost.几何体,具体来说,您想要或。矩形是否有专门化?多边形可能/可能没有额外的假设,哪些矩形将是自由的。。