Boost logo

Geometry :

Subject: Re: [geometry] access to poligon point list
From: nicola81 (nicola_cavallini_at_[hidden])
Date: 2012-05-19 11:16:10

In the example below what I actually
meant, that I could achieve thanks to your suggestion.
I would call solved this point.

Now I need to move to the next phase,
which is intersecting two sets of polygons.

I bumped into this discussion and I
find it extremely interesting.

Really think this is going to work
great for me.

>Could you point which examples from
the geometry library website
>do not compile for you?

I tried compiling them with g++ and I
could get clearer error messages, I was missing some include.

Getting the code from the trunk means
getting an svn directory and update/compile/install new

Thanks a lot for your help!

#include <iostream>
#include <deque>

#include <boost/geometry.hpp>

#include <boost/foreach.hpp>




int main()
using boost::geometry::get;
> polygon;

polygon green, blue;

"POLYGON((0 0,0 1.75,1.75
0,0 0))", green);

"POLYGON((.5 .5, .5 1, 1
1, 1 .5, .5 .5))", blue);

std::deque<polygon> output;
boost::geometry::intersection(green, blue, output);

polygon red;

red = output[0];

// ring is a vector

boost::geometry::model::d2::point_xy<double> point;

std::vector<point> const&
points = red.outer();

std::vector<double> Px;
std::vector<double> Py;

for (std::vector<point>::size_type
i = 0; i < points.size(); ++i)

std::cout << "Size Px =
"<< Px.size() << std::endl;
std::cout << "Size Py =
"<< Py.size() << std::endl;

for (int i = 0; i < Px.size();
std::cout<< "Px["
<< i << "] = " << Px[i] << ",
Py[" << i << "] = "<< Py[i] <<

return 0;

 Da: Mateusz Loskot [via Boost Geometry] <ml-node+s203548n4000004h50_at_[hidden]>
A: nicola81 <nicola_cavallini_at_[hidden]>
Inviato: Venerdì 18 Maggio 2012 1:41
Oggetto: Re: access to poligon point list

On 17 May 2012 19:23, nicola81 <[hidden email]> wrote:
> I would like to get the polygon points in a standard vector, or into some
> other (simple :( ) structure I can access to.

Based on your example, is this what you look for?

polygon red;
red = output[0];

// ring is a vector
std::vector<point> const& points = red.outer();
for (std::vector<point>::size_type i = 0; i < points.size(); ++i)

> I've spent several days trying to get something out of Google, but I
> couldn't get anything useful. I cannot compile most of the code examples on
> stackoverflow or on the geometry library website.

Could you point which examples from the geometry library website
do not compile for you?

> I run the last Intel compiler 12.something, and boost 1.49.

I'd encourage you to try the geometry library for Boost trunk.

> The example I was working on is attached, and is actually from the boost
> website. My guess was trying to get a couple of standard vectors (Px, Py)
> out object function “list_coordinates”.

I have to admit, it is not clear to me what you mean as "get a couple of
standard vectors". But, try my example above and see if this is
what you are looking for.

Best regards,

Mateusz Loskot,
Geometry mailing list 
[hidden email]
Mateusz Loskot
If you reply to this email, your message will be added to the discussion below: 
To unsubscribe from access to poligon point list, click here.
View this message in context:
Sent from the Boost Geometry mailing list archive at

Geometry list run by mateusz at