Boost logo

Geometry :

Subject: [ggl] Polygon DP simplification
From: V D (zedxz2)
Date: 2011-09-30 14:25:33


Hi,

I'm trying to supply my own strategy to work around the problem for now.
Using the same code as before, except now I'm trying:

27 typedef boost::geometry::strategy::distance::pythagoras<point_xy, point_xy, double> dist_strat;
28 typedef boost::geometry::strategy::simplify::douglas_peucker<point_xy, dist_strat > simp_strat;
  
30 simp_strat my_simplify_strat_test;
31 boost::geometry::simplify(original_1, simplified_1, 1.0 / 2048.0, my_simplify_strat_test);

But I cannot get the strategy to compile, I get a pretty nasty compile error :

instantiated from ?void boost::geometry::simplify(const Geometry&, Geometry&, const Distance&, const Strategy&) [with Geometry = main()::multi_polygon, Distance = double, Strategy = main()::simp_strat]?
simp_test.cpp:31: instantiated from here
/opt/local/include/boost/geometry/strategies/concepts/distance_concept.hpp:232: error: no type named ?type? in ?struct boost::geometry::strategy::distance::services::strategy_point_point<boost::geometry::strategy::distance::comparable::pythagoras<boost::geometry::model::d2::point_xy<double, boost::geometry::cs::cartesian>, boost::geometry::model::d2::point_xy<double, boost::geometry::cs::cartesian>, double> >?
/opt/local/include/boost/geometry/strategies/concepts/distance_concept.hpp:233: error: no type named ?type? in ?struct boost::geometry::strategy::distance::services::strategy_point_point<boost::geometry::strategy::distance::comparable::pythagoras<boost::geometry::model::d2::point_xy<double, boost::geometry::cs::cartesian>, boost::geometry::model::d2::point_xy<double, boost::geometry::cs::cartesian>, double> >?
/opt/local/include/boost/geometry/strategies/concepts/distance_concept.hpp:244: error: no matching function for call to ?boost::geometry::strategy::distance::comparable::pythagoras<boost::geometry::model::d2::point_xy<double, boost::geometry::cs::cartesian>, boost::geometry::model::d2::point_xy<double, boost::geometry::cs::cartesian>, double>::apply(const boost::geometry::model::d2::point_xy<double, boost::geometry::cs::cartesian>&, const boost::geometry::model::d2::point_xy<double, boost::geometry::cs::cartesian>&, const boost::geometry::model::d2::point_xy<double, boost::geometry::cs::cartesian>&)?
/opt/local/include/boost/geometry/strategies/cartesian/distance_pythagoras.hpp:92: note: candidates are: static typename boost::geometry::select_calculation_type<S1, S2, CalculationType>::type boost::geometry::strategy::distance::comparable::pythagoras<Point1, Point2, CalculationType>::apply(const Point1&, const Point2&) [with Point1 = boost::geometry::model::d2::point_xy<double, boost::geometry::cs::cartesian>, Point2 = boost::geometry::model::d2::point_xy<double, boost::geometry::cs::cartesian>, CalculationType = double]

The dist_strat type works fine, for example:
   
   point_xy p1(0.0, 0.0)
   point_xy p2(5.0, 0.0)

   dist_strat my_dist_strat;
   boost::geometry(p1,p2, my_dist_strat);

But I can't seem to supply it to my deuglas peucker strategy ?

-v

On Sep 30, 2011, at 6:04 AM, Mateusz Loskot wrote:

> On 30/09/11 03:47, V D wrote:
>> Hum, if the problem is with the pythagoras distance, why is the
>> following snippet returning the expected value, 5.0.
>> Given the current error in the source, shouldn't it return 25 ?
>>
>> #include <boost/geometry.hpp>
>> #include <boost/geometry/strategies/cartesian/distance_pythagoras.hpp>
>> #include <boost/geometry/geometries/point_xy.hpp>
>> #include <iostream>
>>
>> int main()
>> {
>> typedef boost::geometry::model::d2::point_xy<double> point_xy;
>>
>> point_xy p1(0.0, 0.0);
>> point_xy p2(5.0, 0.0);
>>
>> boost::geometry::strategy::distance::pythagoras<point_xy, point_xy,
>> double> my_strategy;
>> std::cout << boost::geometry::distance(p1,p2, my_strategy) << std::endl;
>>
>> return 0;
>> }
>>
>>
>> Is it only in the use of DP simplification that the pythagoras strategy
>> is problematic ?
>
> The difference is in the actual strategies that kick in.
> I explained it in my last comment:
>
> https://svn.boost.org/trac/boost/ticket/5954#comment:3
>
> So, yes, my patch does not fix the problem, but sheds some light where
> is the bug. Though, I'm having problems with finding out why the
> different strategy is generated for simplify, not having enough time to
> dig it now.
>
> p.s. Please, take care to respond to the mailing list too. I added ggl address to my response here.
>
> Best regards,
> -
> Mateusz Loskot, http://mateusz.loskot.net
> Charter Member of OSGeo, http://osgeo.org
> Member of ACCU, http://accu.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/ggl/attachments/20110930/1f630919/attachment.html


Geometry list run by mateusz at loskot.net