This commit is contained in:
Ester Ezra 2002-01-20 12:31:58 +00:00
parent 60667d7690
commit b22ad8e7ec
6 changed files with 650 additions and 336 deletions

View File

@ -65,7 +65,7 @@ public:
const Arrangement& arr2) :
arr1_( *(new Map_overlay(arr1)) ),
arr2_( *(new Map_overlay(arr2)) ),
map_overlay( *(new Map_overlay(arr1_, arr2_)) )
map_overlay_( *(new Map_overlay(arr1_, arr2_)) )
//map_overlay( Map_overlay(Map_overlay(arr1, &ovl_notf), Map_overlay(arr2, &ovl_notf), &ovl_notf) )
{}
@ -74,7 +74,7 @@ public:
Map_ovl_base *ovl_ptr) :
arr1_( *(new Map_overlay(arr1, ovl_ptr)) ),
arr2_( *(new Map_overlay(arr2, ovl_ptr)) ),
map_overlay( *(new Map_overlay(arr1_, arr2_, ovl_ptr)) )
map_overlay_( *(new Map_overlay(arr1_, arr2_, ovl_ptr)) )
//map_overlay( Map_overlay(Map_overlay(arr1, &ovl_notf), Map_overlay(arr2, &ovl_notf), &ovl_notf) )
{}
@ -83,19 +83,19 @@ public:
Map_overlay_change_notification* ovl_notf_ptr, Map_ovl_base *ovl_ptr) :
arr1_( *(new Map_overlay(arr1, ovl_notf, ovl_ptr)) ),
arr2_( *(new Map_overlay(arr2, ovl_notf_ptr, ovl_ptr)) ),
map_overlay(*(new Map_overlay(arr1_, arr2_, ovl_notf_ptr, ovl_ptr)) )
map_overlay_(*(new Map_overlay(arr1_, arr2_, ovl_notf_ptr, ovl_ptr)) )
//map_overlay( Map_overlay(Map_overlay(arr1, &ovl_notf), Map_overlay(arr2, &ovl_notf), &ovl_notf) )
{}
Boolean_operations(const Arrangement& arr1, const Arrangement& arr2, Map_overlay_change_notification* ovl_notf) :
arr1_( *(new Map_overlay(arr1, ovl_notf)) ), arr2_( *(new Map_overlay(arr2, ovl_notf)) ),
map_overlay( *(new Map_overlay(arr1_, arr2_, ovl_notf)) )
map_overlay_( *(new Map_overlay(arr1_, arr2_, ovl_notf)) )
//map_overlay( Map_overlay(Map_overlay(arr1, &ovl_notf), Map_overlay(arr2, &ovl_notf), &ovl_notf) )
{}
Boolean_operations(const Map_overlay& map_ovl) :
arr1_(*(map_ovl.get_first_subdivision())), arr2_(*(map_ovl.get_second_subdivision())),
map_overlay(map_ovl)
map_overlay_(map_ovl)
{}
@ -104,7 +104,7 @@ public:
Halfedges_container& list_of_halfedges,
Vertices_container& list_of_vertices) const
{
const Arrangement& arr = map_overlay.get_subdivision();
const Arrangement& arr = map_overlay_.subdivision();
//Map_overlay_change_notification tmp_notf;
// a vertex is in the intersection if it gots two vertices above it or two halfedges or two face.
@ -130,7 +130,7 @@ public:
void intersection (Faces_container& list_of_faces) const
{
const Arrangement& arr = map_overlay.get_arr();
const Arrangement& arr = map_overlay_.subdivision();
//Map_overlay_change_notification tmp_notf;
// a face is in the intersection if it gots two faces above it.
@ -144,7 +144,7 @@ public:
void intersection (Halfedges_container& list_of_halfedges) const
{
const Arrangement& arr = map_overlay.get_subdivision();
const Arrangement& arr = map_overlay_.subdivision();
//Map_overlay_change_notification tmp_notf;
// an halfedge is in the intersection if it gots two halfedges above it or two faces.
@ -156,7 +156,7 @@ public:
void intersection (Vertices_container& list_of_vertices) const
{
const Arrangement& arr = map_overlay.get_subdivision();
const Arrangement& arr = map_overlay_.subdivision();
//Map_overlay_change_notification tmp_notf;
// a vertex is in the intersection if it gots two vertices above it or two halfedges or two face.
@ -169,7 +169,7 @@ public:
void intersection (Faces_container& list_of_faces,
Halfedges_container& list_of_halfedges) const
{
const Arrangement& arr = map_overlay.get_subdivision();
const Arrangement& arr = map_overlay_.subdivision();
//Map_overlay_change_notification tmp_notf;
// an halfedge is in the intersection if it gots two halfedges above it or two faces.
@ -190,7 +190,7 @@ public:
void intersection (Halfedges_container& list_of_halfedges,
Vertices_container& list_of_vertices) const
{
const Arrangement& arr = map_overlay.get_subdivision();
const Arrangement& arr = map_overlay_.subdivision();
//Map_overlay_change_notification tmp_notf;
// a vertex is in the intersection if it gots two vertices above it or two halfedges or two face.
@ -209,7 +209,7 @@ public:
void intersection (Faces_container& list_of_faces,
Vertices_container& list_of_vertices) const
{
const Arrangement& arr = map_overlay.get_subdivision();
const Arrangement& arr = map_overlay_.subdivision();
//Map_overlay_change_notification tmp_notf;
// a vertex is in the intersection if it gots two vertices above it or two halfedges or two face.
@ -232,7 +232,7 @@ public:
Halfedges_container& list_of_halfedges,
Vertices_container& list_of_vertices) const
{
const Arrangement& arr = map_overlay.get_subdivision();
const Arrangement& arr = map_overlay_.subdivision();
//Map_overlay_change_notification tmp_notf;
// a vertex is on the union if it gots at least one vertex above it, or one halfedg or one face.
@ -258,7 +258,7 @@ public:
void Union (Faces_container& list_of_faces) const
{
const Arrangement& arr = map_overlay.get_subdivision();
const Arrangement& arr = map_overlay_.subdivision();
//Map_overlay_change_notification tmp_notf;
// a face is in the union if it gots at least one face above it.
@ -273,7 +273,7 @@ public:
//template <class Faces_output_container, class Halfedges_output_container, class Vertices_output_container>
void Union (Halfedges_container& list_of_halfedges) const
{
const Arrangement& arr = map_overlay.get_subdivision();
const Arrangement& arr = map_overlay_.subdivision();
//Map_overlay_changeNotification tmp_notf;
// an halfedge is in the union if it gots at least one halfedge above it or one face.
@ -285,7 +285,7 @@ public:
void Union (Vertices_container& list_of_vertices) const
{
const Arrangement& arr = map_overlay.get_subdivision();
const Arrangement& arr = map_overlay_.subdivision();
//Map_overlay_changeNotification tmp_notf;
// a vertex is on the union if it gots at least one vertex above it, or one halfedg or one face.
@ -298,7 +298,7 @@ public:
void Union (Faces_container& list_of_faces,
Halfedges_container& list_of_halfedges) const
{
const Arrangement& arr = map_overlay.get_subdivision();
const Arrangement& arr = map_overlay_.subdivision();
//Map_overlay_changeNotification tmp_notf;
// an halfedge is in the union if it gots at least one halfedge above it or one face.
@ -319,7 +319,7 @@ public:
void Union (Halfedges_container& list_of_halfedges,
Vertices_container& list_of_vertices) const
{
const Arrangement& arr = map_overlay.get_subdivision();
const Arrangement& arr = map_overlay_.subdivision();
//Map_overlay_changeNotification tmp_notf;
// a vertex is on the union if it gots at least one vertex above it, or one halfedg or one face.
@ -338,7 +338,7 @@ public:
void Union (Faces_container& list_of_faces,
Vertices_container& list_of_vertices) const
{
const Arrangement& arr = map_overlay.get_subdivision();
const Arrangement& arr = map_overlay_.subdivision();
//Map_overlay_changeNotification tmp_notf;
// a vertex is on the union if it gots at least one vertex above it, or one halfedg or one face.
@ -361,7 +361,7 @@ public:
Vertices_container& list_of_vertices) const
{
//Map_overlay tmp_ovl;
const Arrangement& arr = map_overlay.get_subdivision();
const Arrangement& arr = map_overlay_.subdivision();
for (Vertex_const_iterator vertices_iter = arr.vertices_begin(); vertices_iter != arr.vertices_end(); vertices_iter++){
if ((vertex_is_below_first_map(vertices_iter) && !vertex_is_below_second_map(vertices_iter)) ||
@ -390,7 +390,7 @@ public:
void symmetric_difference (Vertices_container& list_of_vertices) const
{
//Map_overlay tmp_ovl;
const Arrangement& arr = map_overlay.get_subdivision();
const Arrangement& arr = map_overlay_.subdivision();
for (Vertex_const_iterator vertices_iter = arr.vertices_begin(); vertices_iter != arr.vertices_end(); vertices_iter++){
if ((vertex_is_below_first_map(vertices_iter) && !vertex_is_below_second_map(vertices_iter)) ||
@ -402,7 +402,7 @@ public:
void symmetric_difference (Halfedges_container& list_of_halfedges) const
{
//Map_overlay tmp_ovl;
const Arrangement& arr = map_overlay.get_subdivision();
const Arrangement& arr = map_overlay_.subdivision();
for (Halfedge_const_iterator halfedge_iter = arr.halfedges_begin(); halfedge_iter != arr.halfedges_end(); halfedge_iter++){
if ((halfedge_is_below_first_map(halfedge_iter) && !halfedge_is_below_second_map(halfedge_iter)) ||
@ -415,7 +415,7 @@ public:
void symmetric_difference (Faces_container& list_of_faces) const
{
//Map_overlay tmp_ovl;
const Arrangement& arr = map_overlay.get_subdivision();
const Arrangement& arr = map_overlay_.subdivision();
for (Face_const_iterator face_iter = arr.faces_begin(); face_iter != arr.faces_end(); face_iter++){
//if ( (tmp_notf.get_first_face_above(face_iter)->bop() && !(tmp_notf.get_second_face_above(face_iter)->bop()) )
@ -432,7 +432,7 @@ public:
Vertices_container& list_of_vertices) const
{
//Map_overlay tmp_ovl;
const Arrangement& arr = map_overlay.get_subdivision();
const Arrangement& arr = map_overlay_.subdivision();
//Map_overlay_changeNotification tmp_notf;
for (Vertex_const_iterator vertices_iter = arr.vertices_begin(); vertices_iter != arr.vertices_end(); vertices_iter++){
@ -453,7 +453,7 @@ public:
Halfedges_container& list_of_halfedges) const
{
//Map_overlay tmp_ovl;
const Arrangement& arr = map_overlay.get_subdivision();
const Arrangement& arr = map_overlay_.subdivision();
for (Halfedge_const_iterator halfedge_iter = arr.halfedges_begin(); halfedge_iter != arr.halfedges_end(); halfedge_iter++){
if ((halfedge_is_below_first_map(halfedge_iter) && !halfedge_is_below_second_map(halfedge_iter)) ||
@ -477,7 +477,7 @@ public:
Vertices_container& list_of_vertices) const
{
//Map_overlay tmp_ovl;
const Arrangement& arr = map_overlay.get_subdivision();
const Arrangement& arr = map_overlay_.subdivision();
for (Vertex_const_iterator vertices_iter = arr.vertices_begin(); vertices_iter != arr.vertices_end(); vertices_iter++){
if ((vertex_is_below_first_map(vertices_iter) && !vertex_is_below_second_map(vertices_iter)) ||
@ -503,7 +503,7 @@ public:
bool first = true) const
{
//Map_overlay tmp_ovl;
const Arrangement& arr = map_overlay.get_subdivision();
const Arrangement& arr = map_overlay_.subdivision();
//Map_overlay_changeNotification tmp_notf;
for (Vertex_const_iterator vertices_iter = arr.vertices_begin(); vertices_iter != arr.vertices_end(); vertices_iter++){
@ -546,7 +546,7 @@ public:
bool first = true) const
{
//Map_overlay tmp_ovl;
const Arrangement& arr = map_overlay.get_subdivision();
const Arrangement& arr = map_overlay_.subdivision();
//Map_overlay_changeNotification tmp_notf;
for (Vertex_const_iterator vertices_iter = arr.vertices_begin(); vertices_iter != arr.vertices_end(); vertices_iter++){
@ -564,7 +564,7 @@ public:
bool first = true) const
{
//Map_overlay tmp_ovl;
const Arrangement& arr = map_overlay.get_subdivision();
const Arrangement& arr = map_overlay_.subdivision();
for (Halfedge_const_iterator halfedge_iter = arr.halfedges_begin(); halfedge_iter != arr.halfedges_end(); halfedge_iter++){
if (first){
@ -581,7 +581,7 @@ public:
bool first = true) const
{
//Map_overlay tmp_ovl;
const Arrangement& arr = map_overlay.get_subdivision();
const Arrangement& arr = map_overlay_.subdivision();
for (Face_const_iterator face_iter = arr.faces_begin(); face_iter != arr.faces_end(); face_iter++){
if (first){
@ -604,7 +604,7 @@ public:
bool first = true) const
{
//Map_overlay tmp_ovl;
const Arrangement& arr = map_overlay.get_subdivision();
const Arrangement& arr = map_overlay_.subdivision();
//Map_overlay_changeNotification tmp_notf;
for (Vertex_const_iterator vertices_iter = arr.vertices_begin(); vertices_iter != arr.vertices_end(); vertices_iter++){
@ -633,7 +633,7 @@ public:
bool first = true) const
{
//Map_overlay tmp_ovl;
const Arrangement& arr = map_overlay.get_subdivision();
const Arrangement& arr = map_overlay_.subdivision();
for (Halfedge_const_iterator halfedge_iter = arr.halfedges_begin(); halfedge_iter != arr.halfedges_end(); halfedge_iter++){
@ -667,7 +667,7 @@ public:
bool first = true) const
{
//Map_overlay tmp_ovl;
const Arrangement& arr = map_overlay.get_subdivision();
const Arrangement& arr = map_overlay_.subdivision();
//Map_overlay_changeNotification tmp_notf;
for (Vertex_const_iterator vertices_iter = arr.vertices_begin(); vertices_iter != arr.vertices_end(); vertices_iter++){
@ -696,7 +696,7 @@ public:
}
}
const Map_overlay& get_map_overlay() const {return map_overlay;}
const Map_overlay& map_overlay() const {return map_overlay_;}
~Boolean_operations () {}
@ -750,7 +750,7 @@ private:
}
const Map_overlay &arr1_, &arr2_;
const Map_overlay &map_overlay;
const Map_overlay &map_overlay_;
//std::list<Face_const_iterator> faces;
};
@ -761,3 +761,7 @@ CGAL_END_NAMESPACE

View File

@ -21,13 +21,13 @@
CGAL_BEGIN_NAMESPACE
template <class Arrangement_,
class Map_overlay_change_notification_ = Map_overlay_default_notifier<Arrangement_> >
class Change_notification_ = Map_overlay_default_notifier<Arrangement_> >
class Map_overlay {
public:
typedef Arrangement_ Arrangement;
typedef Map_overlay_change_notification_ Map_overlay_change_notification;
//typedef typename Arrangement::Planar_map PM;
typedef Change_notification_ Change_notification;
typedef typename Arrangement::Planar_map Planar_map;
//typedef typename Arrangement::Pmwx Pmwx;
typedef typename Arrangement::Vertex Vertex;
typedef typename Arrangement::Face Face;
@ -49,18 +49,20 @@ public:
typedef typename Arrangement::Holes_iterator Holes_iterator;
typedef typename Arrangement::Holes_const_iterator Holes_const_iterator;
typedef typename Arrangement::Locate_type Locate_type;
typedef typename Arrangement::Point_location_base Point_location_base;
//typedef typename Arrangement::Point_location_base Point_location_base;
typedef Map_overlay_base<Arrangement, Map_overlay_change_notification> Map_ovl_base;
typedef Map_overlay_sweep<Arrangement, Map_overlay_change_notification> Map_ovl_sweep;
typedef Map_overlay_base<Arrangement, Change_notification> Map_ovl_base;
typedef Map_overlay_sweep<Arrangement, Change_notification> Map_ovl_sweep;
typedef Pm_point_location_base<Planar_map> Point_location_base;
private:
typedef Map_overlay<Arrangement, Map_overlay_change_notification> Self;
typedef Map_overlay<Arrangement, Change_notification> Self;
public:
Map_overlay() : sub_division1(0), sub_division2(0),
ovl_change_notf(new Map_overlay_change_notification),
ovl_change_notf(new Change_notification),
ovl(new Map_ovl_sweep),
use_delete_notf(true),
use_delete_ovl(true) {
@ -74,7 +76,7 @@ public:
Map_overlay (const Arrangement &arr) : arr_(arr),
sub_division1(0), sub_division2(0),
ovl_change_notf(new Map_overlay_change_notification),
ovl_change_notf(new Change_notification),
ovl(new Map_ovl_sweep),
use_delete_notf(true),
use_delete_ovl(true)
@ -90,7 +92,8 @@ public:
sub_division1 = sub_division2 = NULL;*/
}
Map_overlay (const Arrangement &arr, Map_overlay_change_notification* pmwx_change_notf) :
Map_overlay (const Arrangement &arr,
Change_notification* pmwx_change_notf) :
arr_(arr), sub_division1(0), sub_division2(0),
ovl_change_notf(pmwx_change_notf), ovl(new Map_ovl_sweep),
use_delete_notf (false), use_delete_ovl(true)
@ -102,59 +105,84 @@ public:
//ovl->map_overlay(arr, empty_subdivision, ovl_change_notf, arr_);
}
Map_overlay (const Arrangement &arr, Map_ovl_base *ovl_ptr) : ovl(ovl_ptr) //, arr_(arr)
Map_overlay (const Arrangement &arr, Map_ovl_base *ovl_ptr) : arr_(arr), ovl(ovl_ptr)
{
copy_arr(arr, arr_);
//copy_arr(arr, arr_);
ovl_change_notf = new Map_overlay_change_notification;
ovl_change_notf = new Change_notification;
use_delete_notf = true;
use_delete_ovl = false;
sub_division1 = sub_division2 = NULL;
sub_division1 = sub_division2 = 0;
}
Map_overlay (const Arrangement &arr,
Map_overlay_change_notification* pmwx_change_notf,
Change_notification* pmwx_change_notf,
Map_ovl_base *ovl_ptr)
: ovl_change_notf(pmwx_change_notf) , ovl(ovl_ptr) //, arr_(arr)
: ovl_change_notf(pmwx_change_notf) , ovl(ovl_ptr) , arr_(arr)
{
copy_arr(arr, arr_);
//copy_arr(arr, arr_);
use_delete_notf = false;
use_delete_ovl = false;
sub_division1 = sub_division2 = NULL;
sub_division1 = sub_division2 = 0;
}
/*Map_overlay (const Arrangement &arr1, const Arrangement &arr2)
{
}*/
Map_overlay (const Self &ovl1, const Self &ovl2)
{
ovl = new Map_ovl_sweep;
use_delete_ovl = true;
ovl_change_notf = new Map_overlay_change_notification( &(ovl1.get_subdivision()),
&(ovl2.get_subdivision()) );
ovl_change_notf = new Change_notification( &(ovl1.subdivision()),
&(ovl2.subdivision()) );
use_delete_notf = true;
//int c_sweep_t;
//c_sweep_t = clock();
ovl->map_overlay(ovl1.get_subdivision(), ovl2.get_subdivision(), ovl_change_notf, arr_);
ovl->map_overlay(ovl1.subdivision(), ovl2.subdivision(), ovl_change_notf, arr_);
//c_sweep_t = clock() - c_sweep_t;
//std::cout<<"The time required by sweep line : "<< (double) c_sweep_t / (double) CLOCKS_PER_SEC<<std::endl;
sub_division1 = (Self *) &ovl1;
sub_division2 = (Self *) &ovl2;
}
Map_overlay (const Self &ovl1, const Self &ovl2,
Point_location_base *pl_ptr) : arr_(pl_ptr)
{
ovl = new Map_ovl_sweep;
use_delete_ovl = true;
ovl_change_notf = new Change_notification( &(ovl1.subdivision()),
&(ovl2.subdivision()) );
use_delete_notf = true;
int c_sweep_t;
c_sweep_t = clock();
ovl->map_overlay(ovl1.subdivision(), ovl2.subdivision(), ovl_change_notf, arr_);
c_sweep_t = clock() - c_sweep_t;
std::cout<<"The time required by sweep line : "<< (double) c_sweep_t / (double) CLOCKS_PER_SEC<<std::endl;
sub_division1 = (Self *) &ovl1;
sub_division2 = (Self *) &ovl2;
}
Map_overlay (const Self &ovl1,
const Self &ovl2,
Map_overlay_change_notification* pmwx_change_notf)
Change_notification* pmwx_change_notf)
: ovl_change_notf(pmwx_change_notf)
{
ovl = new Map_ovl_sweep;
use_delete_ovl = true;
use_delete_notf = false;
ovl->map_overlay(ovl1.get_subdivision(), ovl2.get_subdivision(), ovl_change_notf, arr_);
ovl->map_overlay(ovl1.subdivision(), ovl2.subdivision(), ovl_change_notf, arr_);
sub_division1 = (Self *) &ovl1;
sub_division2 = (Self *) &ovl2;
@ -163,12 +191,12 @@ public:
Map_overlay (const Self &ovl1, const Self &ovl2, Map_ovl_base *ovl_ptr)
: ovl(ovl_ptr)
{
ovl_change_notf = new Map_overlay_change_notification( &(ovl1.get_subdivision()),
&(ovl2.get_subdivision()) );
ovl_change_notf = new Change_notification( &(ovl1.subdivision()),
&(ovl2.subdivision()) );
use_delete_notf = true;
use_delete_ovl = false;
ovl->map_overlay(ovl1.get_subdivision(), ovl2.get_subdivision(), ovl_change_notf, arr_);
ovl->map_overlay(ovl1.subdivision(), ovl2.subdivision(), ovl_change_notf, arr_);
sub_division1 = (Self *) &ovl1;
sub_division2 = (Self *) &ovl2;
@ -176,14 +204,14 @@ public:
Map_overlay (const Self &ovl1,
const Self &ovl2,
Map_overlay_change_notification* pmwx_change_notf,
Change_notification* pmwx_change_notf,
Map_ovl_base *ovl_ptr)
: ovl_change_notf(pmwx_change_notf) , ovl(ovl_ptr)
{
use_delete_notf = false;
use_delete_ovl = false;
ovl->map_overlay(ovl1.get_subdivision(), ovl2.get_subdivision(), ovl_change_notf, arr_);
ovl->map_overlay(ovl1.subdivision(), ovl2.subdivision(), ovl_change_notf, arr_);
sub_division1 = (Self *) &ovl1;
sub_division2 = (Self *) &ovl2;
@ -208,13 +236,13 @@ public:
f_iter->reset();
}
const Arrangement & get_subdivision() const
const Arrangement& subdivision() const
{ return arr_; }
const Self* get_first_subdivision () const
const Self* first_creator () const
{ return sub_division1; }
const Self* get_second_subdivision () const
const Self* second_creator () const
{ return sub_division2; }
private:
@ -282,7 +310,7 @@ private:
Arrangement arr_;
const Self *sub_division1, *sub_division2;
Map_overlay_change_notification *ovl_change_notf;
Change_notification *ovl_change_notf;
Map_ovl_base *ovl;
bool use_delete_notf;
bool use_delete_ovl;

View File

@ -33,7 +33,7 @@ public:
typedef typename Arrangement::Holes_const_iterator Holes_const_iterator;
typedef typename Arrangement::Locate_type Locate_type;
typedef typename Arrangement::Traits_wrap Traits_wrap;
typedef typename Arrangement::Change_notification Pmwx_change_notification;
typedef typename Arrangement::Change_notification Change_notification;
typedef typename Arrangement::Traits Traits;
typedef typename Traits::Point Point;
@ -51,25 +51,26 @@ public:
typedef Map_overlay_default_notifier<Arrangement> Self;
typedef const Arrangement* Arr_const_pointer;
Map_overlay_default_notifier() { arr1 = NULL; arr2 = NULL; }
Map_overlay_default_notifier() : arr1(0), arr2(0) {}
Map_overlay_default_notifier (Arr_const_pointer sub_division1,
Arr_const_pointer sub_division2)
: arr1(sub_division1), arr2(sub_division2) {}
Map_overlay_default_notifier (const Self& notf)
: arr1(notf.get_sub_division1()), arr2(notf.get_sub_division2()) {}
: arr1(notf.arr1), arr2(notf.arr2) {}
Map_overlay_default_notifier (const Self* notf)
: arr1(notf->get_sub_division1()), arr2(notf->get_sub_division2()) {}
//Map_overlay_default_notifier (const Self* notf)
// : arr1(notf->get_sub_division1()), arr2(notf->get_sub_division2()) {}
virtual ~Map_overlay_default_notifier() {}
void add_edge(const X_curve& cv, Pm_halfedge_handle e,
bool left_to_right, bool overlap = false)
void add_edge(const X_curve& cv,
Pm_halfedge_handle e,
bool left_to_right,
bool overlap = false)
{
//std::cout<<"in add_edge" << std::endl;
if ((CGAL::compare_lexicographically_xy(e->source()->point(),
e->target()->point()) == CGAL::SMALLER &&
CGAL::compare_lexicographically_xy(orig_halfedge1->source()->point(),
@ -105,14 +106,14 @@ public:
}
}
else if ((CGAL::compare_lexicographically_xy(e->source()->point(),
e->target()->point()) == CGAL::SMALLER &&
CGAL::compare_lexicographically_xy(orig_halfedge2->source()->point(),
orig_halfedge2->target()->point()) == CGAL::SMALLER)
|| (CGAL::compare_lexicographically_xy(e->source()->point(),
e->target()->point()) == CGAL::LARGER &&
CGAL::compare_lexicographically_xy(orig_halfedge2->source()->point(),
orig_halfedge2->target()->point()) == CGAL::LARGER)){
else{
//if ((CGAL::compare_lexicographically_xy(e->source()->point(), e->target()->point()) == CGAL::SMALLER &&
// CGAL::compare_lexicographically_xy(orig_halfedge2->source()->point(),
// orig_halfedge2->target()->point()) == CGAL::SMALLER)
// || (CGAL::compare_lexicographically_xy(e->source()->point(),
// e->target()->point()) == CGAL::LARGER &&
// CGAL::compare_lexicographically_xy(orig_halfedge2->source()->point(),
// orig_halfedge2->target()->point()) == CGAL::LARGER))
if (first_halfedge){
set_first_halfedge_above(Halfedge_handle(e), orig_halfedge2);
set_first_halfedge_above(Halfedge_handle(e->twin()), orig_halfedge2->twin());
@ -140,8 +141,6 @@ public:
//e->twin()->set_second_halfedge_above(orig_halfedge2->twin().operator->());
}
}
else
assert(0);
// now making point location to update vertex pointers only if neccesary.
if (get_first_vertex_above(e->source()) == e->source()){ // if the first vertex above the source of e is NULL.
@ -190,20 +189,23 @@ public:
}
}
// now making a nother test for the face to the new_edge side, in order to take care of overlapping halfedges.
// now making another test for the face to the new_edge side,
// in order to take care of overlapping halfedges.
if ( !(e->face()->is_unbounded()) ){
Ccb_halfedge_circulator ccb_cir = Halfedge_handle(e)->face()->outer_ccb();
do{
if (ccb_cir->get_first_halfedge_above() != NULL){
//std::cout<<"overlapping bogi"<<std::endl;
set_first_face_above ( Halfedge_handle(e)->face(), get_first_halfedge_above(ccb_cir)->face());
set_first_face_above ( Halfedge_handle(e)->face(),
get_first_halfedge_above(ccb_cir)->face());
}
if (ccb_cir->get_second_halfedge_above() != NULL){
set_second_face_above ( Halfedge_handle(e)->face(), get_second_halfedge_above(ccb_cir)->face());
set_second_face_above ( Halfedge_handle(e)->face(),
get_second_halfedge_above(ccb_cir)->face());
}
ccb_cir++;
++ccb_cir;
} while (ccb_cir != Halfedge_handle(e)->face()->outer_ccb());
}
@ -213,34 +215,30 @@ public:
do{
if (ccb_cir->get_first_halfedge_above() != NULL){
//std::cout<<"overlapping twin bogi"<<std::endl;
set_first_face_above ( Halfedge_handle(e->twin())->face(), get_first_halfedge_above(ccb_cir)->face());
set_first_face_above ( Halfedge_handle(e->twin())->face(),
get_first_halfedge_above(ccb_cir)->face());
}
if (ccb_cir->get_second_halfedge_above() != NULL){
set_second_face_above ( Halfedge_handle(e->twin())->face(), get_second_halfedge_above(ccb_cir)->face());
set_second_face_above ( Halfedge_handle(e->twin())->face(),
get_second_halfedge_above(ccb_cir)->face());
}
ccb_cir++;
++ccb_cir;
} while (ccb_cir != Halfedge_handle(e->twin())->face()->outer_ccb());
}
}
void split_edge(Pm_halfedge_handle orig_edge, Pm_halfedge_handle new_edge, const X_curve& c1, const X_curve& c2)
void split_edge(Pm_halfedge_handle orig_edge,
Pm_halfedge_handle new_edge,
const X_curve& c1,
const X_curve& c2)
{
//std::cout<<"is split_edge" << std::endl;
// debug only!
/*if (new_edge->get_first_halfedge_above() != NULL)
cout<<"new blue edge ";
if (new_edge->get_second_halfedge_above() != NULL)
cout<<"new red edge ";
cout<<"\n";*/
// update half edges above new_edge and its twin.
new_edge->set_first_halfedge_above(orig_edge->get_first_halfedge_above());
new_edge->set_second_halfedge_above(orig_edge->get_second_halfedge_above());
new_edge->twin()->set_first_halfedge_above(orig_edge->twin()->get_first_halfedge_above());
new_edge->twin()->set_second_halfedge_above(orig_edge->twin()->get_second_halfedge_above());
// upadate halfedge above the edge points of new_edge.
if (get_first_halfedge_above(orig_edge) != orig_edge){
set_first_halfedge_above(Vertex_handle(new_edge->source()), get_first_halfedge_above(orig_edge));
@ -268,7 +266,7 @@ public:
set_second_face_above ( Halfedge_handle(new_edge)->face(),
get_second_halfedge_above(ccb_cir)->face());
}
ccb_cir++;
++ccb_cir;
} while (ccb_cir != Halfedge_handle(new_edge)->face()->outer_ccb());
}
@ -299,9 +297,75 @@ public:
//std::cout<<ccb_cir->curve()<<" had red face above "<<std::endl;
//new_face->set_second_face_above(((Halfedge* ) ccb_cir->get_second_halfedge_above())->face().operator->());
}
ccb_cir++;
++ccb_cir;
} while (ccb_cir != new_face->outer_ccb());
// now updating the faces above the halfedges and vertices of the new face.
/*do{
if (new_face->get_first_face_above() != NULL){
set_first_face_above (ccb_cir, get_first_face_above(new_face));
set_first_face_above (ccb_cir->source(), get_first_face_above(new_face));
}
if (new_face->get_second_face_above() != NULL){
set_second_face_above (ccb_cir, get_second_face_above(new_face));
set_second_face_above (ccb_cir->source(), get_second_face_above(new_face));
}
++ccb_cir;
} while (ccb_cir != new_face->outer_ccb());*/
// making point location to the original subdivision
// (if new_face is a hole of at least one of them).
if (new_face->get_first_face_above() == NULL){
ccb_cir != new_face->outer_ccb();
do{
Point p = ccb_cir->source()->point();
//std::cout<<"internal point is : "<< p <<std::endl;
Locate_type lt;
Halfedge_const_handle e = arr1->locate(p, lt);
if (lt == Arrangement::FACE || lt == Arrangement::UNBOUNDED_FACE)
{
//cout<<"internal point in FACE is : "<< p <<endl;
//if (e->face()->is_unbounded())
// cout<<"Unbounded"<<endl;
//else
// cout<<"Bounded"<<endl;
set_first_face_above(new_face, e->face());
set_first_face_above(ccb_cir, e->face());
set_first_face_above(ccb_cir->source(), e->face()); // also set the face above the vertex.
break;
}
++ccb_cir;
} while (ccb_cir != new_face->outer_ccb());
}
if (new_face->get_second_face_above() == NULL){
ccb_cir != new_face->outer_ccb();
do{
Point p = ccb_cir->source()->point();
//cout<<"internal point is : "<< p <<"\n";
Locate_type lt;
Halfedge_const_handle e = arr2->locate(p, lt);
if (lt == Arrangement::FACE || lt == Arrangement::UNBOUNDED_FACE)
{
//cout<<"internal point in FACE is : "<< p <<endl;
//if (e->face()->is_unbounded())
// cout<<"Unbounded"<<endl;
//else
// cout<<"Bounded"<<endl;
set_second_face_above(new_face, e->face());
set_second_face_above(ccb_cir, e->face());
set_second_face_above(ccb_cir->source(), e->face()); // also set the face above the vertex.
break;
}
++ccb_cir;
} while (ccb_cir != new_face->outer_ccb());
}
// now updating the faces above the halfedges and vertices of the new face.
do{
if (new_face->get_first_face_above() != NULL){
@ -313,45 +377,8 @@ public:
set_second_face_above (ccb_cir, get_second_face_above(new_face));
set_second_face_above (ccb_cir->source(), get_second_face_above(new_face));
}
ccb_cir++;
++ccb_cir;
} while (ccb_cir != new_face->outer_ccb());
// making point location to the original subdivision (if new_face is a hole of at least one of them).
if (new_face->get_first_face_above() == NULL){
do{
Point p = ccb_cir->source()->point();
//std::cout<<"internal point is : "<< p <<std::endl;
Locate_type lt;
Halfedge_const_handle e = arr1->locate(p, lt);
if (lt != Arrangement::VERTEX || lt != Arrangement::EDGE)
{
set_first_face_above(new_face, e->face());
set_first_face_above(ccb_cir, e->face());
set_first_face_above(ccb_cir->source(), e->face()); // also set the face above the vertex.
break;
}
ccb_cir++;
} while (ccb_cir != new_face->outer_ccb());
}
if (new_face->get_second_face_above() == NULL){
do{
Point p = ccb_cir->source()->point();
//cout<<"internal point is : "<< p <<"\n";
Locate_type lt;
Halfedge_const_handle e = arr2->locate(p, lt);
if (lt != Arrangement::VERTEX || lt != Arrangement::EDGE)
{
set_second_face_above(new_face, e->face());
set_second_face_above(ccb_cir, e->face());
set_second_face_above(ccb_cir->source(), e->face()); // also set the face above the vertex.
break;
}
ccb_cir++;
} while (ccb_cir != new_face->outer_ccb());
}
}
void split_face(Pm_face_handle orig_face, Pm_face_handle new_face)
@ -392,9 +419,9 @@ public:
first_halfedge = first_halfedge_;
}
Arr_const_pointer get_sub_division1 () const { return arr1;}
Arr_const_pointer first_subdivision () const { return arr1;}
Arr_const_pointer get_sub_division2 () const { return arr2;}
Arr_const_pointer second_subdivision () const { return arr2;}
//----------------------------------------- handle wrappering.
// setting the vertex above.

View File

@ -59,8 +59,9 @@ public:
typedef typename PM::Halfedge_const_handle Pm_halfedge_const_handle;
typedef typename PM::Face_const_handle Pm_face_const_handle;*/
private:
typedef Map_overlay_naive<Arrangement, Map_overlay_ChangeNotification> Self;
public:
Map_overlay_naive() {}
@ -98,19 +99,23 @@ public:
// std::cout<<"Notifier is NULL" << std::endl;
// Creaing the new arrangement of both subdivisions. inserting the curevs of the halfedges (already calculated fomr the given subdivisions
for (half_edge_iter = a1.halfedges_begin(); half_edge_iter != a1.halfedges_end(); half_edge_iter++, half_edge_iter++){
for (half_edge_iter = a1.halfedges_begin();
half_edge_iter != a1.halfedges_end();
++half_edge_iter, ++half_edge_iter){
pmwx_change_notf->set_curve_attributes(half_edge_iter->curve(),
half_edge_iter,
half_edge_iter->twin(), true);
true);
result.insert(half_edge_iter->curve(), pmwx_change_notf);
//result.insert(half_edge_iter->curve(), NULL); //debug only!
}
for (half_edge_iter = a2.halfedges_begin(); half_edge_iter != a2.halfedges_end(); half_edge_iter++, half_edge_iter++){
for (half_edge_iter = a2.halfedges_begin();
half_edge_iter != a2.halfedges_end();
++half_edge_iter, ++half_edge_iter){
pmwx_change_notf->set_curve_attributes(half_edge_iter->curve(),
half_edge_iter,
half_edge_iter->twin(), false);
false);
result.insert(half_edge_iter->curve(), pmwx_change_notf);
//result.insert(half_edge_iter->curve(), NULL); //debug only!

View File

@ -4,7 +4,7 @@
CGAL_BEGIN_NAMESPACE
template <class Arrangement_>
class Map_overlay_post_proc_notifier : public Arrangement_::PMWXChangeNotification
class Map_overlay_post_proc_notifier : public Arrangement_::Change_notification
{
public:
typedef Arrangement_ Arrangement;
@ -29,7 +29,7 @@ public:
typedef typename Arrangement::Holes_const_iterator Holes_const_iterator;
typedef typename Arrangement::Locate_type Locate_type;
typedef typename Arrangement::Traits_wrap Traits_wrap;
typedef typename Arrangement::PMWXChangeNotification PMWXChangeNotification;
typedef typename Arrangement::Change_notification Change_notification;
typedef typename Arrangement::Traits Traits;
typedef typename Traits::Point Point;
@ -46,9 +46,10 @@ public:
typedef Map_overlay_post_proc_notifier<Arrangement> Self;
typedef const Arrangement* Arr_const_pointer;
Map_overlay_post_proc_notifier() {arr1 = NULL; arr2 = NULL;}
Map_overlay_post_proc_notifier() : arr1(0), arr2(0) {}
Map_overlay_post_proc_notifier (Arr_const_pointer sub_division1, Arr_const_pointer sub_division2)
Map_overlay_post_proc_notifier (Arr_const_pointer sub_division1,
Arr_const_pointer sub_division2)
: arr1(sub_division1), arr2(sub_division2) {}
Map_overlay_post_proc_notifier (const Self& notf)
@ -59,9 +60,12 @@ public:
virtual ~Map_overlay_post_proc_notifier() {}
void add_edge(const X_curve& cv, Pm_halfedge_handle e, bool left_to_right, bool overlap = false)
void add_edge(const X_curve& cv,
Pm_halfedge_handle e,
bool left_to_right,
bool overlap = false)
{
mapOverlay tmp_ovl;
//mapOverlay tmp_ovl;
#ifdef CGAL_SWEEP_LINE_DEBUG
std::cout<<"in add_edge" << std::endl;
@ -76,47 +80,52 @@ public:
CGAL::compare_lexicographically_xy(orig_halfedge1->source()->point(),
orig_halfedge1->target()->point()) == CGAL::LARGER)){
if (first_halfedge){
tmp_ovl.set_first_halfedge_above(Halfedge_handle(e), orig_halfedge1);
tmp_ovl.set_first_halfedge_above(Halfedge_handle(e->twin()), orig_halfedge1->twin());
set_first_halfedge_above(Halfedge_handle(e), orig_halfedge1);
set_first_halfedge_above(Halfedge_handle(e->twin()), orig_halfedge1->twin());
//e->twin()->set_first_halfedge_above(orig_halfedge1->twin().operator->());
}
else{
tmp_ovl.set_second_halfedge_above(Halfedge_handle(e), orig_halfedge1);
tmp_ovl.set_second_halfedge_above(Halfedge_handle(e->twin()), orig_halfedge1->twin());
set_second_halfedge_above(Halfedge_handle(e), orig_halfedge1);
set_second_halfedge_above(Halfedge_handle(e->twin()), orig_halfedge1->twin());
//e->set_second_halfedge_above(orig_halfedge1.operator->());
//e->twin()->set_second_halfedge_above(orig_halfedge1->twin().operator->());
}
}
else if ((CGAL::compare_lexicographically_xy(e->source()->point(),
e->target()->point()) == CGAL::SMALLER &&
CGAL::compare_lexicographically_xy(orig_halfedge2->source()->point(),
orig_halfedge2->target()->point()) == CGAL::SMALLER)
|| (CGAL::compare_lexicographically_xy(e->source()->point(),
e->target()->point()) == CGAL::LARGER &&
CGAL::compare_lexicographically_xy(orig_halfedge2->source()->point(),
orig_halfedge2->target()->point()) == CGAL::LARGER)){
if (first_halfedge){
tmp_ovl.set_first_halfedge_above(Halfedge_handle(e), orig_halfedge2);
tmp_ovl.set_first_halfedge_above(Halfedge_handle(e->twin()), orig_halfedge2->twin());
//e->set_first_halfedge_above(orig_halfedge2.operator->());
//e->twin()->set_first_halfedge_above(orig_halfedge2->twin().operator->());
else
/*if ((CGAL::compare_lexicographically_xy(e->source()->point(),
e->target()->point()) == CGAL::SMALLER &&
CGAL::compare_lexicographically_xy(orig_halfedge2->source()->point(),
orig_halfedge2->target()->point()) == CGAL::SMALLER)
|| (CGAL::compare_lexicographically_xy(e->source()->point(),
e->target()->point()) == CGAL::LARGER &&
CGAL::compare_lexicographically_xy(orig_halfedge2->source()->point(),
orig_halfedge2->target()->point()) == CGAL::LARGER))*/
{
if (first_halfedge){
set_first_halfedge_above(Halfedge_handle(e), orig_halfedge2);
set_first_halfedge_above(Halfedge_handle(e->twin()), orig_halfedge2->twin());
//e->set_first_halfedge_above(orig_halfedge2.operator->());
//e->twin()->set_first_halfedge_above(orig_halfedge2->twin().operator->());
}
else{
set_second_halfedge_above(Halfedge_handle(e), orig_halfedge2);
set_second_halfedge_above(Halfedge_handle(e->twin()), orig_halfedge2->twin());
//e->set_second_halfedge_above(orig_halfedge2.operator->());
//e->twin()->set_second_halfedge_above(orig_halfedge2->twin().operator->());
}
}
else{
tmp_ovl.set_second_halfedge_above(Halfedge_handle(e), orig_halfedge2);
tmp_ovl.set_second_halfedge_above(Halfedge_handle(e->twin()), orig_halfedge2->twin());
//e->set_second_halfedge_above(orig_halfedge2.operator->());
//e->twin()->set_second_halfedge_above(orig_halfedge2->twin().operator->());
}
}
else
assert(0);
//else
// assert(0);
}
void split_edge(Pm_halfedge_handle orig_edge, Pm_halfedge_handle new_edge, const X_curve& c1, const X_curve& c2)
void split_edge(Pm_halfedge_handle orig_edge,
Pm_halfedge_handle new_edge,
const X_curve& c1,
const X_curve& c2)
{
#ifdef CGAL_SWEEP_LINE_DEBUG
std::cout<<"is split_edge" << std::endl;
@ -159,22 +168,16 @@ public:
return false;
}
/***************************************** new functions **********************************************************/
void set_curve_attributes(const X_curve& cv, Halfedge_const_handle orig_halfedge1_, Halfedge_const_handle orig_halfedge2_, bool first_halfedge_)
void update_all_faces(Arrangement& pmwx,
const Arrangement& first_creator,
const Arrangement& second_creator)
{
orig_halfedge1 = orig_halfedge1_;
orig_halfedge2 = orig_halfedge2_;
first_halfedge = first_halfedge_;
}
void update_all_faces(Arrangement& pmwx, const Arrangement& first_creator, const Arrangement& second_creator)
{
mapOverlay tmp_ovl;
//mapOverlay tmp_ovl;
Face_handle unbounded = pmwx.unbounded_face();
// first taking care of the unbounded face.
tmp_ovl.set_first_face_above(unbounded, first_creator.unbounded_face());
tmp_ovl.set_second_face_above(unbounded, second_creator.unbounded_face());
set_first_face_above(unbounded, first_creator.unbounded_face());
set_second_face_above(unbounded, second_creator.unbounded_face());
unbounded->set_color(Face::BLACK);
for (Holes_iterator hit = unbounded->holes_begin(); hit != unbounded->holes_end(); ++hit) {
@ -191,22 +194,22 @@ public:
do{
if (ccb_cir->get_first_halfedge_above() != NULL){
#ifdef CGAL_SWEEP_LINE_DEBUG
if (tmp_ovl.get_first_halfedge_above(ccb_cir)->face()->is_unbounded())
if (get_first_halfedge_above(ccb_cir)->face()->is_unbounded())
std::cout<<"Face (of first halfedge) above begin_face->outer_ccb() is unbounded"<<std::endl;
std::cout<<"ccb_cir->get_first_halfedge_above() != NULL" << std::endl;
#endif
tmp_ovl.set_first_face_above(begin_face, tmp_ovl.get_first_halfedge_above(ccb_cir)->face());
set_first_face_above(begin_face, get_first_halfedge_above(ccb_cir)->face());
//begin_face->set_first_face_above (tmp_ovl.get_first_halfedge_above(ccb_cir)->face().operator->());
//begin_face->set_first_face_above(((Halfedge*) ccb_cir->get_first_halfedge_above())->face().operator->());
}
if (ccb_cir->get_second_halfedge_above() != NULL){
#ifdef CGAL_SWEEP_LINE_DEBUG
if (tmp_ovl.get_second_halfedge_above(ccb_cir)->face()->is_unbounded())
if (get_second_halfedge_above(ccb_cir)->face()->is_unbounded())
std::cout<<"Face above (ofsecond halfedge) begin_face->outer_ccb() is unbounded"<<std::endl;
std::cout<<"ccb_cir->get_second_halfedge_above() != NULL" << std::endl;
#endif
tmp_ovl.set_second_face_above(begin_face, tmp_ovl.get_second_halfedge_above(ccb_cir)->face());
set_second_face_above(begin_face, get_second_halfedge_above(ccb_cir)->face());
//begin_face->set_second_face_above(tmp_ovl.get_second_halfedge_above(ccb_cir)->face().operator->());
//begin_face->set_second_face_above( ((Halfedge*) ccb_cir->get_second_halfedge_above())->face().operator->());
}
@ -215,23 +218,23 @@ public:
do{
if (ccb_cir->get_first_face_above() != NULL && begin_face->get_first_face_above() == NULL){
#ifdef CGAL_SWEEP_LINE_DEBUG
if (tmp_ovl.get_first_face_above(ccb_cir)->is_unbounded())
if (get_first_face_above(ccb_cir)->is_unbounded())
std::cout<<"First face above ccb_cir of begin_face is unbounded"<<std::endl;
std::cout<<"ccb_cir->get_first_face_above() != NULL" << std::endl;
#endif
tmp_ovl.set_first_face_above(begin_face, tmp_ovl.get_first_face_above(ccb_cir));
set_first_face_above(begin_face, get_first_face_above(ccb_cir));
//begin_face->set_first_face_above(ccb_cir->get_first_face_above());
}
else if (ccb_cir->get_second_face_above() != NULL && begin_face->get_second_face_above() == NULL){
#ifdef CGAL_SWEEP_LINE_DEBUG
if (tmp_ovl.get_second_face_above(ccb_cir)->is_unbounded())
if (get_second_face_above(ccb_cir)->is_unbounded())
std::cout<<"Second face above ccb_cir of begin_face is unbounded"<<std::endl;
cout<<"ccb_cir->get_second_face_above() != NULL" << std::endl;
#endif
tmp_ovl.set_second_face_above(begin_face, tmp_ovl.get_second_face_above(ccb_cir));
set_second_face_above(begin_face, get_second_face_above(ccb_cir));
//begin_face->set_second_face_above(ccb_cir->get_second_face_above());
}
} while (++ccb_cir != begin_face->outer_ccb());
@ -242,7 +245,7 @@ public:
std::cout<<"first face above begin_face is NULL - putting unbounded"<<std::endl;
#endif
tmp_ovl.set_first_face_above(begin_face, first_creator.unbounded_face());
set_first_face_above(begin_face, first_creator.unbounded_face());
//begin_face->set_first_face_above(first_creator.unbounded_face().operator->());
}
@ -251,7 +254,7 @@ public:
std::cout<<"second face above begin_face is NULL - putting unbounded"<<std::endl;
#endif
tmp_ovl.set_second_face_above(begin_face, second_creator.unbounded_face());
set_second_face_above(begin_face, second_creator.unbounded_face());
//begin_face->set_second_face_above(second_creator.unbounded_face().operator->());
}
@ -277,12 +280,12 @@ public:
if (next_hole_face->get_color() == Face::WHITE){
if (next_hole_edge->get_first_halfedge_above() == NULL && face->get_first_face_above() != NULL){
tmp_ovl.set_first_face_above(next_hole_edge, tmp_ovl.get_first_face_above(face));
set_first_face_above(next_hole_edge, get_first_face_above(face));
//next_hole_edge->set_first_face_above(face->get_first_face_above());
}
if (next_hole_edge->get_second_halfedge_above() == NULL && face->get_second_face_above() != NULL){
tmp_ovl.set_second_face_above(next_hole_edge, tmp_ovl.get_second_face_above(face));
set_second_face_above(next_hole_edge, get_second_face_above(face));
//next_hole_edge->set_second_face_above(face->get_second_face_above());
}
@ -292,13 +295,13 @@ public:
do{
if (next_hole_cc->get_first_halfedge_above() != NULL){
tmp_ovl.set_first_face_above(next_hole_face, tmp_ovl.get_first_halfedge_above(next_hole_cc)->face());
set_first_face_above(next_hole_face, get_first_halfedge_above(next_hole_cc)->face());
//next_hole_face->set_first_face_above(tmp_ovl.get_first_halfedge_above(next_hole_cc)->face().operator->());
//next_hole_face->set_first_face_above(((Halfedge*) next_hole_cc->get_first_halfedge_above())->face().operator->());
//cout<<next_hole_cc->curve()<<" got blue above\n";
}
if (next_hole_cc->get_second_halfedge_above() != NULL){
tmp_ovl.set_second_face_above(next_hole_face, tmp_ovl.get_second_halfedge_above(next_hole_cc)->face());
set_second_face_above(next_hole_face, get_second_halfedge_above(next_hole_cc)->face());
//next_hole_face->set_second_face_above(tmp_ovl.get_second_halfedge_above(next_hole_cc)->face().operator->());
//next_hole_face->set_second_face_above(((Halfedge*) next_hole_cc->get_second_halfedge_above())->face().operator->());
//std::cout<<next_hole_cc->curve()<<" got red above\n";
@ -307,13 +310,13 @@ public:
do{
if (next_hole_cc->get_first_face_above() != NULL && next_hole_face->get_first_face_above() == NULL){
tmp_ovl.set_first_face_above(next_hole_face, tmp_ovl.get_first_face_above(next_hole_cc));
set_first_face_above(next_hole_face, get_first_face_above(next_hole_cc));
//next_hole_face->set_first_face_above(next_hole_cc->get_first_face_above());
//cout<<next_hole_cc->curve()<<" got blue above\n";
}
if (next_hole_cc->get_second_face_above() != NULL && next_hole_face->get_second_face_above() == NULL){
tmp_ovl.set_second_face_above(next_hole_face, tmp_ovl.get_second_face_above(next_hole_cc));
set_second_face_above(next_hole_face, get_second_face_above(next_hole_cc));
//next_hole_face->set_second_face_above(next_hole_cc->get_second_face_above());
//std::cout<<next_hole_cc->curve()<<" got red above\n";
}
@ -336,12 +339,12 @@ public:
if (next_face->get_color() == Face::WHITE){
if (next_edge->get_first_halfedge_above() == NULL && face->get_first_face_above() != NULL){ //there was a bug here!
tmp_ovl.set_first_face_above(next_edge, tmp_ovl.get_first_face_above(face));
set_first_face_above(next_edge, get_first_face_above(face));
//next_edge->set_first_face_above(face->get_first_face_above());
}
if (next_edge->get_second_halfedge_above() == NULL && face->get_second_face_above() != NULL){
tmp_ovl.set_second_face_above(next_edge, tmp_ovl.get_second_face_above(face));
set_second_face_above(next_edge, get_second_face_above(face));
//next_edge->set_second_face_above(face->get_second_face_above());
}
@ -351,13 +354,13 @@ public:
do{
if (next_cc->get_first_halfedge_above() != NULL){
tmp_ovl.set_first_face_above(next_face, tmp_ovl.get_first_halfedge_above(next_cc)->face());
set_first_face_above(next_face, get_first_halfedge_above(next_cc)->face());
//next_face->set_first_face_above(tmp_ovl.get_first_halfedge_above(next_cc)->face().operator->());
//next_face->set_first_face_above(((Halfedge*) next_cc->get_first_halfedge_above())->face().operator->());
//std::cout<<next_cc->curve()<<" got blue above\n";
}
if (next_cc->get_second_halfedge_above() != NULL){
tmp_ovl.set_second_face_above(next_face, tmp_ovl.get_second_halfedge_above(next_cc)->face());
set_second_face_above(next_face, get_second_halfedge_above(next_cc)->face());
//next_face->set_second_face_above(tmp_ovl.get_second_halfedge_above(next_cc)->face().operator->());
//next_face->set_second_face_above(((Halfedge*) next_cc->get_second_halfedge_above())->face().operator->());
//std::cout<<next_cc->curve()<<" got red above\n";
@ -372,13 +375,13 @@ public:
tmp_ovl.set_first_face_above(next_face, tmp_ovl.get_first_face_above(next_cc));
set_first_face_above(next_face, get_first_face_above(next_cc));
//next_face->set_first_face_above(next_cc->get_first_face_above());
}
if (next_cc->get_second_face_above() != NULL && next_face->get_second_face_above() == NULL){
//cout<<"bogi red face1\n";
tmp_ovl.set_second_face_above(next_face, tmp_ovl.get_second_face_above(next_cc));
set_second_face_above(next_face, get_second_face_above(next_cc));
//next_face->set_second_face_above(next_cc->get_second_face_above());
//cout<<"bogi red face2\n";
@ -401,10 +404,20 @@ public:
} while (++begin_halfedge != *hit);
}
}
/***************************************** new functions **********************************************************/
void set_curve_attributes(const X_curve& cv,
Halfedge_const_handle orig_halfedge1_,
bool first_halfedge_)
{
orig_halfedge1 = orig_halfedge1_;
orig_halfedge2 = orig_halfedge1_->twin();
first_halfedge = first_halfedge_;
}
Arr_const_pointer get_sub_division1 () const { return arr1;}
Arr_const_pointer first_subdivision () const { return arr1;}
Arr_const_pointer get_sub_division2 () const { return arr2;}
Arr_const_pointer second_subdivision () const { return arr2;}
//----------------------------------------- handle wrappering.
// setting the vertex above.
@ -781,3 +794,7 @@ private:
Halfedge_const_handle orig_halfedge1, orig_halfedge2;
Arr_const_pointer arr1, arr2;
};
CGAL_END_NAMESPACE
#endif

View File

@ -200,60 +200,74 @@ public:
{
std::list<X_curve_plus> curves;
unsigned int id = 0;
// updating curevs to contain all updated curves plus.
Halfedge_const_iterator h_iter;
for(h_iter = a1.halfedges_begin(); h_iter != a1.halfedges_end(); h_iter++, h_iter++){
for (h_iter = a1.halfedges_begin(); h_iter != a1.halfedges_end(); ++h_iter, ++h_iter, ++id){
bool b;
X_curve cv(h_iter->curve());
if ((b = is_right(traits.curve_source(h_iter->curve()),
traits.curve_target(h_iter->curve())) ))
cv = traits.curve_flip(h_iter->curve());
Halfedge_const_handle h = h_iter;
curves.push_back(X_curve_plus(cv, h, true,
is_right(traits.curve_source(cv), traits.curve_target(cv))) );
curves.push_back(X_curve_plus(cv, h, true, b, id));
//is_right(traits.curve_source(cv),
// traits.curve_target(cv))) );
}
for(h_iter = a2.halfedges_begin(); h_iter != a2.halfedges_end(); h_iter++, h_iter++){
for(h_iter = a2.halfedges_begin(); h_iter != a2.halfedges_end(); ++h_iter, ++h_iter, ++id){
bool b;
X_curve cv(h_iter->curve());
if ((b = is_right(traits.curve_source(h_iter->curve()),
traits.curve_target(h_iter->curve())) ))
cv = traits.curve_flip(h_iter->curve());
Halfedge_const_handle h = h_iter;
curves.push_back(X_curve_plus(cv, h, false,
is_right(traits.curve_source(cv), traits.curve_target(cv))) );
curves.push_back(X_curve_plus(cv, h, false, b, id));
//is_right(traits.curve_source(cv),
// traits.curve_target(cv))) );
}
sweep_curves_to_planar_map(curves.begin(), curves.end(), pm_change_notf, result);
pm_change_notf->update_all_faces(result, a1, a2);
}
private:
void sweep_curves_to_planar_map(Curve_iterator curves_begin,
Curve_iterator curves_end,
Map_overlay_change_notification *pm_change_notf,
Map_overlay_change_notification *pm_change_notf,
PM &result)
{
Traits traits;
Event_queue event_queue;
Status_line status;
Vertices_points_plus input_vertices;
//int c_sweep_t;
//c_sweep_t = clock();
//std::list<Curve_node> disjoint_interior_curves;
int c_sweep_t;
c_sweep_t = clock();
#ifdef CGAL_SWEEP_LINE_DEBUG
unsigned int n = 0;
for (Curve_iterator cv_iter = curves_begin;
cv_iter != curves_end; cv_iter++, n++);
cv_iter != curves_end; ++cv_iter, ++n);
cout<<"number of edges on input "<< n <<std::endl;
#endif
/*
// first handling the case of which results is not empty: since we are sweeping the curves we have to take all
//the curves of result and 'paste' it to the input curves, then we have to clear result.
X_curve_plus_list subdivision_curves;
X_curve_list subdivision_curves;
for (Halfedge_iterator h_iter = result.halfedges_begin();
h_iter != result.halfedges_end(); h_iter++, h_iter++)
h_iter != result.halfedges_end(); ++h_iter, ++h_iter)
subdivision_curves.push_back(h_iter->curve());
result.clear();
@ -261,7 +275,7 @@ private:
// Now, creating all the point_plus handle: for any pair of overlapping points from the input we ensure we have only one handle. - not having such a structure as input_vertices caused a bug.
Vertices_points_plus input_vertices;
for (X_curve_list_iterator cv_iter = subdivision_curves.begin();
cv_iter != subdivision_curves.end(); cv_iter++){
cv_iter != subdivision_curves.end(); ++cv_iter){
if (input_vertices.find(traits.curve_source(*cv_iter)) ==
input_vertices.end())
@ -274,41 +288,40 @@ private:
Point_plus(traits.curve_target(*cv_iter))) );
}*/
/*
// splitting all curves to x-monotone curves.
X_curve_plus_list x_monotone_curves;
X_curve_list x_monotone_curves;
for (Curve_iterator cv_iter = curves_begin;
cv_iter != curves_end; cv_iter++){
/*if (!traits.is_x_monotone(*cv_iter)) {
X_curve_list x_monotone_subcurves;
traits.make_x_monotone(*cv_iter, x_monotone_subcurves);
#ifdef CGAL_SWEEP_LINE_DEBUG
cv_iter != curves_end; ++cv_iter){
if (!traits.is_x_monotone(*cv_iter)) {
X_curve_list x_monotone_subcurves;
traits.make_x_monotone(*cv_iter, x_monotone_subcurves);
#ifdef CGAL_SWEEP_LINE_DEBUG
std::cout<<"printing x-monotone parts"<<std::endl;
#endif
for(X_curve_list_iterator iter = x_monotone_subcurves.begin();
iter != x_monotone_subcurves.end(); iter++){
iter != x_monotone_subcurves.end(); ++iter){
#ifdef CGAL_SWEEP_LINE_DEBUG
std::cout<<*iter<<endl;
#endif
x_monotone_curves.push_back(X_curve_plus(*iter, cv_iter->parent(), cv_iter->first_map(), cv_iter->id()));
x_monotone_curves.push_back(*iter);
}
}
else*/
x_monotone_curves.push_back(*cv_iter);
}
/*
// now adding to the x-monotone container all the curves
// in the original subdivision.
for (X_curve_plus_list_iterator cv_iter = subdivision_curves.begin();
cv_iter != subdivision_curves.end(); cv_iter++)
x_monotone_curves.push_back(*cv_iter);*/
else
x_monotone_curves.push_back(*cv_iter);
}*/
// Now, creating all the point_plus handle: for any pair of overlapping points from the input we ensure we have only one handle. - not having such a structure as input_vertices caused a bug.
for (X_curve_plus_list_iterator cv_iter = x_monotone_curves.begin();
cv_iter != x_monotone_curves.end(); cv_iter++){
/*
// now adding to the x-monotone container all the curves
// in the original subdivision.
for (X_curve_list_iterator cv_iter = subdivision_curves.begin();
cv_iter != subdivision_curves.end(); ++cv_iter)
x_monotone_curves.push_back(*cv_iter);*/
Vertices_points_plus input_vertices;
for (Curve_iterator cv_iter = curves_begin;
cv_iter != curves_end; ++cv_iter){
if (input_vertices.find(traits.curve_source(*cv_iter)) ==
input_vertices.end())
input_vertices.insert( Vertices_points_plus_value_type
@ -323,49 +336,43 @@ private:
// end of input_vertices construction.
// now creating the Curve_node handles and the event queue.
unsigned int id = 0;
for(X_curve_plus_list_iterator cv_iter = x_monotone_curves.begin();
cv_iter != x_monotone_curves.end(); cv_iter++, id++){
for(Curve_iterator cv_iter = curves_begin;
cv_iter != curves_end; ++cv_iter){
X_curve cv(*cv_iter);
//Halfedge_const_handle parent = cv_iter->get_parent();
if (is_right(traits.curve_source(*cv_iter),
traits.curve_target(*cv_iter)) )
cv = traits.curve_flip(*cv_iter);
//X_curve cv(*cv_iter);
//if (is_right(traits.curve_source(*cv_iter),
// traits.curve_target(*cv_iter)) )
// cv = traits.curve_flip(*cv_iter);
#ifdef CGAL_SWEEP_LINE_DEBUG
cout<<cv<<std::endl;
#endif
Vertices_points_plus_iterator curr_point_plus =
input_vertices.find( traits.curve_source(cv) );
input_vertices.find( traits.curve_source(*cv_iter) );
//assert(traits.curve_source(cv) == curr_point_plus->second.point());
Event_queue_iterator edge_point =
event_queue.find( traits.curve_source(cv) );
event_queue.find( traits.curve_source(*cv_iter) );
// defining one cv_node for both source and target event points.
//X_curve_plus cv_plus(cv, id); // to satisfy BCC.
Curve_node cv_node = Curve_node(X_curve_plus(cv, cv_iter->get_parent(),
cv_iter->first_map(),
cv_iter->flipped(),
id),
Curve_node cv_node = Curve_node(*cv_iter,
curr_point_plus->second);
Intersection_point_node source_point_node =
Intersection_point_node(cv_node, curr_point_plus->second );
if (edge_point == event_queue.end() ||
edge_point->second.get_point() != source_point_node.get_point())
event_queue.insert(Event_queue_value_type
(traits.curve_source(cv),
(traits.curve_source(*cv_iter),
source_point_node));
else
edge_point->second.merge(source_point_node);
edge_point = event_queue.find( traits.curve_target(cv) );
curr_point_plus = input_vertices.find( traits.curve_target(cv) );
edge_point = event_queue.find( traits.curve_target(*cv_iter) );
curr_point_plus = input_vertices.find( traits.curve_target(*cv_iter) );
//assert(traits.curve_target(cv) == curr_point_plus->second.point());
Intersection_point_node target_point_node =
@ -373,18 +380,18 @@ private:
if (edge_point == event_queue.end() ||
edge_point->second.get_point() != target_point_node.get_point())
event_queue.insert(Event_queue_value_type(traits.curve_target(cv),
event_queue.insert(Event_queue_value_type(traits.curve_target(*cv_iter),
target_point_node));
else
edge_point->second.merge(target_point_node);
}
// now starting the sweeping.
unsigned int queue_size = 0;
bool event_terminated = true;
bool event_overlap_terminated = true;
//bool event_overlap_terminated = true;
while ( !(event_queue.empty()) ){
queue_size++;
++queue_size;
// fetch the next event.
Event_queue_iterator event = event_queue.begin();
@ -403,23 +410,25 @@ private:
// now continue with the sweep line.
event_terminated = handle_one_event (event_queue, status,
event_point, point_node);
// handling overlapping curves.
// On each overlapping group, we remove iteratively each curve and check for new events after the removing.
// when finish, we reinsert to the status all the overlappting removed curves.
for (Curve_node_iterator cv_iter = point_node.curves_begin();
cv_iter != point_node.curves_end(); cv_iter++){
Status_line_iterator curr_cv_node = status.find(*cv_iter);
handle_overlapping_curves(event_queue, status, event_point, point_node);
/*for (Curve_node_iterator cv_iter = point_node.curves_begin();
cv_iter != point_node.curves_end(); ++cv_iter){
//Status_line_iterator curr_cv_node = status.find(*cv_iter);
Status_line_iterator curr_cv_node = std::find(status.begin(), status.end(), *cv_iter);
if (curr_cv_node != status.end()){
if (curr_cv_node != status.begin()){
std::list<Curve_node> overlapping_curves;
Status_line_iterator lower = --curr_cv_node;
curr_cv_node++;
for ( ;curr_cv_node != status.begin() &&
traits.curves_overlap(lower->get_curve(),
curr_cv_node->get_curve());
lower--){
++curr_cv_node;
for ( ;curr_cv_node != status.begin() && traits.curves_overlap(lower->get_curve(),
curr_cv_node->get_curve()); --lower){
Point p1, p2;
traits.nearest_intersection_to_right (curr_cv_node->get_curve(),
@ -444,22 +453,20 @@ private:
status,
curr_cv_node,
event_point))
//if (xp == event_point)
// Edge case of tangency in the event point,
// if it is this event will be taked cared again.
event_overlap_terminated = false;
if (curr_cv_node != status.begin()){
curr_cv_node--;
--curr_cv_node;
if (check_status_neighbors_intersections(event_queue,
status,
curr_cv_node,
event_point))
//if (xp == event_point)
// Edge case of tangency in the event point,
// if it is - this event will be taked cared again.
event_overlap_terminated = false;
curr_cv_node++;
++curr_cv_node;
}
if (curr_cv_node != status.end() &&
@ -472,7 +479,7 @@ private:
// hold the (lower) neighbor element of the current.
if (curr_cv_node != status.begin()){
prev_cv_node = --curr_cv_node;
curr_cv_node++;
++curr_cv_node;
first = false;
}
#ifdef CGAL_SWEEP_LINE_DEBUG
@ -488,32 +495,31 @@ private:
status,
prev_cv_node,
event_point))
//if (xp == event_point)
// Edge case of tangency in the event point, if it is this event will be taked cared again.
event_overlap_terminated = false;
}
}
}
// reinsert to the status line all the overlapping removed curves.
for (list_Curve_node_iterator ovlp_iter =
overlapping_curves.begin();
ovlp_iter != overlapping_curves.end(); ovlp_iter++)
for (list_Curve_node_iterator ovlp_iter = overlapping_curves.begin();
ovlp_iter != overlapping_curves.end(); ++ovlp_iter)
status.insert(Status_line_value_type(*ovlp_iter));
}
}
curr_cv_node = status.find(*cv_iter);
//curr_cv_node = status.find(*cv_iter);
curr_cv_node = std::find(status.begin(), status.end(), *cv_iter);
if (curr_cv_node != status.end()){
std::list<Curve_node> overlapping_curves;
Status_line_iterator upper = ++curr_cv_node;
curr_cv_node--;
--curr_cv_node;
for ( ;upper != status.end() && curr_cv_node != status.end() &&
traits.curves_overlap(curr_cv_node->get_curve(),
upper->get_curve()); upper++){
upper->get_curve()); ++upper){
Point p1, p2;
traits.nearest_intersection_to_right (curr_cv_node->get_curve(),
@ -535,23 +541,21 @@ private:
if (check_status_neighbors_intersections(event_queue, status,
curr_cv_node,
event_point))
//if (xp == event_point)
// Edge case of tangency in the event point,
// if it is this event will be taked cared again.
event_overlap_terminated = false;
if (curr_cv_node != status.begin()){
curr_cv_node--;
--curr_cv_node;
if (check_status_neighbors_intersections(event_queue,
status,
curr_cv_node,
event_point))
//if (xp == event_point)
// Edge case of tangency in the event point,
// if it is - this event will be taked cared again.
event_overlap_terminated = false;
curr_cv_node++;
++curr_cv_node;
}
if (curr_cv_node != status.end() &&
@ -563,7 +567,7 @@ private:
// hold the (lower) neighbor element of the current.
if (curr_cv_node != status.begin()){
prev_cv_node = --curr_cv_node;
curr_cv_node++;
++curr_cv_node;
first = false;
}
#ifdef CGAL_SWEEP_LINE_DEBUG
@ -578,7 +582,6 @@ private:
status,
prev_cv_node,
event_point))
//if (xp == event_point)
// Edge case of tangency in the event point,
// if it is this event will be taked cared again.
event_overlap_terminated = false;
@ -588,10 +591,10 @@ private:
// reinsert to the status line all the overlapping removed curves.
for (list_Curve_node_iterator ovlp_iter =
overlapping_curves.begin();
ovlp_iter != overlapping_curves.end(); ovlp_iter++)
ovlp_iter != overlapping_curves.end(); ++ovlp_iter)
status.insert(Status_line_value_type(*ovlp_iter));
}
}
}*/
if (!event_terminated){
handle_one_event (event_queue, status, event_point, point_node);
@ -603,7 +606,7 @@ private:
#endif
for (Curve_node_iterator cv_iter = point_node.curves_begin();
cv_iter != point_node.curves_end(); cv_iter++){
cv_iter != point_node.curves_end(); ++cv_iter){
if (event_point != traits.curve_source(cv_iter->get_curve()) &&
event_point == cv_iter->get_rightmost_point().point())
cv_iter->erase_rightmost_point();
@ -616,7 +619,7 @@ private:
// updating all the new intersection nodes of the curves
// participating within the event.
for (Curve_node_iterator cv_iter = point_node.curves_begin();
cv_iter != point_node.curves_end(); cv_iter++){
cv_iter != point_node.curves_end(); ++cv_iter){
if (event_point != cv_iter->get_rightmost_point().point())
cv_iter->push_event_point(point_node.get_point());
}
@ -631,10 +634,240 @@ private:
CGAL_expensive_postcondition_code(is_valid(status));
//c_sweep_t = clock() - c_sweep_t;
//std::cout<<"The time required by sweep proccess: "<< (double) c_sweep_t / (double) CLOCKS_PER_SEC<<std::endl;
c_sweep_t = clock() - c_sweep_t;
std::cout<<"The time required by sweep proccess: "<< (double) c_sweep_t / (double) CLOCKS_PER_SEC<<std::endl;
}
// void sweep_curves_to_planar_map(Curve_iterator curves_begin,
// Curve_iterator curves_end,
// Map_overlay_change_notification *pm_change_notf,
// PM &result)
// {
// Traits traits;
// Event_queue event_queue;
// Status_line status;
// Vertices_points_plus input_vertices;
// #ifdef CGAL_SWEEP_LINE_DEBUG
// unsigned int n = 0;
// for (Curve_iterator cv_iter = curves_begin;
// cv_iter != curves_end; ++cv_iter, ++n);
// cout<<"number of edges on input "<< n <<std::endl;
// #endif
// /*
// // first handling the case of which results is not empty: since we are sweeping the curves we have to take all
// //the curves of result and 'paste' it to the input curves, then we have to clear result.
// X_curve_plus_list subdivision_curves;
// for (Halfedge_iterator h_iter = result.halfedges_begin();
// h_iter != result.halfedges_end(); h_iter++, h_iter++)
// subdivision_curves.push_back(h_iter->curve());
// result.clear();
// // Now, creating all the point_plus handle: for any pair of overlapping points from the input we ensure we have only one handle. - not having such a structure as input_vertices caused a bug.
// Vertices_points_plus input_vertices;
// for (X_curve_list_iterator cv_iter = subdivision_curves.begin();
// cv_iter != subdivision_curves.end(); cv_iter++){
// if (input_vertices.find(traits.curve_source(*cv_iter)) ==
// input_vertices.end())
// input_vertices.insert(Vertices_points_plus_value_type(traits.curve_source(*cv_iter),
// Point_plus(traits.curve_source(*cv_iter))) );
// if (input_vertices.find(traits.curve_target(*cv_iter)) ==
// input_vertices.end())
// input_vertices.insert(Vertices_points_plus_value_type
// (traits.curve_target(*cv_iter),
// Point_plus(traits.curve_target(*cv_iter))) );
// }*/
// // splitting all curves to x-monotone curves.
// X_curve_plus_list x_monotone_curves;
// for (Curve_iterator cv_iter = curves_begin;
// cv_iter != curves_end; ++cv_iter){
// /*if (!traits.is_x_monotone(*cv_iter)) {
// X_curve_list x_monotone_subcurves;
// traits.make_x_monotone(*cv_iter, x_monotone_subcurves);
// #ifdef CGAL_SWEEP_LINE_DEBUG
// std::cout<<"printing x-monotone parts"<<std::endl;
// #endif
// for(X_curve_list_iterator iter = x_monotone_subcurves.begin();
// iter != x_monotone_subcurves.end(); iter++){
// #ifdef CGAL_SWEEP_LINE_DEBUG
// std::cout<<*iter<<endl;
// #endif
// x_monotone_curves.push_back(X_curve_plus(*iter, cv_iter->parent(), cv_iter->first_map(), cv_iter->id()));
// }
// }
// else*/
// x_monotone_curves.push_back(*cv_iter);
// }
// /*
// // now adding to the x-monotone container all the curves
// // in the original subdivision.
// for (X_curve_plus_list_iterator cv_iter = subdivision_curves.begin();
// cv_iter != subdivision_curves.end(); cv_iter++)
// x_monotone_curves.push_back(*cv_iter);*/
// // Now, creating all the point_plus handle: for any pair of overlapping points
// // from the input we ensure we have only one handle. - not having such
// // a structure as input_vertices caused a bug.
// for (X_curve_plus_list_iterator cv_iter = x_monotone_curves.begin();
// cv_iter != x_monotone_curves.end(); ++cv_iter){
// if (input_vertices.find(traits.curve_source(*cv_iter)) ==
// input_vertices.end())
// input_vertices.insert( Vertices_points_plus_value_type
// (traits.curve_source(*cv_iter),
// Point_plus(traits.curve_source(*cv_iter))) );
// if (input_vertices.find(traits.curve_target(*cv_iter)) ==
// input_vertices.end())
// input_vertices.insert( Vertices_points_plus_value_type
// (traits.curve_target(*cv_iter),
// Point_plus(traits.curve_target(*cv_iter))) );
// }
// // end of input_vertices construction.
// // now creating the Curve_node handles and the event queue.
// unsigned int id = 0;
// for(X_curve_plus_list_iterator cv_iter = x_monotone_curves.begin();
// cv_iter != x_monotone_curves.end(); ++cv_iter, ++id){
// X_curve cv(*cv_iter);
// //Halfedge_const_handle parent = cv_iter->get_parent();
// if (is_right(traits.curve_source(*cv_iter),
// traits.curve_target(*cv_iter)) )
// cv = traits.curve_flip(*cv_iter);
// #ifdef CGAL_SWEEP_LINE_DEBUG
// cout<<cv<<std::endl;
// #endif
// Vertices_points_plus_iterator curr_point_plus =
// input_vertices.find( traits.curve_source(cv) );
// //assert(traits.curve_source(cv) == curr_point_plus->second.point());
// Event_queue_iterator edge_point =
// event_queue.find( traits.curve_source(cv) );
// // defining one cv_node for both source and target event points.
// //X_curve_plus cv_plus(cv, id); // to satisfy BCC.
// Curve_node cv_node = Curve_node(X_curve_plus(cv, cv_iter->get_parent(),
// cv_iter->first_map(),
// cv_iter->flipped(),
// id),
// curr_point_plus->second);
// Intersection_point_node source_point_node =
// Intersection_point_node(cv_node, curr_point_plus->second );
// if (edge_point == event_queue.end() ||
// edge_point->second.get_point() != source_point_node.get_point())
// event_queue.insert(Event_queue_value_type
// (traits.curve_source(cv),
// source_point_node));
// else
// edge_point->second.merge(source_point_node);
// edge_point = event_queue.find( traits.curve_target(cv) );
// curr_point_plus = input_vertices.find( traits.curve_target(cv) );
// //assert(traits.curve_target(cv) == curr_point_plus->second.point());
// Intersection_point_node target_point_node =
// Intersection_point_node(cv_node, curr_point_plus->second );
// if (edge_point == event_queue.end() ||
// edge_point->second.get_point() != target_point_node.get_point())
// event_queue.insert(Event_queue_value_type(traits.curve_target(cv),
// target_point_node));
// else
// edge_point->second.merge(target_point_node);
// }
// int c_sweep_t;
// c_sweep_t = clock();
// // now starting the sweeping.
// unsigned int queue_size = 0;
// bool event_terminated = true;
// //bool event_overlap_terminated = true;
// while ( !(event_queue.empty()) ){
// queue_size++;
// // fetch the next event.
// Event_queue_iterator event = event_queue.begin();
// const Point& event_point = event->first;
// Intersection_point_node& point_node = event->second;
// //bool event_terminated = true;
// #ifdef CGAL_SWEEP_LINE_DEBUG
// cout<<"* * * event point is "<<event_point<<
// " and point node is "<<point_node.get_point().point()<<std::endl;
// CGAL_assertion(event_point == point_node.get_point().point());
// #endif
// event_terminated = true; // reinitializing event_terminated to true only after the updating of the subdivision.
// // now continue with the sweep line.
// event_terminated = handle_one_event (event_queue, status,
// event_point, point_node);
// // handling overlapping curves.
// // On each overlapping group, we remove iteratively each curve and
// // check for new events after the removing.
// // when finish, we reinsert to the status all the overlappting removed curves.
// handle_overlapping_curves(event_queue, status, event_point, point_node);
// if (!event_terminated){
// handle_one_event (event_queue, status, event_point, point_node);
// }
// #ifdef CGAL_SWEEP_LINE_DEBUG
// cout<<"Printing status line "<<std::endl;
// print_status(status);
// #endif
// for (Curve_node_iterator cv_iter = point_node.curves_begin();
// cv_iter != point_node.curves_end(); ++cv_iter){
// if (event_point != traits.curve_source(cv_iter->get_curve()) &&
// event_point == cv_iter->get_rightmost_point().point())
// cv_iter->erase_rightmost_point();
// }
// // now, updating the planar map (or arrangement) according the curves
// // enemating from the currnet event point.
// update_subdivision(point_node, pm_change_notf, result);
// // updating all the new intersection nodes of the curves
// // participating within the event.
// for (Curve_node_iterator cv_iter = point_node.curves_begin();
// cv_iter != point_node.curves_end(); ++cv_iter){
// if (event_point != cv_iter->get_rightmost_point().point())
// cv_iter->push_event_point(point_node.get_point());
// }
// //if (event_terminated)
// event_queue.erase(event);
// }
// #ifdef CGAL_SWEEP_LINE_DEBUG
// std::cout<<"the number of events was "<<queue_size<<std::endl;
// #endif
// CGAL_expensive_postcondition_code(is_valid(status));
// c_sweep_t = clock() - c_sweep_t;
// std::cout<<"The time required by sweep proccess: "<< (double) c_sweep_t / (double) CLOCKS_PER_SEC<<std::endl;
// }
/* bool check_status_neighbors_intersections(Event_queue &event_queue, Status_line& status, Status_line::iterator lower_neighbor, Point& point)
{
@ -747,7 +980,7 @@ private:
X_curve prev_sub_cv;
for (Curve_node_iterator cv_iter = point_node.curves_begin();
cv_iter != point_node.curves_end(); cv_iter++){
cv_iter != point_node.curves_end(); ++cv_iter){
#ifdef CGAL_SWEEP_LINE_DEBUG
cout<<"now handling "<<cv_iter->get_curve()<<endl;
#endif
@ -805,17 +1038,17 @@ private:
//cout<<sub_cv<<endl;
}
/*pm_change_notf->set_curve_attributes(sub_cv,
cv_iter->get_curve().get_parent(),
//cv_iter->get_curve().get_parent()->twin(),
cv_iter->get_curve().first_map());*/
pm_change_notf->set_curve_attributes(sub_cv,
cv_iter->get_curve().get_parent(),
cv_iter->get_curve().first_map());
// trying to define a local notifier instead.
Map_overlay_change_notification notf;
notf.set_curve_attributes(sub_cv,
cv_iter->get_curve().get_parent(),
cv_iter->get_curve().first_map(),
cv_iter->get_curve().flipped());
//Map_overlay_change_notification notf;
//notf.set_curve_attributes(sub_cv,
// cv_iter->get_curve().get_parent(),
// cv_iter->get_curve().first_map()
// cv_iter->get_curve().flipped());
prev_sub_cv = sub_cv;
if (cv_iter->get_rightmost_point().vertex() != Vertex_handle(NULL)){
@ -830,24 +1063,24 @@ private:
h = arr.insert_at_vertices(sub_cv,
point_node.get_point().vertex(),
cv_iter->get_rightmost_point().vertex(),
&notf);
pm_change_notf);
else
h = arr.insert_at_vertices(sub_cv,
cv_iter->get_rightmost_point().vertex(),
point_node.get_point().vertex(),
&notf);
pm_change_notf);
}
else {
if (cv_iter->get_curve().flipped())
h = arr.insert_from_vertex (sub_cv,
cv_iter->get_rightmost_point().vertex(),
false,
&notf);
pm_change_notf);
else
h = arr.insert_from_vertex (sub_cv,
cv_iter->get_rightmost_point().vertex(),
true,
&notf);
pm_change_notf);
}
}
else if (point_node.get_point().vertex() != Vertex_handle(NULL)) {
@ -857,17 +1090,17 @@ private:
h = arr.insert_from_vertex (sub_cv,
point_node.get_point().vertex(),
true,
&notf);
pm_change_notf);
else
h = arr.insert_from_vertex (sub_cv,
point_node.get_point().vertex(),
false,
&notf);
pm_change_notf);
}
else{
h = arr.insert_in_face_interior (sub_cv,
arr.unbounded_face(),
&notf);
pm_change_notf);
// the point is that if the curve has no source to start the insertion from, it has to be inserted to the unbounded face, because all the curves to the right of it have not inserted yet, and in that stage of the sweep line, the curve is on the unbounded face - later on it will be updated automatically by the Planar map (Arrangement) insert functions.
}