From cc3a635047964e71fcb290ffb70fdbac178b2fba Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Mon, 29 May 2017 15:31:38 +0200 Subject: [PATCH 01/12] Don't compute points data but use lines instead. --- .../Scene_points_with_normal_item.cpp | 191 +++++++++--------- 1 file changed, 95 insertions(+), 96 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Scene_points_with_normal_item.cpp b/Polyhedron/demo/Polyhedron/Scene_points_with_normal_item.cpp index 44907e87656..4b1467d8b7e 100644 --- a/Polyhedron/demo/Polyhedron/Scene_points_with_normal_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_points_with_normal_item.cpp @@ -118,8 +118,6 @@ struct Scene_points_with_normal_item_priv QSlider* point_Slider; mutable bool is_point_slider_moving; mutable std::vector positions_lines; - mutable std::vector positions_points; - mutable std::vector positions_selected_points; mutable std::vector normals; mutable std::vector positions_normals; mutable std::vector positions_selected_normals; @@ -184,6 +182,7 @@ void Scene_points_with_normal_item_priv::initializeBuffers(CGAL::Three::Viewer_i { compute_normals_and_vertices(); //vao for the edges + if(item->has_normals()) { program = item->getShaderProgram(Scene_points_with_normal_item::PROGRAM_NO_SELECTION, viewer); program->bind(); @@ -207,9 +206,8 @@ void Scene_points_with_normal_item_priv::initializeBuffers(CGAL::Three::Viewer_i } item->vaos[Edges]->release(); + nb_lines = positions_lines.size(); - positions_lines.resize(0); - std::vector(positions_lines).swap(positions_lines); program->release(); } //vao for the points @@ -221,12 +219,18 @@ void Scene_points_with_normal_item_priv::initializeBuffers(CGAL::Three::Viewer_i program->bind(); item->vaos[ThePoints]->bind(); - item->buffers[Points_vertices].bind(); - item->buffers[Points_vertices].allocate(positions_points.data(), - static_cast(positions_points.size()*sizeof(CGAL_data_type))); + item->buffers[Edges_vertices].bind(); + if(!item->has_normals()) { + item->buffers[Edges_vertices].allocate(positions_lines.data(), + static_cast(positions_lines.size()*sizeof(CGAL_data_type))); + } program->enableAttributeArray("vertex"); - program->setAttributeBuffer("vertex",CGAL_GL_data_type,0,3); - item->buffers[Points_vertices].release(); + if(item->has_normals()) + program->setAttributeBuffer("vertex",CGAL_GL_data_type,0,3, + static_cast(6*sizeof(CGAL_GL_data_type))); + else + program->setAttributeBuffer("vertex",CGAL_GL_data_type,0,3); + item->buffers[Edges_vertices].release(); if(item->has_normals() && !(m_points->has_colors())) { @@ -252,9 +256,10 @@ void Scene_points_with_normal_item_priv::initializeBuffers(CGAL::Three::Viewer_i } item->vaos[ThePoints]->release(); - nb_points = positions_points.size(); - positions_points.resize(0); - std::vector(positions_points).swap(positions_points); + if(item->has_normals()) + nb_points = positions_lines.size()/2; + else + nb_points = positions_lines.size(); program->release(); } //vao for the selected points @@ -265,12 +270,23 @@ void Scene_points_with_normal_item_priv::initializeBuffers(CGAL::Three::Viewer_i program = item->getShaderProgram(Scene_points_with_normal_item::PROGRAM_NO_SELECTION, viewer); program->bind(); item->vaos[Selected_points]->bind(); - item->buffers[Selected_points_vertices].bind(); - item->buffers[Selected_points_vertices].allocate(positions_selected_points.data(), - static_cast(positions_selected_points.size()*sizeof(CGAL_data_type))); + item->buffers[Edges_vertices].bind(); program->enableAttributeArray("vertex"); - program->setAttributeBuffer("vertex",CGAL_GL_data_type,0,3); - item->buffers[Selected_points_vertices].release(); + if(!item->has_normals()) + { + program->setAttributeBuffer("vertex",CGAL_GL_data_type, + static_cast( 3*(m_points->size()-m_points->nb_selected_points())*sizeof(CGAL_data_type) ), + 3, + 0); + } + else + { + program->setAttributeBuffer("vertex",CGAL_GL_data_type, + static_cast( 6*(m_points->size()-m_points->nb_selected_points())*sizeof(CGAL_data_type) ), + 3, + static_cast(6*sizeof(CGAL_GL_data_type))); + } + item->buffers[Edges_vertices].release(); if(item->has_normals()) { @@ -284,11 +300,11 @@ void Scene_points_with_normal_item_priv::initializeBuffers(CGAL::Three::Viewer_i std::vector(positions_selected_normals).swap(positions_selected_normals); } item->vaos[Selected_points]->release(); - nb_selected_points = positions_selected_points.size(); - positions_selected_points.resize(0); - std::vector(positions_selected_points).swap(positions_selected_points); + nb_selected_points = 3*m_points->nb_selected_points(); program->release(); } + positions_lines.resize(0); + positions_lines.shrink_to_fit(); item->are_buffers_filled = true; } @@ -296,103 +312,86 @@ void Scene_points_with_normal_item_priv::compute_normals_and_vertices() const { const qglviewer::Vec offset = static_cast(QGLViewer::QGLViewerPool().first())->offset(); QApplication::setOverrideCursor(Qt::WaitCursor); - positions_points.resize(0); positions_lines.resize(0); - positions_selected_points.resize(0); normals.resize(0); positions_normals.resize(0); positions_selected_normals.resize(0); normals.resize(0); colors_points.resize(0); - positions_points.reserve(m_points->size() * 3); - positions_lines.reserve(m_points->size() * 3 * 2); - //Shuffle container to allow quick display random points std::random_shuffle (m_points->begin(), m_points->first_selected()); if (m_points->nb_selected_points() != 0) std::random_shuffle (m_points->first_selected(), m_points->end()); - - - //The points - { - // The *non-selected* points - for (Point_set::const_iterator it = m_points->begin(); - it != m_points->first_selected(); ++ it) - { - positions_points.push_back(m_points->point(*it).x()+offset.x); - positions_points.push_back(m_points->point(*it).y()+offset.y); - positions_points.push_back(m_points->point(*it).z()+offset.z); - } - - // Draw *selected* points - for (Point_set::const_iterator it = m_points->first_selected(); - it != m_points->end(); ++ it) - { - positions_selected_points.push_back(m_points->point(*it).x()+offset.x); - positions_selected_points.push_back(m_points->point(*it).y()+offset.y); - positions_selected_points.push_back(m_points->point(*it).z()+offset.z); - } - } - - //The lines + //if item has normals, points will be one point out of two in the lines data. + //else points will be lines and lines discarded. + double average_spacing = 0; + double normal_length =0; + double length_factor =0; if (item->has_normals()) { - positions_lines.reserve(m_points->size() * 6); - positions_normals.reserve((m_points->size() - m_points->nb_selected_points()) * 3); - positions_selected_normals.reserve(m_points->nb_selected_points() * 3); - - // Store normals - Kernel::Sphere_3 region_of_interest = m_points->region_of_interest(); #ifdef LINK_WITH_TBB - typedef CGAL::Parallel_tag Concurrency_tag; + typedef CGAL::Parallel_tag Concurrency_tag; #else - typedef CGAL::Sequential_tag Concurrency_tag; + typedef CGAL::Sequential_tag Concurrency_tag; #endif - - double average_spacing = CGAL::compute_average_spacing( - m_points->begin(), m_points->end(), m_points->point_map(), - 6); - - double normal_length = (std::min)(average_spacing, std::sqrt(region_of_interest.squared_radius() / 1000.)); - double length_factor = 5.0/100*normal_Slider->value(); - for (Point_set_3::const_iterator it = m_points->begin(); it != m_points->first_selected(); ++it) - { - const Kernel::Point_3& p = m_points->point(*it); - const Kernel::Vector_3& n = m_points->normal(*it); - Point_set_3::Point q = p + normal_length * length_factor* n; - positions_lines.push_back(p.x()+offset.x); - positions_lines.push_back(p.y()+offset.y); - positions_lines.push_back(p.z()+offset.z); - - positions_lines.push_back(q.x()+offset.x); - positions_lines.push_back(q.y()+offset.y); - positions_lines.push_back(q.z()+offset.z); + // Store normals + Kernel::Sphere_3 region_of_interest = m_points->region_of_interest(); + positions_lines.reserve(m_points->size() * 6); + positions_normals.reserve((m_points->size() - m_points->nb_selected_points()) * 3); + positions_selected_normals.reserve(m_points->nb_selected_points() * 3); + average_spacing = CGAL::compute_average_spacing( + m_points->begin(), m_points->end(), m_points->point_map(), + 6); + normal_length = (std::min)(average_spacing, std::sqrt(region_of_interest.squared_radius() / 1000.)); + length_factor = 5.0/100*normal_Slider->value(); + } + else + { + positions_lines.reserve(m_points->size() * 3); + } - positions_normals.push_back(n.x()); - positions_normals.push_back(n.y()); - positions_normals.push_back(n.z()); - } - for (Point_set_3::const_iterator it = m_points->first_selected(); it != m_points->end(); ++it) - { - const Kernel::Point_3& p = m_points->point(*it); - const Kernel::Vector_3& n = m_points->normal(*it); - Point_set_3::Point q = p + normal_length * length_factor* n; - positions_lines.push_back(p.x()+offset.x); - positions_lines.push_back(p.y()+offset.y); - positions_lines.push_back(p.z()+offset.z); - - positions_lines.push_back(q.x()+offset.x); - positions_lines.push_back(q.y()+offset.y); - positions_lines.push_back(q.z()+offset.z); + for (Point_set_3::const_iterator it = m_points->begin(); it != m_points->first_selected(); ++it) + { + const Kernel::Point_3& p = m_points->point(*it); + positions_lines.push_back(p.x()+offset.x); + positions_lines.push_back(p.y()+offset.y); + positions_lines.push_back(p.z()+offset.z); + if(item->has_normals()) + { + const Kernel::Vector_3& n = m_points->normal(*it); + Point_set_3::Point q = p + normal_length * length_factor* n; + positions_lines.push_back(q.x()+offset.x); + positions_lines.push_back(q.y()+offset.y); + positions_lines.push_back(q.z()+offset.z); - positions_selected_normals.push_back(n.x()); - positions_selected_normals.push_back(n.y()); - positions_selected_normals.push_back(n.z()); - } + positions_normals.push_back(n.x()); + positions_normals.push_back(n.y()); + positions_normals.push_back(n.z()); + } + } + for (Point_set_3::const_iterator it = m_points->first_selected(); it != m_points->end(); ++it) + { + const Kernel::Point_3& p = m_points->point(*it); + positions_lines.push_back(p.x()+offset.x); + positions_lines.push_back(p.y()+offset.y); + positions_lines.push_back(p.z()+offset.z); + if(item->has_normals()) + { + const Kernel::Vector_3& n = m_points->normal(*it); + Point_set_3::Point q = p + normal_length * length_factor* n; + positions_lines.push_back(q.x()+offset.x); + positions_lines.push_back(q.y()+offset.y); + positions_lines.push_back(q.z()+offset.z); + + + positions_selected_normals.push_back(n.x()); + positions_selected_normals.push_back(n.y()); + positions_selected_normals.push_back(n.z()); + } } //The colors if (m_points->has_colors()) From 134a3050c979d3dca48bec1cf09e5e1e5e8a7116 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Tue, 30 May 2017 12:06:35 +0200 Subject: [PATCH 02/12] Fix vaos feeding to programs in case there are normals in the point set. --- .../Scene_points_with_normal_item.cpp | 146 +++++++++++------- 1 file changed, 90 insertions(+), 56 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Scene_points_with_normal_item.cpp b/Polyhedron/demo/Polyhedron/Scene_points_with_normal_item.cpp index 4b1467d8b7e..f5bd4bce7f1 100644 --- a/Polyhedron/demo/Polyhedron/Scene_points_with_normal_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_points_with_normal_item.cpp @@ -98,7 +98,9 @@ struct Scene_points_with_normal_item_priv enum VAOs { Edges=0, ThePoints, + TheShadedPoints, Selected_points, + Selected_shaded_points, NbOfVaos }; enum VBOs { @@ -212,10 +214,7 @@ void Scene_points_with_normal_item_priv::initializeBuffers(CGAL::Three::Viewer_i } //vao for the points { - if(item->has_normals() && !(m_points->has_colors())) - program = item->getShaderProgram(Scene_points_with_normal_item::PROGRAM_WITH_LIGHT, viewer); - else - program = item->getShaderProgram(Scene_points_with_normal_item::PROGRAM_NO_SELECTION, viewer); + program = item->getShaderProgram(Scene_points_with_normal_item::PROGRAM_NO_SELECTION, viewer); program->bind(); item->vaos[ThePoints]->bind(); @@ -231,18 +230,6 @@ void Scene_points_with_normal_item_priv::initializeBuffers(CGAL::Three::Viewer_i else program->setAttributeBuffer("vertex",CGAL_GL_data_type,0,3); item->buffers[Edges_vertices].release(); - - if(item->has_normals() && !(m_points->has_colors())) - { - item->buffers[Points_normals].bind(); - item->buffers[Points_normals].allocate(positions_normals.data(), - static_cast(positions_normals.size()*sizeof(CGAL_data_type))); - program->enableAttributeArray("normals"); - program->setAttributeBuffer("normals",CGAL_GL_data_type,0,3); - item->buffers[Points_normals].release(); - positions_normals.resize(0); - std::vector(positions_normals).swap(positions_normals); - } if (!(colors_points.empty())) { item->buffers[Points_colors].bind(); @@ -256,52 +243,85 @@ void Scene_points_with_normal_item_priv::initializeBuffers(CGAL::Three::Viewer_i } item->vaos[ThePoints]->release(); + program->release(); + if(item->has_normals()) + { + program = item->getShaderProgram(Scene_points_with_normal_item::PROGRAM_WITH_LIGHT, viewer); + item->vaos[TheShadedPoints]->bind(); + item->buffers[Edges_vertices].bind(); + program->enableAttributeArray("vertex"); + program->setAttributeBuffer("vertex",CGAL_GL_data_type,0,3, + static_cast(6*sizeof(CGAL_GL_data_type))); + item->buffers[Edges_vertices].release(); + item->buffers[Points_normals].bind(); + item->buffers[Points_normals].allocate(positions_normals.data(), + static_cast(positions_normals.size()*sizeof(CGAL_data_type))); + program->enableAttributeArray("normals"); + program->setAttributeBuffer("normals",CGAL_GL_data_type,0,3); + item->buffers[Points_normals].release(); + positions_normals.resize(0); + std::vector(positions_normals).swap(positions_normals); + item->vaos[TheShadedPoints]->release(); + program->release(); + } + + if(item->has_normals()) nb_points = positions_lines.size()/2; else nb_points = positions_lines.size(); - program->release(); } //vao for the selected points { - if(item->has_normals()) - program = item->getShaderProgram(Scene_points_with_normal_item::PROGRAM_WITH_LIGHT, viewer); - else - program = item->getShaderProgram(Scene_points_with_normal_item::PROGRAM_NO_SELECTION, viewer); - program->bind(); - item->vaos[Selected_points]->bind(); + program = item->getShaderProgram(Scene_points_with_normal_item::PROGRAM_NO_SELECTION, viewer); + program->bind(); + + item->vaos[Selected_points]->bind(); + item->buffers[Edges_vertices].bind(); + program->enableAttributeArray("vertex"); + if(!item->has_normals()) + { + program->setAttributeBuffer("vertex",CGAL_GL_data_type, + static_cast( 3*(m_points->size()-m_points->nb_selected_points())*sizeof(CGAL_data_type) ), + 3, + 0); + } + else + { + program->setAttributeBuffer("vertex",CGAL_GL_data_type, + static_cast( 6*(m_points->size()-m_points->nb_selected_points())*sizeof(CGAL_data_type) ), + 3, + static_cast(6*sizeof(CGAL_GL_data_type))); + } + item->buffers[Edges_vertices].release(); + item->vaos[Selected_points]->release(); + program->release(); + if(item->has_normals()) + { + program = item->getShaderProgram(Scene_points_with_normal_item::PROGRAM_WITH_LIGHT, viewer); + item->vaos[Selected_shaded_points]->bind(); item->buffers[Edges_vertices].bind(); program->enableAttributeArray("vertex"); - if(!item->has_normals()) - { - program->setAttributeBuffer("vertex",CGAL_GL_data_type, - static_cast( 3*(m_points->size()-m_points->nb_selected_points())*sizeof(CGAL_data_type) ), - 3, - 0); - } - else - { - program->setAttributeBuffer("vertex",CGAL_GL_data_type, - static_cast( 6*(m_points->size()-m_points->nb_selected_points())*sizeof(CGAL_data_type) ), - 3, - static_cast(6*sizeof(CGAL_GL_data_type))); - } + program->setAttributeBuffer("vertex",CGAL_GL_data_type, + static_cast( 6*(m_points->size()-m_points->nb_selected_points())*sizeof(CGAL_data_type) ), + 3, + static_cast(6*sizeof(CGAL_GL_data_type))); + item->buffers[Edges_vertices].release(); - if(item->has_normals()) - { - item->buffers[Selected_points_normals].bind(); - item->buffers[Selected_points_normals].allocate(positions_selected_normals.data(), - static_cast(positions_selected_normals.size()*sizeof(CGAL_data_type))); - program->enableAttributeArray("normals"); - program->setAttributeBuffer("normals",CGAL_GL_data_type,0,3); - item->buffers[Selected_points_normals].release(); - positions_selected_normals.resize(0); - std::vector(positions_selected_normals).swap(positions_selected_normals); - } - item->vaos[Selected_points]->release(); - nb_selected_points = 3*m_points->nb_selected_points(); + item->buffers[Selected_points_normals].bind(); + item->buffers[Selected_points_normals].allocate(positions_selected_normals.data(), + static_cast(positions_selected_normals.size()*sizeof(CGAL_data_type))); + program->enableAttributeArray("normals"); + program->setAttributeBuffer("normals",CGAL_GL_data_type,0,3); + item->buffers[Selected_points_normals].release(); + positions_selected_normals.resize(0); + std::vector(positions_selected_normals).swap(positions_selected_normals); + + item->vaos[Selected_shaded_points]->release(); program->release(); + } + nb_selected_points = 3*m_points->nb_selected_points(); } positions_lines.resize(0); positions_lines.shrink_to_fit(); @@ -671,34 +691,44 @@ void Scene_points_with_normal_item::drawPoints(CGAL::Three::Viewer_interface* vi if ((viewer->inFastDrawing () || d->isPointSliderMoving()) &&((d->nb_points + d->nb_selected_points)/3 > limit_fast_drawing)) // arbitrary large value ratio_displayed = 3 * limit_fast_drawing / (double)(d->nb_points + d->nb_selected_points); - vaos[Scene_points_with_normal_item_priv::ThePoints]->bind(); + + // POINTS if(has_normals() && renderingMode() == ShadedPoints) { + vaos[Scene_points_with_normal_item_priv::TheShadedPoints]->bind(); d->program=getShaderProgram(PROGRAM_WITH_LIGHT); attribBuffers(viewer,PROGRAM_WITH_LIGHT); } else { + vaos[Scene_points_with_normal_item_priv::ThePoints]->bind(); d->program=getShaderProgram(PROGRAM_NO_SELECTION); attribBuffers(viewer,PROGRAM_NO_SELECTION); } d->program->bind(); - if (!(d->m_points->has_colors())) + if (!(d->m_points->has_colors()) || renderingMode() == ShadedPoints) d->program->setAttributeValue("colors", this->color()); - if(renderingMode() != ShadedPoints) - d->program->setAttributeValue("normals", QVector3D(0,0,0)); viewer->glDrawArrays(GL_POINTS, 0, static_cast(((std::size_t)(ratio_displayed * d->nb_points)/3))); - vaos[Scene_points_with_normal_item_priv::ThePoints]->release(); + + if(has_normals() && renderingMode() == ShadedPoints) + vaos[Scene_points_with_normal_item_priv::TheShadedPoints]->release(); + else + vaos[Scene_points_with_normal_item_priv::ThePoints]->release(); d->program->release(); + + + // SELECTED POINTS vaos[Scene_points_with_normal_item_priv::Selected_points]->bind(); if(has_normals() && renderingMode() == ShadedPoints) { + vaos[Scene_points_with_normal_item_priv::Selected_shaded_points]->bind(); d->program=getShaderProgram(PROGRAM_WITH_LIGHT); attribBuffers(viewer,PROGRAM_WITH_LIGHT); } else { + vaos[Scene_points_with_normal_item_priv::Selected_points]->bind(); d->program=getShaderProgram(PROGRAM_NO_SELECTION); attribBuffers(viewer,PROGRAM_NO_SELECTION); } @@ -706,7 +736,11 @@ void Scene_points_with_normal_item::drawPoints(CGAL::Three::Viewer_interface* vi d->program->setAttributeValue("colors", QColor(255,0,0)); viewer->glDrawArrays(GL_POINTS, 0, static_cast(((std::size_t)(ratio_displayed * d->nb_selected_points)/3))); - vaos[Scene_points_with_normal_item_priv::Selected_points]->release(); + + if(has_normals() && renderingMode() == ShadedPoints) + vaos[Scene_points_with_normal_item_priv::Selected_shaded_points]->bind(); + else + vaos[Scene_points_with_normal_item_priv::Selected_points]->release(); d->program->release(); viewer->glPointSize(point_size); } From f563d89ee9db772fa11b66b8804830bc09524594 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 31 May 2017 11:02:29 +0200 Subject: [PATCH 03/12] Fix group drawing for shadedpoints. --- .../Point_set_shape_detection_plugin.cpp | 3 +- .../demo/Polyhedron/Scene_group_item.cpp | 55 ++----------------- 2 files changed, 6 insertions(+), 52 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_shape_detection_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_shape_detection_plugin.cpp index 4ddb9bbdb92..baea6d788c1 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_shape_detection_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_shape_detection_plugin.cpp @@ -230,7 +230,6 @@ void Polyhedron_demo_point_set_shape_detection_plugin::on_actionDetect_triggered } Scene_points_with_normal_item *point_item = new Scene_points_with_normal_item; - point_item->point_set()->add_normal_map(); BOOST_FOREACH(std::size_t i, shape->indices_of_assigned_points()) point_item->point_set()->insert(points->point(*(points->begin()+i))); @@ -315,8 +314,8 @@ void Polyhedron_demo_point_set_shape_detection_plugin::on_actionDetect_triggered } else if (dynamic_cast *>(shape.get())) { + point_item->point_set()->add_normal_map(); CGAL::Shape_detection_3::Plane * plane = dynamic_cast *>(shape.get()); - //set normals for point_item to the plane's normal for(Point_set::iterator it = point_item->point_set()->begin(); it != point_item->point_set()->end(); ++it) point_item->point_set()->normal(*it) = plane->plane_normal(); diff --git a/Polyhedron/demo/Polyhedron/Scene_group_item.cpp b/Polyhedron/demo/Polyhedron/Scene_group_item.cpp index 3f7474792bc..7067f5cab86 100644 --- a/Polyhedron/demo/Polyhedron/Scene_group_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_group_item.cpp @@ -141,70 +141,25 @@ void Scene_group_item::draw(CGAL::Three::Viewer_interface* viewer) const { } switch(child->renderingMode()) { case Points: + case ShadedPoints: case PointsPlusNormals: child->drawPoints(viewer); break; default: break; } + if(child->renderingMode() == Splatting) + child->drawSplats(viewer); break; } already_drawn = true; } void Scene_group_item::drawEdges(CGAL::Three::Viewer_interface* viewer) const { - if(viewer->inDrawWithNames() || already_drawn ) return; - Q_FOREACH(Scene_item* child, children) { - if(!child->visible()) continue; - switch(child->renderingMode()) { - case FlatPlusEdges: - case Wireframe: - case PointsPlusNormals: - child->drawEdges(viewer); break; - default: break; - } - switch(child->renderingMode()) { - case Flat: - case FlatPlusEdges: - case Gouraud: - child->draw(viewer); break; - default: break; - } - switch(child->renderingMode()) { - case Points: - case PointsPlusNormals: - child->drawPoints(viewer); break; - default: break; - } - } - already_drawn = true; + draw(viewer); } void Scene_group_item::drawPoints(CGAL::Three::Viewer_interface* viewer) const { - if(viewer->inDrawWithNames() || already_drawn ) return; - Q_FOREACH(Scene_item* child, children) { - if(!child->visible()) continue; - switch(child->renderingMode()) { - case Points: - case PointsPlusNormals: - child->drawPoints(viewer); break; - default: break; - } - switch(child->renderingMode()) { - case Flat: - case FlatPlusEdges: - case Gouraud: - child->draw(viewer); break; - default: break; - } - switch(child->renderingMode()) { - case FlatPlusEdges: - case Wireframe: - case PointsPlusNormals: - child->drawEdges(viewer); break; - default: break; - } - } - already_drawn = true; + draw(viewer); } void Scene_group_item::drawSplats(CGAL::Three::Viewer_interface* viewer) const From 775ab3b6d223825c5f3a747f5bd3c71e2e84df1d Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 31 May 2017 11:21:52 +0200 Subject: [PATCH 04/12] Workaround to fix focus problem on mac. --- Polyhedron/demo/Polyhedron/Polyhedron_demo.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo.cpp index aaddc1fcb72..624f348c35c 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo.cpp @@ -64,7 +64,10 @@ Polyhedron_demo::Polyhedron_demo(int& argc, char **argv, mainWindow.setWindowTitle(main_window_title); mainWindow.show(); - +#ifdef __APPLE__ + system("osascript -e 'tell application \"System Events\" " + "to keystroke tab using {command down, shift down}'"); +#endif if(parser.isSet(use_meta)) { mainWindow.setAddKeyFrameKeyboardModifiers(::Qt::MetaModifier); } From ba9049ec5c3b6b9e75d04cdb1c6b3fc48a862cd3 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 31 May 2017 11:47:38 +0200 Subject: [PATCH 05/12] Enhance axis system --- Polyhedron/demo/Polyhedron/Viewer.cpp | 141 +++++++++++--------------- 1 file changed, 60 insertions(+), 81 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Viewer.cpp b/Polyhedron/demo/Polyhedron/Viewer.cpp index 4e5241e20be..56b3d52a9c5 100644 --- a/Polyhedron/demo/Polyhedron/Viewer.cpp +++ b/Polyhedron/demo/Polyhedron/Viewer.cpp @@ -255,10 +255,7 @@ void Viewer::initializeGL() "attribute highp vec3 normal;\n" "attribute highp vec4 colors;\n" "uniform highp mat4 mvp_matrix;\n" - "uniform highp mat4 ortho_mat;\n" "uniform highp mat4 mv_matrix; \n" - "uniform highp float width; \n" - "uniform highp float height; \n" "varying highp vec4 fP; \n" "varying highp vec3 fN; \n" "varying highp vec4 color; \n" @@ -267,10 +264,7 @@ void Viewer::initializeGL() " color = colors; \n" " fP = mv_matrix * vertex; \n" " fN = mat3(mv_matrix)* normal; \n" - " vec4 temp = vec4(mvp_matrix * vertex); \n" - " vec4 ort = ortho_mat * vec4(width-150, height-150, 0,0); \n" - " float ratio = width/height; \n" - " gl_Position = ort +vec4(temp.x, temp.y, temp.z, 1.0); \n" + " gl_Position = vec4(mvp_matrix * vertex); \n" "} \n" "\n" }; @@ -327,6 +321,7 @@ void Viewer::initializeGL() { std::cerr<<"adding fragment shader FAILED"<rendering_program.bindAttributeLocation("colors", 1); if(!d->rendering_program.link()) { //std::cerr<<"linking Program FAILED"<v_Axis.resize(0); + d->n_Axis.resize(0); + d->c_Axis.resize(0); + data.vertices = &d->v_Axis; + data.normals = &d->n_Axis; + data.colors = &d->c_Axis; + GLdouble l = 1.0; + d->makeArrow(0.06,10, qglviewer::Vec(0,0,0),qglviewer::Vec(l,0,0),qglviewer::Vec(1,0,0), data); + d->makeArrow(0.06,10, qglviewer::Vec(0,0,0),qglviewer::Vec(0,l,0),qglviewer::Vec(0,1,0), data); + d->makeArrow(0.06,10, qglviewer::Vec(0,0,0),qglviewer::Vec(0,0,l),qglviewer::Vec(0,0,1), data); + + d->rendering_program.bind(); + d->vao[0].bind(); + d->buffers[0].bind(); + d->buffers[0].allocate(d->v_Axis.data(), static_cast(d->v_Axis.size()) * sizeof(float)); + d->rendering_program.enableAttributeArray("vertex"); + d->rendering_program.setAttributeBuffer("vertex",GL_FLOAT,0,3); + d->buffers[0].release(); + + d->buffers[1].bind(); + d->buffers[1].allocate(d->n_Axis.data(), static_cast(d->n_Axis.size() * sizeof(float))); + d->rendering_program.enableAttributeArray("normal"); + d->rendering_program.setAttributeBuffer("normal",GL_FLOAT,0,3); + d->buffers[1].release(); + + d->buffers[2].bind(); + d->buffers[2].allocate(d->c_Axis.data(), static_cast(d->c_Axis.size() * sizeof(float))); + d->rendering_program.enableAttributeArray("colors"); + d->rendering_program.setAttributeBuffer("colors",GL_FLOAT,0,3); + d->buffers[2].release(); + d->vao[0].release(); + + d->rendering_program.release(); + d->painter = new QPainter(this); } @@ -919,24 +949,17 @@ void Viewer::drawVisualHints() QGLViewer::drawVisualHints(); if(d->axis_are_displayed) { + d->rendering_program.bind(); + SetOrthoProjection(true); QMatrix4x4 mvpMatrix; - double mat[16]; QMatrix4x4 mvMatrix; - camera()->getModelViewProjectionMatrix(mat); - //nullifies the translation - mat[12]=0; - mat[13]=0; - mat[14]=0; for(int i=0; i < 16; i++) { - mvpMatrix.data()[i] = (float)mat[i]; + mvMatrix.data()[i] = camera()->orientation().inverse().matrix()[i]; } - camera()->getModelViewMatrix(mat); - for(int i=0; i < 16; i++) - { - mvMatrix.data()[i] = (float)mat[i]; - } - + mvpMatrix.ortho(-1,1,-1,1,-1,1); + mvpMatrix = mvpMatrix*mvMatrix; + SetOrthoProjection(false); QVector4D position(0.0f,0.0f,1.0f,1.0f ); // define material QVector4D ambient; @@ -961,7 +984,6 @@ void Viewer::drawVisualHints() // Shininess shininess = 51.2f; - d->rendering_program.bind(); d->rendering_program.setUniformValue("light_pos", position); d->rendering_program.setUniformValue("mvp_matrix", mvpMatrix); d->rendering_program.setUniformValue("mv_matrix", mvMatrix); @@ -969,13 +991,27 @@ void Viewer::drawVisualHints() d->rendering_program.setUniformValue("light_spec", specular); d->rendering_program.setUniformValue("light_amb", ambient); d->rendering_program.setUniformValue("spec_power", shininess); - d->rendering_program.release(); d->vao[0].bind(); - d->rendering_program.bind(); + int viewport[4]; + int scissor[4]; + + // The viewport and the scissor are changed to fit the upper right + // corner. Original values are saved. + glGetIntegerv(GL_VIEWPORT, viewport); + glGetIntegerv(GL_SCISSOR_BOX, scissor); + + // Axis viewport size, in pixels + const int size = 100; + //TODO: Find a fix for Retina screens. + glViewport(width()-size, height()-size, size, size); + glScissor(width()-size, height()-size, size, size); glDrawArrays(GL_TRIANGLES, 0, static_cast(d->v_Axis.size() / 3)); - d->rendering_program.release(); + // The viewport and the scissor are restored. + glScissor(scissor[0],scissor[1],scissor[2],scissor[3]); + glViewport(viewport[0],viewport[1],viewport[2],viewport[3]); d->vao[0].release(); + d->rendering_program.release(); } if(d->distance_is_displayed) @@ -1036,63 +1072,6 @@ void Viewer::drawVisualHints() void Viewer::resizeGL(int w, int h) { QGLViewer::resizeGL(w,h); - qglviewer::Vec dim = qglviewer::Vec(w,h, 0) ; - GLdouble ortho[16]; - QMatrix4x4 orthoMatrix; - ortho[0] = 1.0/width(); ortho[1] = 0; ortho[2] = 0; ortho[3] = -0.0; - ortho[4] = 0; ortho[5] = 1.0/height(); ortho[6] = 0; ortho[7] = -0.0; - ortho[8] = 0; ortho[9] = 0; ortho[10] = 2.0/(camera()->zNear()-camera()->zFar()); ortho[11] = -(camera()->zNear()+camera()->zFar())/(-camera()->zNear()+camera()->zFar()); - ortho[12] = 0; ortho[13] = 0; ortho[14] = 0; ortho[15] = 1; - for(int i=0; i < 16; i++) - { - orthoMatrix.data()[i] = (float)ortho[i]; - } - - QVector4D length(60,60,60, 1.0); - length = orthoMatrix * length; - Viewer_impl::AxisData data; - d->v_Axis.resize(0); - d->n_Axis.resize(0); - d->c_Axis.resize(0); - data.vertices = &d->v_Axis; - data.normals = &d->n_Axis; - data.colors = &d->c_Axis; - double l = length.x()*w/h; - d->makeArrow(0.06,10, qglviewer::Vec(0,0,0),qglviewer::Vec(l,0,0),qglviewer::Vec(1,0,0), data); - d->makeArrow(0.06,10, qglviewer::Vec(0,0,0),qglviewer::Vec(0,l,0),qglviewer::Vec(0,1,0), data); - d->makeArrow(0.06,10, qglviewer::Vec(0,0,0),qglviewer::Vec(0,0,l),qglviewer::Vec(0,0,1), data); - - - d->vao[0].bind(); - d->buffers[0].bind(); - d->buffers[0].allocate(d->v_Axis.data(), static_cast(d->v_Axis.size()) * sizeof(float)); - d->rendering_program.enableAttributeArray("vertex"); - d->rendering_program.setAttributeBuffer("vertex",GL_FLOAT,0,3); - d->buffers[0].release(); - - d->buffers[1].bind(); - d->buffers[1].allocate(d->n_Axis.data(), static_cast(d->n_Axis.size() * sizeof(float))); - d->rendering_program.enableAttributeArray("normal"); - d->rendering_program.setAttributeBuffer("normal",GL_FLOAT,0,3); - d->buffers[1].release(); - - d->buffers[2].bind(); - d->buffers[2].allocate(d->c_Axis.data(), static_cast(d->c_Axis.size() * sizeof(float))); - d->rendering_program.enableAttributeArray("colors"); - d->rendering_program.setAttributeBuffer("colors",GL_FLOAT,0,3); - d->buffers[2].release(); - - d->rendering_program.release(); - d->vao[0].release(); - - - - d->rendering_program.bind(); - d->rendering_program.setUniformValue("width", (float)dim.x); - d->rendering_program.setUniformValue("height", (float)dim.y); - d->rendering_program.setUniformValue("ortho_mat", orthoMatrix); - d->rendering_program.release(); - } QOpenGLShaderProgram* Viewer::declare_program(int name, const char* v_shader, From 6af84e02b586cf319c9694f2506e31d1e12ba870 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Thu, 1 Jun 2017 13:04:43 +0200 Subject: [PATCH 06/12] Add comments for hack and restore old drawEdges and drawPoints in group_item --- .../demo/Polyhedron/Polyhedron_demo.cpp | 5 ++ .../demo/Polyhedron/Scene_group_item.cpp | 56 ++++++++++++++++++- 2 files changed, 58 insertions(+), 3 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo.cpp index 624f348c35c..abfbff4cf98 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo.cpp @@ -64,6 +64,11 @@ Polyhedron_demo::Polyhedron_demo(int& argc, char **argv, mainWindow.setWindowTitle(main_window_title); mainWindow.show(); + + // On Apple, the first time the application is launched, the menus are unclicable, and + // the only way you can fix it is to unfocus and re-focus the application. + // This is a hack that makes the application lose the focus after it is started, to force the user + // to re-focus it. #ifdef __APPLE__ system("osascript -e 'tell application \"System Events\" " "to keystroke tab using {command down, shift down}'"); diff --git a/Polyhedron/demo/Polyhedron/Scene_group_item.cpp b/Polyhedron/demo/Polyhedron/Scene_group_item.cpp index 7067f5cab86..2a1bbf94a62 100644 --- a/Polyhedron/demo/Polyhedron/Scene_group_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_group_item.cpp @@ -121,7 +121,7 @@ void Scene_group_item::moveUp(int i) children.move(i, i-1); } -void Scene_group_item::draw(CGAL::Three::Viewer_interface* viewer) const { +void Scene_group_item::draw(CGAL::Three::Viewer_interface* viewer) const { if(viewer->inDrawWithNames() || already_drawn ) return; Q_FOREACH(Scene_item* child, children) { if(!child->visible()) continue; @@ -154,12 +154,62 @@ void Scene_group_item::draw(CGAL::Three::Viewer_interface* viewer) const { void Scene_group_item::drawEdges(CGAL::Three::Viewer_interface* viewer) const { - draw(viewer); + if(viewer->inDrawWithNames() || already_drawn ) return; + Q_FOREACH(Scene_item* child, children) { + if(!child->visible()) continue; + switch(child->renderingMode()) { + case FlatPlusEdges: + case Wireframe: + case PointsPlusNormals: + child->drawEdges(viewer); break; + default: break; + } + switch(child->renderingMode()) { + case Flat: + case FlatPlusEdges: + case Gouraud: + child->draw(viewer); break; + default: break; + } + switch(child->renderingMode()) { + case Points: + case ShadedPoints: + case PointsPlusNormals: + child->drawPoints(viewer); break; + default: break; + } + } + already_drawn = true; } void Scene_group_item::drawPoints(CGAL::Three::Viewer_interface* viewer) const { - draw(viewer); + if(viewer->inDrawWithNames() || already_drawn ) return; + Q_FOREACH(Scene_item* child, children) { + if(!child->visible()) continue; + switch(child->renderingMode()) { + case Points: + case ShadedPoints: + case PointsPlusNormals: + child->drawPoints(viewer); break; + default: break; + } + switch(child->renderingMode()) { + case Flat: + case FlatPlusEdges: + case Gouraud: + child->draw(viewer); break; + default: break; + } + switch(child->renderingMode()) { + case FlatPlusEdges: + case Wireframe: + case PointsPlusNormals: + child->drawEdges(viewer); break; + default: break; + } + } + already_drawn = true; } void Scene_group_item::drawSplats(CGAL::Three::Viewer_interface* viewer) const From 2de2df3442476664452318da311a32d5602f3100 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Thu, 1 Jun 2017 16:28:43 +0200 Subject: [PATCH 07/12] Fix the width/height problems with retina --- Polyhedron/demo/Polyhedron/Viewer.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Viewer.cpp b/Polyhedron/demo/Polyhedron/Viewer.cpp index 56b3d52a9c5..5317a25a2e4 100644 --- a/Polyhedron/demo/Polyhedron/Viewer.cpp +++ b/Polyhedron/demo/Polyhedron/Viewer.cpp @@ -1003,9 +1003,8 @@ void Viewer::drawVisualHints() // Axis viewport size, in pixels const int size = 100; - //TODO: Find a fix for Retina screens. - glViewport(width()-size, height()-size, size, size); - glScissor(width()-size, height()-size, size, size); + glViewport(width()*devicePixelRatio()-size, height()*devicePixelRatio()-size, size, size); + glScissor (width()*devicePixelRatio()-size, height()*devicePixelRatio()-size, size, size); glDrawArrays(GL_TRIANGLES, 0, static_cast(d->v_Axis.size() / 3)); // The viewport and the scissor are restored. glScissor(scissor[0],scissor[1],scissor[2],scissor[3]); From 104ce12c842bdef6b364bbca8ce4bffc44171598 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Thu, 1 Jun 2017 16:33:47 +0200 Subject: [PATCH 08/12] Add source for focus hack --- Polyhedron/demo/Polyhedron/Polyhedron_demo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo.cpp index abfbff4cf98..b2a885f11be 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo.cpp @@ -68,7 +68,7 @@ Polyhedron_demo::Polyhedron_demo(int& argc, char **argv, // On Apple, the first time the application is launched, the menus are unclicable, and // the only way you can fix it is to unfocus and re-focus the application. // This is a hack that makes the application lose the focus after it is started, to force the user - // to re-focus it. + // to re-focus it. (source : http://www.alecjacobson.com/weblog/?p=3910) #ifdef __APPLE__ system("osascript -e 'tell application \"System Events\" " "to keystroke tab using {command down, shift down}'"); From 519454ef8c0af1314b0dc67db5acd4cc1e7d80bf Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Fri, 2 Jun 2017 15:25:26 +0200 Subject: [PATCH 09/12] Create groups in points rendering mode in shape_detection_plugin --- .../Plugins/Point_set/Point_set_shape_detection_plugin.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_shape_detection_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_shape_detection_plugin.cpp index baea6d788c1..7414b837462 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_shape_detection_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_shape_detection_plugin.cpp @@ -174,22 +174,27 @@ void Polyhedron_demo_point_set_shape_detection_plugin::on_actionDetect_triggered // Shapes to be searched for are registered by using the template Shape_factory if(dialog.detect_plane()){ groups[0] = new Scene_group_item("Planes"); + groups[0]->setRenderingMode(Points); shape_detection.add_shape_factory >(); } if(dialog.detect_cylinder()){ groups[1] = new Scene_group_item("Cylinders"); + groups[1]->setRenderingMode(Points); shape_detection.add_shape_factory >(); } if(dialog.detect_torus()){ groups[2] = new Scene_group_item("Torus"); + groups[2]->setRenderingMode(Points); shape_detection.add_shape_factory< CGAL::Shape_detection_3::Torus >(); } if(dialog.detect_cone()){ groups[3] = new Scene_group_item("Cones"); + groups[3]->setRenderingMode(Points); shape_detection.add_shape_factory< CGAL::Shape_detection_3::Cone >(); } if(dialog.detect_sphere()){ groups[4] = new Scene_group_item("Spheres"); + groups[4]->setRenderingMode(Points); shape_detection.add_shape_factory< CGAL::Shape_detection_3::Sphere >(); } From 76ace524207ac96ae8ad40c722be7038111b20bf Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Tue, 6 Jun 2017 15:32:45 +0200 Subject: [PATCH 10/12] Workaround for gmp-4.2 with gcc 4.9 and C++11 Include `` and `` to avoid a compilation error. --- Installation/config/support/print_GMP_version.cpp | 2 ++ Installation/config/support/print_MPFR_version.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/Installation/config/support/print_GMP_version.cpp b/Installation/config/support/print_GMP_version.cpp index a6bc8f3ccf2..8135206d5ff 100644 --- a/Installation/config/support/print_GMP_version.cpp +++ b/Installation/config/support/print_GMP_version.cpp @@ -25,6 +25,8 @@ // Tests if GMP is available. #include +#include +#include #include "gmp.h" int main() diff --git a/Installation/config/support/print_MPFR_version.cpp b/Installation/config/support/print_MPFR_version.cpp index 1f1492be060..28a5f7ecbe3 100644 --- a/Installation/config/support/print_MPFR_version.cpp +++ b/Installation/config/support/print_MPFR_version.cpp @@ -25,6 +25,8 @@ // Tests if MPFR is available. #include +#include +#include #include "mpfr.h" int main() From 1ca852bb8751143b9adf2995f1e7c282e1a2c540 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 7 Jun 2017 09:36:09 +0200 Subject: [PATCH 11/12] fix Booleen operations with full/empty space --- Nef_3/examples/Nef_3/nef_3_simple.cpp | 1 + Nef_3/include/CGAL/Nef_polyhedron_3.h | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/Nef_3/examples/Nef_3/nef_3_simple.cpp b/Nef_3/examples/Nef_3/nef_3_simple.cpp index 4906af16f31..5902ad85b20 100644 --- a/Nef_3/examples/Nef_3/nef_3_simple.cpp +++ b/Nef_3/examples/Nef_3/nef_3_simple.cpp @@ -10,5 +10,6 @@ int main() { Nef_polyhedron N1(Nef_polyhedron::COMPLETE); CGAL_assertion (N0 == N1.complement()); + CGAL_assertion (N0 != N1); return 0; } diff --git a/Nef_3/include/CGAL/Nef_polyhedron_3.h b/Nef_3/include/CGAL/Nef_polyhedron_3.h index 9f3c59bfae1..fa45cb647d4 100644 --- a/Nef_3/include/CGAL/Nef_polyhedron_3.h +++ b/Nef_3/include/CGAL/Nef_polyhedron_3.h @@ -1372,6 +1372,10 @@ protected: intersection(const Nef_polyhedron_3& N1) const /*{\Mop returns |\Mvar| $\cap$ |N1|. }*/ { CGAL_NEF_TRACEN(" intersection between nef3 "<<&*this<<" and "<<&N1); + if (is_empty()) return *this; + if (N1.is_empty()) return N1; + if (is_space()) return N1; + if (N1.is_space()) return *this; AND _and; SNC_structure rsnc; Nef_polyhedron_3 res(rsnc, new SNC_point_locator_default, false); @@ -1396,6 +1400,10 @@ protected: join(const Nef_polyhedron_3& N1) const /*{\Mop returns |\Mvar| $\cup$ |N1|. }*/ { CGAL_NEF_TRACEN(" join between nef3 "<<&*this<<" and "<<&N1); + if (is_empty()) return N1; + if (N1.is_empty()) return *this; + if (is_space()) return *this; + if (N1.is_space()) return N1; OR _or; //CGAL::binop_intersection_tests_allpairs tests_impl; SNC_structure rsnc; @@ -1409,6 +1417,10 @@ protected: difference(const Nef_polyhedron_3& N1) const /*{\Mop returns |\Mvar| $-$ |N1|. }*/ { CGAL_NEF_TRACEN(" difference between nef3 "<<&*this<<" and "<<&N1); + if (is_empty()) return *this; + if (N1.is_empty()) return *this; + if (is_space()) return N1.complement(); + if (N1.is_space()) return Nef_polyhedron_3(EMPTY); DIFF _diff; //CGAL::binop_intersection_tests_allpairs tests_impl; SNC_structure rsnc; @@ -1423,6 +1435,10 @@ protected: /*{\Mop returns the symmectric difference |\Mvar - T| $\cup$ |T - \Mvar|. }*/ { CGAL_NEF_TRACEN(" symmetic difference between nef3 "<<&*this<<" and "<<&N1); + if (is_empty()) return N1; + if (N1.is_empty()) return *this; + if (is_space()) return Nef_polyhedron_3(EMPTY); + if (N1.is_space()) return Nef_polyhedron_3(EMPTY); XOR _xor; //CGAL::binop_intersection_tests_allpairs tests_impl; SNC_structure rsnc; From 01504b06e6ccd041589973d0e73c9a0c0c79858c Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Thu, 8 Jun 2017 09:49:08 +0200 Subject: [PATCH 12/12] Add missing headers --- Surface_mesh/include/CGAL/Surface_mesh/IO.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Surface_mesh/include/CGAL/Surface_mesh/IO.h b/Surface_mesh/include/CGAL/Surface_mesh/IO.h index 9a65452e5e5..a895c9947c0 100644 --- a/Surface_mesh/include/CGAL/Surface_mesh/IO.h +++ b/Surface_mesh/include/CGAL/Surface_mesh/IO.h @@ -24,6 +24,9 @@ #include #include #include +#include +#include +#include #include