diff --git a/Mesh_3/include/CGAL/Mesh_3/C3T3_helpers.h b/Mesh_3/include/CGAL/Mesh_3/C3T3_helpers.h index 7ca91ab90f4..97b53b6f4a8 100644 --- a/Mesh_3/include/CGAL/Mesh_3/C3T3_helpers.h +++ b/Mesh_3/include/CGAL/Mesh_3/C3T3_helpers.h @@ -79,7 +79,7 @@ public: #ifdef CGAL_CONSTRUCT_INTRUSIVE_LIST_RANGE_CONSTRUCTOR template Intrusive_list(IT first, IT last) - : f(), b(), n(0) + : f(), b(), n(0) { if(first == last){ return; @@ -89,7 +89,7 @@ public: Type_handle ch = f; ++n; ++first; - while(first != last){ + while(first != last){ if((ch != Type(*first)) && ((*first)->next_intrusive()==Type_handle())){ // not yet inserted ch->set_next_intrusive(*first); @@ -194,9 +194,9 @@ public: if(pos != Type_handle()){ if(pos == b){ pos = Type_handle(); // past the end - }else { + }else { pos = pos->next_intrusive(); - } + } } return *this; } @@ -669,7 +669,7 @@ private: Facet mirror = tr_.mirror_facet(facet); return ( (mirrorneighbor(i); + Cell_handle n = c->neighbor(i); if(c < n){ return Facet(c,i); }else{ @@ -2031,6 +2031,7 @@ rebuild_restricted_delaunay(OutdatedCells& outdated_cells, it != vertex_to_proj.end() ; ++it ) { + std::cout << "vp " << (*it)->ts << "\t" << (*it)->point() << std::endl; Point_3 new_pos = project_on_surface((*it)->point(),*it); if ( new_pos != Point_3() ) @@ -2479,6 +2480,27 @@ get_least_square_surface_plane(const Vertex_handle& v, const int& i = fit->second; surface_point_vector.push_back(cell->get_facet_surface_center(i)); + /* + if(cell->ts == 658591 || cell->ts == 658596) + { + for( typename Facet_vector::iterator fit2 = facets.begin() ; + fit2 != facets.end() ; + ++fit2 ) + { + Cell_handle c = fit2->first; + int ii = fit2->second; + std::cout << " f "<< ii << " " << c->ts + <<": " << c->get_facet_surface_center(ii) + << std::endl; + Facet mf = tr_.mirror_facet(*fit2); + c = mf.first; + ii = mf.second; + std::cout << " fn "<< ii << " " << c->ts + <<": " << c->get_facet_surface_center(ii) + << std::endl; + } + } +*/ } } @@ -2704,7 +2726,7 @@ fill_modified_vertices(InputIterator cells_begin, { for ( int i=0 ; i<4 ; ++i ) { - // Insert vertices if not already inserted + // Insert vertices if not already inserted const Vertex_handle& current_vertex = (*it)->vertex(i); if ( !tr_.is_infinite(current_vertex) && already_inserted_vertices.insert(current_vertex).second ) diff --git a/Mesh_3/include/CGAL/Mesh_3/Mesh_global_optimizer.h b/Mesh_3/include/CGAL/Mesh_3/Mesh_global_optimizer.h index d8c321a8d42..6ad4a5f93d7 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Mesh_global_optimizer.h +++ b/Mesh_3/include/CGAL/Mesh_3/Mesh_global_optimizer.h @@ -292,15 +292,19 @@ operator()(int nb_iterations, Visitor visitor) int i = -1; while ( ++i < nb_iterations && ! is_time_limit_reached() ) { + std::cout << "ODT iteration " << i << std::endl; if(!do_freeze_) nb_frozen_points_ = 0; else nb_vertices_moved = moving_vertices.size(); + // Compute move for each vertex Moves_vector moves = compute_moves(moving_vertices); visitor.after_compute_moves(); + incident(c3t3_); + //Pb with Freeze : sometimes a few vertices continue moving indefinitely //if the nb of moving vertices is < 1% of total nb AND does not decrease if(do_freeze_ @@ -318,6 +322,7 @@ operator()(int nb_iterations, Visitor visitor) break; // Update mesh with those moves + update_mesh(moves, moving_vertices, visitor); visitor.end_of_iteration(i); @@ -452,13 +457,17 @@ compute_move(const Vertex_handle& v) // Get move from move function Vector_3 move = move_function_(v, incident_cells, c3t3_, sizing_field_); - + // Project surface vertex if ( c3t3_.in_dimension(v) == 2 ) { Point_3 new_position = translate(v->point(),move); move = vector(v->point(), helper_.project_on_surface(new_position,v)); } + //std::cout << "mv " << v->point() + // << "\t to " << translate(v->point(),move) + // << "\t(ts = "<< v->ts <<")" + // << "\t(d = "<< c3t3_.in_dimension(v) <<")" << std::endl; FT local_sq_size = min_circumradius_sq_length(v, incident_cells); if ( FT(0) == local_sq_size )