Boost logo

Geometry :

Subject: [ggl] Understanding get_turns for linestring/polygon overlay
From: Barend Gehrels (barend)
Date: 2011-04-16 03:02:01

Hi John,

> Barend,
> Thank you for all your help. This technique worked great. I did the following
> 1) User defines the cut line in the iphone interface
> 2) Create the box and buffer it
> 3) I extend the line in both directions to ensure it crosses the box at two points (if it crosses it at just one point, I consider that invalid and don't do anything)
> 4) Get the turn points for the buffered box and the line.
> 5) Extract the two pieces of the buffered square
> 6) Intersect each half with the polygon
> I also am getting more used to Boost::Geometry. It is quite easy to use, as it follows STL and Boost patterns, but I just don't know which algorithms and methods to use and how to find them.
> I found along the way that I had to use std::unique_copy in several places to get rid of duplicates, but it is all working. I haven't checked how fast it is on the real device, but can't imagine that will be a problem (my polygons end up being pretty simple). This was the last semi-major obstacle to really making progress on my game. I will definitely let you know when the game is done (and give you promo codes if you have any iOS devices).

You're welcome, great to hear this, and yes I've an iPad :-)

There is also the boost::geometry::unique algorithm to get rid of
duplicates (which can indeed be formed during the algorithm). It was
planned to have that inside, but it is now still a separate step.

Regards, Barend

Geometry list run by mateusz at