|
Geometry : |
Subject: [ggl] Trying a simple linestring-linear_ring intersection
From: Elvis Stansvik (elvstone)
Date: 2010-02-23 12:53:26
Hello all again,
I'm trying out Boost.Geometry for the first time and I'm doing some
experimentation. What am I doing wrong here when I try to intersect a
simple linear_ring with a linestring?
#include <iostream>
#include <string>
#include <boost/geometry/geometry.hpp>
#include <boost/geometry/geometries/cartesian2d.hpp>
using namespace boost::geometry;
int main (void)
{
/* A linear ring. */
linear_ring<point_2d> t;
t.push_back(make<point_2d>(10.0, 20.0));
t.push_back(make<point_2d>(20.0, 0.0));
t.push_back(make<point_2d>(0.0, 0.0));
t.push_back(make<point_2d>(10.0, 20.0));
correct(t);
/* A line string. */
linestring_2d s;
s.push_back(make<point_2d>(0.0, 10.0));
s.push_back(make<point_2d>(20.0, 10.0));
/* Clip the linear ring with the linestring. */
std::vector<linestring_2d> r;
intersection_inserter<linestring_2d>(t, s, std::back_inserter(r));
std::cout << "Clipped linestring(s):" << std::endl;
for (std::vector<linestring_2d>::const_iterator it = r.begin(); it
!= r.end(); it++) {
std::cout << dsv(*it) << std::endl;
}
return 0;
}
The error I'm getting is:
test.cpp:26: instantiated from here
boost-geometry/boost/geometry/algorithms/within.hpp:336: error:
'apply' is not a member of
'boost::geometry::dispatch::within<boost::geometry::point_tag,
boost::geometry::linestring_tag, boost::geometry::point_xy<double,
boost::geometry::cs::cartesian>,
boost::geometry::linestring<boost::geometry::point_xy<double,
boost::geometry::cs::cartesian>, std::vector, std::allocator>,
boost::geometry::strategy::within::winding<boost::geometry::point_xy<double,
boost::geometry::cs::cartesian>, boost::geometry::point_xy<double,
boost::geometry::cs::cartesian>, void> >'
make: *** [test.o] Error 1
I'm sure it's something simple I'm missing, but I can't figure out what.
Regards,
Elvis
Geometry list run by mateusz at loskot.net