使用boost :: geometry :: distance编译错误

时间:2015-01-09 13:28:54

标签: c++ boost boost-geometry

我正在尝试编译一个使用boost :: geometry :: distance的程序来计算工程项目中两个矩形之间的距离。我收到链接器错误:

  

/usr/include/boost/geometry/algorithms/not_implemented.hpp:64:5:   错误:没有匹配的函数用于调用   “assertion_failed(MPL _ ::失败************   (升压::几何::纽约摄影学院:: not_implemented_error :: THIS_OPERATION_IS_NOT_OR_NOT_YET_IMPLEMENTED :: ************)(MPL _ ::断言_ ::类型))”        BOOST_MPL_ASSERT_MSG

     

/usr/include/boost/geometry/algorithms/distance.hpp:546:55:错误:   'apply'不是会员   “增强::几何::调度::距离

     
    

,boost :: geometry :: model :: polygon     ,boost :: geometry :: strategy :: distance :: pythagoras<&gt ;, boost :: geometry :: polygon_tag,boost :: geometry :: polygon_tag,     boost :: geometry :: strategy_tag_distance_point_point,false>'     :: apply(geometry1,geometry2,strategy);

  

我的幼稚眼睛的问题并不明显。如果有人有任何建议我会非常感激。重要信息:

在f21上从yum提升1.55 gcc 4.9.2

正如您在下面所看到的,我确保正确关闭了增强多边形,并且我也尝试纠正它们,但不幸的是,这并没有解决问题。违规的源代码(矩形是"块"对象):

double Block::measureDistanceBoost(const Block& otherblock)
{
    //Using boost geometry

    int i;

    double result=0.0;

    typedef boost::geometry::model::d2::point_xy<double> boostpoint;
    typedef boost::geometry::model::polygon<boostpoint> boostpoly;

    using boost::geometry::append;
    using boost::geometry::make;
    using boost::geometry::correct;

    boostpoly mypoly;
    boostpoly testpoly;
    std::deque<boostpoly> output; // discarded for now, maybe useful for visualisation later


    //Make a boost polygon out of my block points
    for(i=0; i<4; i++)
    {
        append( mypoly, make<boostpoint>(this->worldPts[i].getx(), this->worldPts[i].gety()) );
    }

    //Boost polygons have to form a complete loop, add the first point again
    append( mypoly, make<boostpoint>(this->worldPts[0].getx(), this->worldPts[0].gety()) );


    //Make a boost polygon out of the test block points
    for(i=0; i<4; i++)
    {
        append( testpoly, make<boostpoint>(otherblock.worldPts[i].getx(), otherblock.worldPts[i].gety()) );
    }

    //Like above, form a complete loop with first point
    append( testpoly, make<boostpoint>(otherblock.worldPts[0].getx(), otherblock.worldPts[0].gety()) );

    correct(testpoly);
    correct(mypoly);

    //Use boost::geometry::distance to measure the distance between the blocks
    //result = 0.0;
    result = boost::geometry::distance(mypoly, testpoly);


    return(result);
}

0 个答案:

没有答案