2017-01-03 32 views
1

私はboost:: boost::geometry::index::rtreeboost::geometry::index::nearestクエリを使用して3次元空間内の別のセグメントから最も近いセグメントを計算しようとしていますが、私は、次のコンパイルエラーを取得:ブースト::幾何学::距離3Dプリミティブでコンパイルエラーを

をそれはしかし、これはサポートされなければならない私が使用しているブーストのバージョン(1.60)の文書によると

typedef boost::geometry::model::point <float, 3, boost::geometry::cs::cartesian> point; 
typedef boost::geometry::model::segment <point> segment; 

point pa = point(x1, y1, z1); 
point pc = point(x2, y2, z2); 
point pb = point(x3, y3, z3); 

float dist = boost::geometry::distance(segment(pa, pb), segment(pa, pc)); 

error C2664: 'boost::mpl::assertion_failed' : cannot convert parameter 1 from 'boost::mpl::failed ************(__cdecl boost::geometry::nyi::not_implemented_error::THIS_OPERATION_IS_NOT_OR_NOT_YET_IMPLEMENTED::* ***********)(boost::mpl::assert_::types)' to 'boost::mpl::assert::type'

私はちょうどboost::geometry::distance機能を使用して同じ問題を絞り込むために管理していますワーksは2つのディメンションを使用しても問題ありません。

http://www.boost.org/doc/libs/1_60_0/libs/geometry/doc/html/geometry/reference/algorithms/distance/distance_2.html#geometry.reference.algorithms.distance.distance_2.supported_geometries

私は、機能を拡張する方法についてまたはそれがすべての可能なのかどうかのいずれかのドキュメントで何かを見つけることができませんでした。

ありがとうございます。

答えて

0

ブースト開発の@awulkiewでいくつかのメッセージを交換した後、現在の回避策をthis ticketに見ることができます。この時点で

がN次元のセグメントのためのいくつかの内部機能のための実装ません:

Yes, it seems that disjoint/intersects is not yet implemented for N-dimensional segments. And distance() calls this algorithm.

As a workaround you could store bounding boxes of segments in the R-tree, then search for Boxes nearest to some query Box using iterative query, in each iteration check the actual distance between segments using your own implementation and stop if your k-th found segment is closer than the distance between the bounding box passed into the query and the bounding box found in the current iteration. So basically use the index how you'd use it for any other Geometry.

はまた、内部ブースト機能をオーバーライド関与する別の回避策はありますが、それは将来変更される可能性があり、それらとして落胆されています:

I'd discourage you from hooking in your own functions in case something changed in the future internally in the rtree (e.g. different functions were used). But if you'd like to try it you could overload bg::comparable_distance(segment, segment) and bg::comparable_distance(segment, box) , e.g. like that:

namespace boost { namespace geometry { 
    template <typename Box> 
    float comparable_distance(segment const& s, Box const& b) { return 0; } 
    float comparable_distance(segment const& s1, segment const& s2) { return 0; } 
}} 

Box would be of type internally used in the R-tree to represent nodes, so bg::model::box<...>.

また、ADDIのためのETAはありませんこの機能のサポートは現時点ではサポートされていません。

No ETA, currently we're adding support for 2d geographic CS.

私の場合、ソリューションは自分の距離関数を実装し、最初の回避策で提案されたようなアルゴリズムを使用することです。

関連する問題