Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] General_polygon_set_2<T>::simplify

Subject: CGAL users discussion list

List archive

[cgal-discuss] General_polygon_set_2<T>::simplify


Chronological Thread 
  • From: <>
  • To:
  • Subject: [cgal-discuss] General_polygon_set_2<T>::simplify
  • Date: Wed, 29 Sep 2010 00:03:00 +0200 (CEST)

What exactly does General_polygon_set_2<T>::simplify do? I was hoping it would
make a simply polygon with holes from a non-simple polygon
(self-intersecting).
The method does not appear to be documented.

The dxf_union.cpp example uses this code in the Dxf_bsop_reader class, though,
I don't know if there are actually any instances of non-simple polygons in the
example dxf file provided. Certainly, there are no polygons with holes created
with that example.

Using the Polygon_2:

4 [0 0 --> 0 0.003]
[0 0.003 --> 0.01 -0.01]
[0.01 -0.01 --> 0.01 0]
[0.01 0 --> 0 0]
0

I use the following code to simplify it:

Polygon_set_2 gps;
Polygon_with_holes_2 pwh2;
gps.simplify(poly, pwh2);

The resulting polygon looks like:

6 [0 0 --> 0 0.003]
[0.00230769 0 --> 0 0]
[0.00230769 0 --> 0.01 -0.01]
[0.01 -0.01 --> 0.01 0]
[0.01 0 --> 0.00230769 0]
[0 0.003 --> 0.00230769 0]
0

The edges are no longer end-to-end, and, as a consequence, anything one tries
to use it for results in exceptions.

I'm using the kernel and traits ...

typedef CGAL::Lazy_exact_nt<CGAL::Gmpq> NT;
typedef CGAL::Cartesian<NT> K;
typedef CGAL::Gps_circle_segment_traits_2<K> Traits_2;
typedef CGAL::General_polygon_set_2<Traits_2> Polygon_set_2;
typedef typename Traits_2::Polygon_2 Polygon_2;
typedef typename Traits_2::Polygon_with_holes_2
Polygon_with_holes_2;



Archive powered by MHonArc 2.6.16.

Top of Page