How to create a boost geometry polygon using std::vector? For example
typedef double coordinate_type;
typedef boost::geometry::model::d2::point_xy<coordinate_type> point;
typedef boost::geometry::model::polygon<point> polygon;
boost::geometry::model::linestring<point> test_data;
boost::geometry::read_wkt("LINESTRING(1 2, 3 4)", test_data);
The above works well. Let us assume that I have polygon points in two vectors as follows:
std::vector<double> x;
std::vector<double> y;
x.push_back(1);
x.push_back(3);
y.push_back(2);
y.push_back(4);
How can I create the data
boost::geometry::read_wkt("LINESTRING(1 2, 3 4)", test_data);
Similarly, if I have an intersect points, for example:
std::deque<polygon> output;
boost::geometry::intersection(test1, test2, output);
BOOST_FOREACH(polygon const& p, output)
{
std::cout << boost::geometry::wkt(p) << std::endl;
}
How can I get the data from 'p' into the vectors x,y?
I will appreciate the help and guidance. Thanks.