这段代码在2D版本中可以正常工作,但在3D版本中无法编译:
namespace bg = boost::geometry;
typedef bg::model::point<double, 3, bg::cs::cartesian> Point3D;
typedef bg::model::polygon<Point3D> Poly3D;
Poly3D p0, p1;
vector<Poly3D> result;
bg::read_wkt("POLYGON((0 0 0, 0 1 1, 1 0 0, 0 0 0))", p0);
bg::read_wkt("POLYGON((0 0 0.5, 0 11 0.5, 11 0 0.5, 0 0 0.5))", p1);
bg::intersection(p0, p1, result);
使用此模板时出现错误:
1>C:\boost_1_54_0\boost/geometry/core/coordinate_dimension.hpp(89): error C2338: ( boost::mpl::equal_to < geometry::dimension<Geometry>, boost::mpl::int_<Dimensions> >::type::value )
...
有人能告诉我 intersection
调用出了什么问题吗?我的应用程序是为了找到平面多边形的交点。我可以看出,在一般情况下,Poly3D
不一定是平面的,因此它可能是这个错误的来源。是否有一种方法定义平面 3D 多边形类型?