2016-04-28 10 views
1

いくつかのセグメントとボックスの交点を計算したいと思います。残念ながら、私はブーストライブラリでそのような機能を発見していません。だから私は現在、すべてがrtreeに含まれているボックスを交差返す参照ブーストライブラリを使用して交点を見つける

using boost::geometry; 
using Point = model::point<double, 3, cs::cartesian>; 
using Box = model::box<Point>; 
using Line = model::segment<Point>; 

index::rtree<Box, index::quadratic<16>> rtree; 

... 

//EDIT 
std::vector<std::vector<Point>> getIntersection(Line line){ 
    std::vector<Box> boxes; 

    rtree.query(index::intersects(line), std::back_inserter(boxes)); 

    std::vector<std::vector<Point>> result; 
    for(const auto&box: boxes){ 
     std::vector<Point> points; 
     intersection(line, box, points); // can't compile 
     result.push_back(points); 
    } 

    return result; 
} 

: 私はこのような何かを持っています。 交差検出は正常に機能しますが、どこにあるかも知る必要があります。 悲しいことに、ポイントのベクトルを使用することはできません。 誰かがこのポイントを取得する方法を知っていますか?

EDIT:

私はintersection機能を追加しました。私は直感的に良い引数を渡しますが、コンパイルされません。与えられたエラー関数によれば、そのような型には実装されていないので、解決策がないように見えます。

答えて

0

私はあなたがさらにあなたの収集ボックスを使用し、機能との交点を見つけることができると思う:

template<typename Geometry1, typename Geometry2, typename GeometryOut> 
bool intersection(Geometry1 const & geometry1, 
        Geometry2 const & geometry2, 
        GeometryOut & geometry_out) 

Boost documentation

の例を参照してください。
関連する問題