1
我想计算某个段和框之间的交点。不幸的是我还没有在boost库中找到这样的函数。 我有这样的事情:使用增强库查找交点
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;
}
所以你看我现在返回所有相交包含在rtree
框。 交叉点检测工作正常,但我也需要知道它在哪里。可悲的是我根本不能使用点向量。 那么,有谁知道如何得到这一点?
编辑:
我已经添加intersection
功能。现在虽然我直观地传递了好的参数,但它不能编译。看起来像没有解决方案,因为根据给定的错误函数没有实现这种类型。