 # Geometry :

Subject: Re: [geometry] self intersection doesn't find collinear intersection types
From: sergei benkovich (sergei1503_at_[hidden])
Date: 2016-05-11 08:03:01

thank you very much for the response.
my original polygon example was bad.
but, i tried on this polygon :
Polygon poly { { { 10, 10 }, { 20, 10 }, { 20, 5 }, { 25, 5 }, { 25, 7 },
{ 30, 7 }, { 30, 3 }, { 25, 3 }, { 25, 5 }, { 20, 5 }, { 20, 0 }, { 10, 0
}, { 10, 10 } }};

and all i get is that there are two intersection points, and both are
"touch".
and when i ran on your examples i got 4 collinear.
is it a bug? am i doing something wrong?
much appreciated,
Sergei

wrote:

> Hi Sergei,
>
> Sergei Benkovich wrote:
>
>> Hey,
>> i have an issue where i find self intersections in a polygon.but it
>> doesn't seem to find the method_collinear type.
>>
>> this is the piece of code:
>>
>>
>> namespace bg = boost::geometry;
>> using namespace std;
>> typedef bg::model::d2::point_xy<double> point_2d;
>> typedef bg::model::polygon<boost::geometry::model::d2::point_xy<double>
>> > Polygon;
>> Polygon poly;
>> poly.outer().push_back(point_2d(0, 10));
>> poly.outer().push_back(point_2d(10, 0));
>>
>>
> Have in mind that this polygon is invalid (too small number of points) so
> it may even be ignored (I don't remember).
> But of course if you had a valid polygon like:
>
> Polygon poly{ { {0, 0},{0, 10}, {10, 10}, {10, 0}, {0, 0} } };
>
> There would be no self intersections returned because the polygon is not
> self-intersecting.
> However if you had a (invalid) Polygons like this:
>
> Polygon poly{ { {0, 0},{0, 10}, {10, 10}, {10, 0}, {0, 0},{ 0, 10 },{ 10,
> 10 },{ 10, 0 },{ 0, 0 } } };
> Polygon poly{ { {0, 0},{0, 10}, {10, 10}, {10, 0}, { 10, 10 },{ 0, 10 },{
> 0, 0 } } };
>
> you'd get collinear and blocking self-intersection turns respectively.
>
> Regards,