Boost logo

Geometry :

Subject: Re: [geometry] Split Polygon
From: Barend Gehrels (barend_at_[hidden])
Date: 2013-08-19 16:43:52


On 19-8-2013 20:14, Alessandro Ranellucci wrote:
> Hunk <heiko.hoennige_at_[hidden]> wrote:
>> i want to split the Polygon ABCDEF with a line. (origin and direction
>> vector)
>> For that i have to calculate the Line Polygon interesection. That i get the
>> points G and H
>> after that i have to extract the two Polygons GEFAH and HBCDG
> I would compute the axis-aligned bounding box of the original polygon, and then clip it using your cutting line.
> For example, I'd make a polygon with the following coordinates:
> [minX,minY], [Hx,minY], [Hx,Hy], [Gx,Gy], [Gx, maxY], [minX,maxY]
> Therefore, your left polygon is the intersection of the original one with this one, and the right one is the difference.

This has been discussed earlier. Using polygon-line intersection will
give you lines as output, not polygons. So you can so a similar thing
but build up two polygons for left/right, and intersect the original
with these both.

See and other messages
in this thread.

Regards, Barend

Geometry list run by mateusz at