【发布时间】:2014-09-29 12:37:01
【问题描述】:
#include <iostream>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/register/point.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/make_shared.hpp>
using namespace boost::geometry;
class CustomPoint{
public:
double X;
double Y;
};
using cpPtr = boost::shared_ptr<CustomPoint>;
namespace boost { namespace geometry { namespace traits {
BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_TRAITS(cpPtr, 2, double, cs::cartesian)
template<> struct access<cpPtr, 0> {
static inline double get(cpPtr const& p) { return p->X; }
static inline void set(cpPtr& p, double const& value) { p->X = value; }
};
template<> struct access<cpPtr, 1> {
static inline double get(cpPtr const& p) { return p->Y; }
static inline void set(cpPtr& p, double const& value) { p->Y = value; }
};
}}}
int main()
{
std::vector<cpPtr> one,Two;
//init polys
std::vector< std::vector<cpPtr> > output;
boost::geometry::union_(one,two,output)
}
您好,我尝试将 boost::shared_ptr 作为多边形。问题是当我进行联合裁剪时,算法没有分配内存。有谁知道这个的解决方案吗?
【问题讨论】:
标签: c++ boost boost-geometry