使用boost :: geometry的多边形法线向量

时间:2014-06-12 12:28:26

标签: c++ polygon intersection normals boost-geometry

我正在尝试使用boost :: geometry,并且想知道你是否知道在多边形和线段之间的交叉处获得多边形的法线向量的有效方法。 或者类似于它相交的线段的segment_id?如果我有包含交集的多边形的线段,我知道如何得到法线。 到目前为止我已经

#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/io/wkt/wkt.hpp>
#include <boost/geometry/multi/geometries/multi_polygon.hpp>
#include <boost/assign.hpp>


int main(){


typedef model::d2::point_xy<double> point;
typedef model::ring< point > ring;
typedef model::polygon< point > polygon;
typedef model::multi_polygon< polygon > polygons;
typedef model::box< point > box;
typedef boost::geometry::model::segment<point> Segment

//Polygon
std::string poly_file="poly.dat";
polygon poly;
read_wkt(poly_file, poly);
correct(poly);

//Line segment:
polygon lineSegment;    
point p0(0,-0.5);
point p1(1,0.5);
append(lineSegment, p0);
append(lineSegment, p1);

//Getting intersection:
std::vector<point> output;
intersection(poly, lineSegment, output);

//Getting normal vector at this intersection point
// ???





   return 0;
}

提前多多感谢!

0 个答案:

没有答案