mirror of https://github.com/CGAL/cgal
should fix examples
This commit is contained in:
parent
02c5bad7cd
commit
d5ab42efea
|
|
@ -226,6 +226,22 @@ public:
|
|||
delete m_traits;
|
||||
}
|
||||
|
||||
void simplify(const Polygon_2& pgn, Polygon_with_holes_2& res)
|
||||
{
|
||||
typedef Gps_polygon_simplifier<Aos_2> Simplifier;
|
||||
|
||||
Aos_2* arr = new Aos_2();
|
||||
|
||||
Simplifier simp(*arr, *m_traits);
|
||||
simp.simplify(pgn);
|
||||
_remove_redundant_edges(arr);
|
||||
Self gps(arr);
|
||||
gps._reset_faces();
|
||||
|
||||
typedef Oneset_iterator<Polygon_with_holes_2> OutputItr;
|
||||
OutputItr oi (res);
|
||||
gps.polygons_with_holes(oi);
|
||||
}
|
||||
|
||||
// insert a simple polygon
|
||||
void insert(const Polygon_2& pgn)
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ class Gps_polygon_simplifier
|
|||
typedef typename Arrangement_2::Halfedge_handle Halfedge_handle;
|
||||
typedef typename Arrangement_2::Halfedge_iterator Halfedge_iterator;
|
||||
typedef typename Arrangement_2::Face_handle Face_handle;
|
||||
typedef typename Arrangement_2::Face_iterator Face_iterator;
|
||||
typedef typename Arrangement_2::Edge_iterator Edge_iterator;
|
||||
typedef typename Arrangement_2::Vertex_handle Vertex_handle;
|
||||
typedef typename Arrangement_2::Ccb_halfedge_const_circulator
|
||||
|
|
@ -119,9 +120,18 @@ public:
|
|||
|
||||
m_sweep_line.sweep(curves_list.begin(), curves_list.end());
|
||||
|
||||
m_faces_hash[m_arr->unbounded_face()] = 0;
|
||||
// we use the first face with out outer ccbs. This assumpsion should
|
||||
// be fixed when we can make a face with no outer ccb to a face with
|
||||
// outer ccb.
|
||||
Face_iterator it;
|
||||
for (it = m_arr->faces_begin(); it != m_arr->faces_end(); ++it)
|
||||
if (it->number_of_outer_ccbs() == 0)
|
||||
break;
|
||||
CGAL_assertion(it != m_arr->faces_end());
|
||||
|
||||
m_faces_hash[it] = 0;
|
||||
Bfs_visitor visitor(&m_edges_hash, &m_faces_hash, 1);
|
||||
visitor.visit_ubf(m_arr->unbounded_face(), 0);
|
||||
visitor.visit_ubf(it, 0);
|
||||
Bfs_scanner scanner(visitor);
|
||||
scanner.scan(*m_arr);
|
||||
visitor.after_scan(*m_arr);
|
||||
|
|
|
|||
Loading…
Reference in New Issue