diff --git a/Linear_cell_complex/demo/Linear_cell_complex/MainWindow.ui b/Linear_cell_complex/demo/Linear_cell_complex/MainWindow.ui index d63b9d7c9b1..6a9f06c68d2 100644 --- a/Linear_cell_complex/demo/Linear_cell_complex/MainWindow.ui +++ b/Linear_cell_complex/demo/Linear_cell_complex/MainWindow.ui @@ -38,7 +38,7 @@ - &File + File @@ -55,7 +55,7 @@ - &Operations + Operations @@ -75,7 +75,7 @@ - &Creations + Creations @@ -88,7 +88,7 @@ - &View + View @@ -103,67 +103,67 @@ - &Import OFF + Import OFF - &Quit + Quit - &Subdivide all volumes + Subdivide all volumes - &Subdivide all volumes - by Pqq + Subdivide all volumes - by Pqq - Create &3 cubes + Create 3 cubes - Import 3D&TS + Import 3DTS - &Clear + Clear - Create &2 volumes + Create 2 volumes - &Dual + Dual - &Close all volumes + Close all volumes - Create &cube + Create cube - S&ew3 all same facets + Sew3 all same facets - Create &mesh + Create mesh @@ -173,22 +173,22 @@ - &Remove volumes + Remove volumes - &Triangulate facets + Triangulate facets - &Unsew3 volumes + Unsew3 volumes - Reverse &orientation + Reverse orientation @@ -201,12 +201,12 @@ - Extend &filled volumes + Extend filled volumes - Extend &hidden volumes + Extend hidden volumes @@ -216,7 +216,7 @@ - &Merge volumes + Merge volumes @@ -231,12 +231,12 @@ - &Load + Load - &Save + Save diff --git a/Linear_cell_complex/demo/Linear_cell_complex/Viewer.cpp b/Linear_cell_complex/demo/Linear_cell_complex/Viewer.cpp index a773ebdb3f1..6a7ba68de51 100644 --- a/Linear_cell_complex/demo/Linear_cell_complex/Viewer.cpp +++ b/Linear_cell_complex/demo/Linear_cell_complex/Viewer.cpp @@ -19,17 +19,32 @@ Viewer::Viewer(QWidget *parent) : Base(parent, m_graphic_buffer, ""), m_previous_scene_empty(true) { - m_drawing_functor.volume_color=[](const LCC & alcc, - Dart_const_handle dh)->CGAL::IO::Color - { return alcc.template info<3>(dh).color(); }; + m_drawing_functor.face_color=[](const LCC & alcc, + Dart_const_descriptor dh)->CGAL::IO::Color + { + if(alcc.template is_free<3>(dh)) + { return alcc.template info<3>(dh).color(); } - m_drawing_functor.colored_volume=[](const LCC &, Dart_const_handle)->bool + if(!alcc.template info<3>(dh).is_visible() || + !alcc.template info<3>(dh).is_filled()) + { return alcc.template info<3>(alcc.template beta<3>(dh)).color(); } + + if(!alcc.template info<3>(alcc.template beta<3>(dh)).is_visible() || + !alcc.template info<3>(alcc.template beta<3>(dh)).is_filled()) + { return alcc.template info<3>(dh).color(); } + + const CGAL::IO::Color& c1=alcc.template info<3>(dh).color(); + const CGAL::IO::Color& c2=alcc.template info<3>(alcc.template beta<3>(dh)).color(); + return CGAL::IO::Color((c1[0]+c2[0])/2, (c1[1]+c2[1])/2, (c1[2]+c2[2])/2); + }; + + m_drawing_functor.colored_face=[](const LCC &, Dart_const_descriptor)->bool { return true; }; - m_drawing_functor.draw_volume=[](const LCC & alcc, Dart_const_handle dh)->bool + m_drawing_functor.draw_volume=[](const LCC & alcc, Dart_const_descriptor dh)->bool { return alcc.template info<3>(dh).is_visible(); }; - m_drawing_functor.volume_wireframe=[](const LCC& alcc, Dart_const_handle dh)->bool + m_drawing_functor.volume_wireframe=[](const LCC& alcc, Dart_const_descriptor dh)->bool { return !(alcc.template info<3>(dh).is_filled()); }; } @@ -69,4 +84,5 @@ void Viewer::keyPressEvent(QKeyEvent *e) Base::keyPressEvent(e); } -QString Viewer::helpString() const { return Base::helpString("LCC Demo"); } +QString Viewer::helpString() const +{ return Base::helpString("LCC Demo"); } diff --git a/Linear_cell_complex/demo/Linear_cell_complex/Viewer.h b/Linear_cell_complex/demo/Linear_cell_complex/Viewer.h index 3b782fe09a8..c72feee6f32 100644 --- a/Linear_cell_complex/demo/Linear_cell_complex/Viewer.h +++ b/Linear_cell_complex/demo/Linear_cell_complex/Viewer.h @@ -35,10 +35,10 @@ public Q_SLOTS: private: CGAL::Drawing_functor_with_volume m_drawing_functor; + Dart_const_descriptor, + Dart_const_descriptor, + Dart_const_descriptor, + Dart_const_descriptor> m_drawing_functor; CGAL::Graphic_buffer m_graphic_buffer; Scene* scene; bool m_previous_scene_empty; diff --git a/Linear_cell_complex/include/CGAL/draw_linear_cell_complex.h b/Linear_cell_complex/include/CGAL/draw_linear_cell_complex.h index d3718681031..add255dfa6e 100644 --- a/Linear_cell_complex/include/CGAL/draw_linear_cell_complex.h +++ b/Linear_cell_complex/include/CGAL/draw_linear_cell_complex.h @@ -111,7 +111,7 @@ void compute_edge(typename LCC::Dart_const_handle dh, const LCC *lcc, const typename LCC::Point& p1=lcc->point(dh); typename LCC::Dart_const_handle d2=lcc->other_extremity(dh); - if (d2!=nullptr) + if (d2!=LCC::null_descriptor) { if (m_drawing_functor.colored_edge(*lcc, dh)) { @@ -173,7 +173,9 @@ void compute_elements(const LCC *lcc, lcc->is_marked(itv, oriented_mark) && m_drawing_functor.draw_face(*lcc, itv)) { - if (!m_drawing_functor.volume_wireframe(*lcc, itv) && + if ((!m_drawing_functor.volume_wireframe(*lcc, itv) || + (!lcc->template is_free<3>(itv) && + !m_drawing_functor.volume_wireframe(*lcc, lcc->template beta<3>(itv)))) && !m_drawing_functor.face_wireframe(*lcc, itv)) { compute_face(itv, it, lcc, m_drawing_functor, graphic_buffer); } for(typename LCC::template Dart_of_cell_basic_range<2>::const_iterator @@ -240,7 +242,8 @@ void add_in_graphic_buffer(const CGAL_LCC_TYPE &alcc, CGAL::Graphic_buffer &graphic_buffer, const DrawingFunctor &m_drawing_functor) { - draw_function_for_lcc::compute_elements(&alcc, graphic_buffer, m_drawing_functor); + draw_function_for_lcc::compute_elements(static_cast(&alcc), + graphic_buffer, m_drawing_functor); } // add_in_graphic_buffer: to add a LCC in the given graphic buffer, without a