Boost logo

Geometry :

Subject: Re: [geometry] problem with wkt io
From: lepere renaud (lepere.renaud_at_[hidden])
Date: 2013-10-09 15:29:54


>> typedef model::point< double, 2, boost::geometry::cs::cartesian > Point;
>> typedef model::polygon< Point, false, false > Polygon;
>
> You specify non-closed polygon....

Yes because i use this convention elsewhere.
>
>> int main()
>> {
>> Polygon p;
>> read_wkt("POLYGON((0.0 0.0, 10.0 0.0, 10.0 10.0, 0 10.0, 0.0 0.0))", p);
>> // p is invalid according to the definition above
>> // (do not repeat last point)
>> correct(p);
>
> and, correct will make it correct according to the type specification above,
> As you mean non-closed polygon, the redundant point is removed.

Yes correct(p) leads me to a valid state, but i was expected read_wkt to
return me a valid polygon according to my model. There is no problem
with correct (exept perhaps in the documentation but here the function
does the "correcting" job well).

On the other side i would expect that wkt(p) will return a valid wkt
polygon but the function seems to make no special traitement for the
last point;

Thanks and best regards,

Renaud


Geometry list run by mateusz at loskot.net