Subject: CGAL users discussion list
List archive
- From:
- To:
- Subject: Re: [cgal-discuss] undoing connect_polygon()
- Date: Thu, 21 May 2009 19:35:46 +0300
Hi Lane,
The connect_holes() functions returns an iterator over the set of points on the outer boundary of a polygon and not a Polygon_2 object. A quick example of why these points do not represent a simple polygon is a PWH with a single hole that was connected to the outer boundary via vertical ray shooting. this causes a new vertex to form on the outer boundary which has a degree greater than 2. I don't think this is the source of random seg faults - if you try to create polygons that are not valid you should get CGAL warnings/assertions. Try to create a more specific example...
Regarding the rest of your questions:
1. currently there is no function that reverses the connect holes. If you intend to implement one, and are willing to send it we may insert it into a future release of CGAL.
2. I'm not sure I understand the question. CGAL::Polygon_2 is a CGAL class of polygons whose edges are linear segments General_Polygon_2 is a class that follows the GeneralPolygon_2 Concept which allows other types of boundary curves.
As I stated above, invalid polygons should not be causing segmentation faults (again, a you're welcome to send a specific example). When constructing a polygon it's validity is not checked. validity of polygons is usually checked in creation of Polygon Sets, and execution of boolean operations. (for instance join/intersect operations as you demonstrated.)
3.Please send me a full copy of the altered .cpp file so I can have a look at it.
Best,
Guy
Quoting "Lane Brooks"
<>:
I am new to CGAL and am using it for boolean piece-wise linear polygon operations.
In the manual there is an example called connect_polygon.cpp that reduces a Polygon_with_holes_2 to a Polygon2. Is it true that after I reduced a polygon that does have holes using this function that it is no longer simple? Could this be the source of the random seg faults I get when using CGAL?
My questions:
- Is there a way to undo the connect polygon to turn a Polygon2 into a Polygon2_with holes?
- Can I convert it to a Generalized_polygon2 and avoid the seg fault? I do not yet really understand the difference between Polygons and Generalized_Poligons.
- When I run a slightly altered simple_join_intersect.cpp from the examples, it throws an exception. The same polygon in my application seq faults. What's the difference? Here is the output of simple_join_intersect.cpp
P = [ 59 vertices: (2195/1 6530/1) (2195/1 4730/1) (3805/1 4730/1) (3920/1 4725/1) (4040/1 4700/1) (4155/1 4660/1) (4265/1 4610/1) (4365/1 4535/1) (4455/1 4455/1) (4535/1 4365/1) (4610/1 4265/1) (4660/1 4155/1) (4700/1 4040/1) (4725/1 3920/1) (4730/1 3805/1) (4730/1 2335/1) (4735/1 2290/1) (4745/1 2255/1) (4765/1 2215/1) (4785/1 2185/1) (4815/1 2165/1) (4855/1 2145/1) (4890/1 2135/1) (4935/1 2130/1) (6150/1 2130/1) (6150/1 1270/1) (2195/1 1270/1) (2080/1 1275/1) (1960/1 1300/1) (1845/1 1340/1) (1735/1 1390/1) (1635/1 1465/1) (1545/1 1545/1) (1465/1 1635/1) (1390/1 1735/1) (1340/1 1845/1) (1300/1 1960/1) (1275/1 2080/1) (1270/1 2195/1) (1270/1 3805/1) (1275/1 3920/1) (1300/1 4040/1) (1340/1 4155/1) (1390/1 4265/1) (1465/1 4365/1) (1545/1 4455/1) (1635/1 4535/1) (1735/1 4610/1) (1845/1 4660/1) (1960/1 4700/1) (2080/1 4725/1) (2195/1 4730/1) (2195/1 6530/1) (210/1 6530/1) (210/1 -530/1) (5240/1 -530/1) (5240/1 -1845/1) (6860/1 -1845/1) (6860/1 6530/1) ]
Is_simple 0
Q = [ 5 vertices: (0/1 2/1) (3/2 1/2) (5/2 3/2) (7/2 1/2) (5/1 2/1) ]
CGAL warning: check violation!
Expr: is_strictly_simple
File: /usr/include/CGAL/Boolean_set_operations_2/Gps_polygon_validation.h
Line: 166
Explanation:The polygon is not strictly simple.
CGAL error: precondition violation!
Expr: m_traits->is_valid_2_object()(pgn)
File: /usr/include/CGAL/General_polygon_set_2.h
Line: 200
Explanation:
terminate called after throwing an instance of 'CGAL::Precondition_exception'
what(): CGAL ERROR: precondition violation!
Expr: m_traits->is_valid_2_object()(pgn)
File: /usr/include/CGAL/General_polygon_set_2.h
Line: 200
Aborted
Thanks for this great application.
Lane
--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://lists-sop.inria.fr/wws/info/cgal-discuss
- [cgal-discuss] undoing connect_polygon(), Lane Brooks, 05/21/2009
- Re: [cgal-discuss] undoing connect_polygon(), guyzucke, 05/21/2009
Archive powered by MHonArc 2.6.16.