how create and clear

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

how create and clear

xoru
I have 2 polygons. outer and hole inside outer.
 
Polygon_2 outer ;
 
outer.push_back( Point(-1,-1) ) ;
outer.push_back( Point(0,-12) ) ;
outer.push_back( Point(1,-1) ) ;
outer.push_back( Point(12,0) ) ;
outer.push_back( Point(1,1) ) ;
outer.push_back( Point(0,12) ) ;
outer.push_back( Point(-1,1) ) ;
outer.push_back( Point(-12,0) ) ;
 
Polygon_2 hole ;
 
hole.push_back( Point(-1,0) ) ;
hole.push_back( Point(0,1 ) ) ;
hole.push_back( Point(1,0 ) ) ;
hole.push_back( Point(0,-1) ) ;
 
 
Polygon_with_holes poly( outer ) ;
 
poly.add_hole( hole ) ;
 
======
 
1. How I can create poly variable without initialization.
 Polygon_with_holes poly;
and how add outer to poly?
is any poly.add_outer function?
 
2. How I can clear all point from poly. all outer and all holes?
poly.clear() or similar?
Reply | Threaded
Open this post in threaded view
|

Re: how create and clear

Efi Fogel
On 5 January 2018 at 00:54, xoru <[hidden email]> wrote:
I have 2 polygons. outer and hole inside outer.
 
Polygon_2 outer ;
 
outer.push_back( Point(-1,-1) ) ;
outer.push_back( Point(0,-12) ) ;
outer.push_back( Point(1,-1) ) ;
outer.push_back( Point(12,0) ) ;
outer.push_back( Point(1,1) ) ;
outer.push_back( Point(0,12) ) ;
outer.push_back( Point(-1,1) ) ;
outer.push_back( Point(-12,0) ) ;
 
Polygon_2 hole ;
 
hole.push_back( Point(-1,0) ) ;
hole.push_back( Point(0,1 ) ) ;
hole.push_back( Point(1,0 ) ) ;
hole.push_back( Point(0,-1) ) ;
 
 
Polygon_with_holes poly( outer ) ;
 
poly.add_hole( hole ) ;
 
======
 
1. How I can create poly variable without initialization.
 Polygon_with_holes poly;

You cannot

and how add outer to poly?
is any poly.add_outer function?

Briefly looking at it, I think these functions can and should be added.
Until we do it, you have 2 options:
1. Construct a new polygon with holes when you need to add an outer boundary.
2. Introduce a new template that has these missing functions and refer to this new template of yours in Gps_segment_traits_2.h (you can simply replace the included file Polygon_with_holes_2.h with your newly introduced file.)
 
2. How I can clear all point from poly. all outer and all holes?
poly.clear() or similar?

Yes

Reply | Threaded
Open this post in threaded view
|

Re: how create and clear

xoru
In reply to this post by xoru
>Polygon_with_holes poly( outer ) ;
 
>1. How I can create poly variable without initialization.
> Polygon_with_holes poly;
 
>You cannot
 
I can use this: Polygon_with_holes poly( outer ) ;
It working. But how add_outer?
 
Can You help me? I'm beginer. I'dont know how seperately create object and add polygon to this object.
 
 
and how add outer to poly?
is any poly.add_outer function?
 
Briefly looking at it, I think these functions can and should be added.
Until we do it, you have 2 options:
1. Construct a new polygon with holes when you need to add an outer boundary.
2. Introduce a new template that has these missing functions and refer to this new template of yours in Gps_segment_traits_2.h (you can simply replace the included file Polygon_with_holes_2.h with your newly introduced file.)
 
 
Any code/ example?
 
 
2. How I can clear all point from poly. all outer and all holes?
poly.clear() or similar?
 
Yes
How? any code example?