diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h index a95bd4944d2..5ec65227420 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h @@ -77,7 +77,8 @@ namespace internal { PATCH, //h and hopp belong to the patch to be remeshed PATCH_BORDER,//h belongs to the patch, hopp is MESH MESH, //h and hopp belong to the mesh, not the patch - MESH_BORDER //h belongs to the mesh, face(hopp, pmesh) == null_face() + MESH_BORDER, //h belongs to the mesh, face(hopp, pmesh) == null_face() + ISOLATED_CONSTRAINT //h is constrained, and incident to faces that do not belong to a patch }; // A property map @@ -1466,7 +1467,8 @@ private: { halfedge_descriptor hopp = opposite(h, mesh_); if ( is_on_border(h) || is_on_patch_border(h) - || is_on_border(hopp) || is_on_patch_border(hopp)) + || is_on_border(hopp) || is_on_patch_border(hopp) + || is_an_isolated_constraint(h)) ++nb_incident_features; if (nb_incident_features > 2) return true; @@ -1532,19 +1534,43 @@ private: { //deal with h and hopp for borders that are sharp edges to be preserved halfedge_descriptor h = halfedge(e, mesh_); - if (status(h) == PATCH){ + Halfedge_status hs = status(h); + if (hs == PATCH) { set_status(h, PATCH_BORDER); + hs = PATCH_BORDER; has_border_ = true; } halfedge_descriptor hopp = opposite(h, mesh_); - if (status(hopp) == PATCH){ + Halfedge_status hsopp = status(hopp); + if (hsopp == PATCH) { set_status(hopp, PATCH_BORDER); + hsopp = PATCH_BORDER; has_border_ = true; } + + if (hs != PATCH_BORDER && hsopp != PATCH_BORDER) + { + set_status(h, ISOLATED_CONSTRAINT); + set_status(hopp, ISOLATED_CONSTRAINT); + } } } } + + std::ofstream ofs("dump_isolated.polylines.txt"); + for (edge_descriptor e : edges(mesh_)) + { + halfedge_descriptor h = halfedge(e, mesh_); + if (status(h) == ISOLATED_CONSTRAINT) + { + CGAL_assertion(status(opposite(h, mesh_)) == ISOLATED_CONSTRAINT); + ofs << "2 " << get(vpmap_, target(h, mesh_)) + << " " << get(vpmap_, source(h, mesh_)) << std::endl; + } + } + ofs.close(); + } Halfedge_status status(const halfedge_descriptor& h) const @@ -1815,6 +1841,13 @@ public: return status(h) == MESH; } + bool is_an_isolated_constraint(const halfedge_descriptor& h) const + { + bool res = (status(h) == ISOLATED_CONSTRAINT); + CGAL_assertion(!res || status(opposite(h, mesh_)) == ISOLATED_CONSTRAINT); + return res; + } + private: void halfedge_added(const halfedge_descriptor& h, const Halfedge_status& s) diff --git a/Polyhedron/demo/Polyhedron/Scene_group_item.cpp b/Polyhedron/demo/Polyhedron/Scene_group_item.cpp index 4da5aa3c557..70570753802 100644 --- a/Polyhedron/demo/Polyhedron/Scene_group_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_group_item.cpp @@ -10,18 +10,19 @@ Scene_group_item::Scene_group_item(QString name) expanded = true; already_drawn = false; scene = Three::scene(); + children = new QList(); } bool Scene_group_item::isFinite() const { - Q_FOREACH(Scene_interface::Item_id id, children) + for(Scene_interface::Item_id id : *children) if(!getChild(id)->isFinite()){ return false; } return true; } bool Scene_group_item::isEmpty() const { - Q_FOREACH(Scene_interface::Item_id id, children) + for(Scene_interface::Item_id id : *children) if(!getChild(id)->isEmpty()){ return false; } @@ -31,7 +32,7 @@ bool Scene_group_item::isEmpty() const { Scene_group_item::Bbox Scene_group_item::bbox() const { Scene_item* first_non_empty = nullptr; - Q_FOREACH(Scene_interface::Item_id id, children) + for(Scene_interface::Item_id id : *children) if(!getChild(id)->isEmpty()) { first_non_empty = getChild(id); @@ -40,7 +41,7 @@ Scene_group_item::Bbox Scene_group_item::bbox() const if(first_non_empty) { Bbox b =first_non_empty->bbox(); - Q_FOREACH(Scene_interface::Item_id id, children) + for(Scene_interface::Item_id id : *children) b+=getChild(id)->bbox(); return b; } @@ -50,7 +51,7 @@ Scene_group_item::Bbox Scene_group_item::bbox() const bool Scene_group_item::supportsRenderingMode(RenderingMode m) const { - Q_FOREACH(Scene_interface::Item_id id, children) + for(Scene_interface::Item_id id : *children) if(!getChild(id)->supportsRenderingMode(m)) return false; return true; @@ -59,16 +60,16 @@ bool Scene_group_item::supportsRenderingMode(RenderingMode m) const { QString Scene_group_item::toolTip() const { QString str = - QObject::tr( "

Number of children: %1
").arg(children.size()); + QObject::tr( "

Number of children: %1
").arg(children->size()); str+="

"; return str; } void Scene_group_item::addChild(Scene_item* new_item) { - if(!children.contains(scene->item_id(new_item))) + if(!children->contains(scene->item_id(new_item))) { - children.append(scene->item_id(new_item)); + children->append(scene->item_id(new_item)); update_group_number(new_item, has_group+1); } @@ -76,9 +77,9 @@ void Scene_group_item::addChild(Scene_item* new_item) void Scene_group_item::addChild(Scene_interface::Item_id new_id) { - if(!children.contains(new_id)) + if(!children->contains(new_id)) { - children.append(new_id); + children->append(new_id); update_group_number(getChild(new_id), has_group+1); } } @@ -98,7 +99,7 @@ void Scene_group_item::update_group_number(Scene_item * new_item, int n) void Scene_group_item::setColor(QColor c) { Scene_item::setColor(c); - Q_FOREACH(Scene_interface::Item_id id, children) + for(Scene_interface::Item_id id : *children) { getChild(id)->setColor(c); } @@ -107,7 +108,7 @@ void Scene_group_item::setColor(QColor c) void Scene_group_item::setRenderingMode(RenderingMode m) { Scene_item::setRenderingMode(m); - Q_FOREACH(Scene_interface::Item_id id, children) + for(Scene_interface::Item_id id : *children) { Scene_item* child = getChild(id); if(child->supportsRenderingMode(m)) @@ -118,7 +119,7 @@ void Scene_group_item::setRenderingMode(RenderingMode m) void Scene_group_item::setVisible(bool b) { Scene_item::setVisible(b); - Q_FOREACH(Scene_interface::Item_id id, children) + for(Scene_interface::Item_id id : *children) { Scene_item* child = getChild(id); child->setVisible(b); @@ -139,12 +140,12 @@ void Scene_group_item::setExpanded(bool b) void Scene_group_item::moveDown(int i) { - children.move(i, i+1); + children->move(i, i+1); } void Scene_group_item::moveUp(int i) { - children.move(i, i-1); + children->move(i, i-1); } void Scene_group_item::draw(CGAL::Three::Viewer_interface* ) const { @@ -167,7 +168,7 @@ void Scene_group_item::renderChildren(Viewer_interface *viewer, bool with_names) { - Q_FOREACH(Scene_interface::Item_id id, children){ + for(Scene_interface::Item_id id : *children){ if(with_names) { viewer->glClearDepthf(1.0f); viewer->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); @@ -229,14 +230,14 @@ void Scene_group_item::lockChild(Scene_item *child) void Scene_group_item::lockChild(Scene_interface::Item_id id) { - if(!children.contains(id)) + if(!children->contains(id)) return; getChild(id)->setProperty("lock", true); } void Scene_group_item::unlockChild(Scene_interface::Item_id id) { - if(!children.contains(id)) + if(!children->contains(id)) return; getChild(id)->setProperty("lock", false); } @@ -246,7 +247,7 @@ void Scene_group_item::unlockChild(Scene_item *child) } bool Scene_group_item::isChildLocked(Scene_interface::Item_id id) { - if(!children.contains(id) + if(!children->contains(id) || (!getChild(id)->property("lock").toBool()) ) return false; return true; @@ -259,7 +260,7 @@ bool Scene_group_item::isChildLocked(Scene_item *child) void Scene_group_item::setAlpha(int ) { - Q_FOREACH(Scene_interface::Item_id id, children) + for(Scene_interface::Item_id id : *children) { scene->item(id)->setAlpha(static_cast(alpha()*255)); } diff --git a/Scripts/developer_scripts/autotest_cgal b/Scripts/developer_scripts/autotest_cgal index 709a5675e01..3948ceda80d 100755 --- a/Scripts/developer_scripts/autotest_cgal +++ b/Scripts/developer_scripts/autotest_cgal @@ -628,11 +628,17 @@ if [ -f '${LIST_TEST_PACKAGES}' ]; then cp '${CGAL_TEST_DIR}/makefile2' '${CGAL_BINARY_DIR}/test' cp '${CGAL_TEST_DIR}/run_testsuite_with_cmake' '${CGAL_BINARY_DIR}/test' - for PACKAGE in \`source '${LIST_TEST_PACKAGES}' '${CGAL_ROOT}'\`; do - - if [ -d "${CGAL_TEST_DIR}/\${PACKAGE}" ]; then - mkdir "${CGAL_BINARY_DIR}/test/\${PACKAGE}" - cp -r "${CGAL_TEST_DIR}/\${PACKAGE}" '${CGAL_BINARY_DIR}/test' + # list all packages in CGAL_TEST_DIR. If PACKAGE is found in LIST_TEST_PACKAGES, + # copy it, else prepare for the special "skipped" case in the table. + for PACKAGE in \$(ls "${CGAL_TEST_DIR}"); do + if [ -d "${CGAL_TEST_DIR}/\$PACKAGE" ]; then + if source '${LIST_TEST_PACKAGES}' '${CGAL_ROOT}' | egrep -q \$PACKAGE; then + mkdir "\${CGAL_BINARY_DIR}/test/\${PACKAGE}" + cp -r "${CGAL_TEST_DIR}/\${PACKAGE}" '${CGAL_BINARY_DIR}/test' + else + mkdir "${CGAL_BINARY_DIR}/test/\${PACKAGE}" + touch "${CGAL_BINARY_DIR}/test/\${PACKAGE}/skipped" + fi fi done diff --git a/Scripts/developer_scripts/cgal_create_release_with_cmake.cmake b/Scripts/developer_scripts/cgal_create_release_with_cmake.cmake index ac22a93b1b4..b2a0ab88e9f 100644 --- a/Scripts/developer_scripts/cgal_create_release_with_cmake.cmake +++ b/Scripts/developer_scripts/cgal_create_release_with_cmake.cmake @@ -11,7 +11,7 @@ # GENERATE_TARBALLS=[ON/OFF] indicates if release tarballs should be created as DESTINATION cmake_minimum_required(VERSION 3.1...3.15) - +find_program(BASH NAMES bash sh) function(process_package pkg) if(VERBOSE) message(STATUS "handling ${pkg}") @@ -223,7 +223,7 @@ if (TESTSUITE) if(IS_DIRECTORY "${release_dir}/test/${d}") if(NOT EXISTS "${release_dir}/test/${d}/cgal_test_with_cmake") execute_process( - COMMAND ${GIT_REPO}/Scripts/developer_scripts/create_cgal_test_with_cmake + COMMAND ${BASH} ${GIT_REPO}/Scripts/developer_scripts/create_cgal_test_with_cmake WORKING_DIRECTORY "${release_dir}/test/${d}" RESULT_VARIABLE RESULT_VAR OUTPUT_VARIABLE OUT_VAR @@ -249,7 +249,7 @@ if (TESTSUITE) file(RENAME "${release_dir}/tmp/${d}" "${release_dir}/test/${d}_Demo") if(NOT EXISTS "${release_dir}/test/${d}_Demo/cgal_test_with_cmake") execute_process( - COMMAND ${GIT_REPO}/Scripts/developer_scripts/create_cgal_test_with_cmake --no-run + COMMAND ${BASH} ${GIT_REPO}/Scripts/developer_scripts/create_cgal_test_with_cmake --no-run WORKING_DIRECTORY "${release_dir}/test/${d}_Demo" RESULT_VARIABLE RESULT_VAR OUTPUT_VARIABLE OUT_VAR @@ -270,7 +270,7 @@ if (TESTSUITE) file(RENAME "${release_dir}/tmp/${d}" "${release_dir}/test/${d}_Examples") if(NOT EXISTS "${release_dir}/test/${d}_Examples/cgal_test_with_cmake") execute_process( - COMMAND ${GIT_REPO}/Scripts/developer_scripts/create_cgal_test_with_cmake + COMMAND ${BASH} ${GIT_REPO}/Scripts/developer_scripts/create_cgal_test_with_cmake WORKING_DIRECTORY "${release_dir}/test/${d}_Examples" RESULT_VARIABLE RESULT_VAR OUTPUT_VARIABLE OUT_VAR diff --git a/Testsuite/test/run_testsuite_with_cmake b/Testsuite/test/run_testsuite_with_cmake index afceab97fcb..ca523ea0864 100755 --- a/Testsuite/test/run_testsuite_with_cmake +++ b/Testsuite/test/run_testsuite_with_cmake @@ -246,7 +246,9 @@ run_testsuite() esac for DIR in $TEST_DIRECTORIES ; do - test_directory "$DIR" + if [ ! -f $DIR/skipped ]; then + test_directory "$DIR" + fi done } diff --git a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/FMLS.h b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/FMLS.h index 500279aad4b..354e2423674 100644 --- a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/FMLS.h +++ b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/FMLS.h @@ -382,14 +382,16 @@ private: minMax[3 + j] = PN[6 * i + j]; } for (std::size_t i = 0; i < 3; i++) { - minMax[i] *= 0.99; - minMax[3 + i] *= 1.01; + minMax[i] = (minMax[i] > 0.) + ? (0.99 * minMax[i]) : (1.01 * minMax[i]); + minMax[3 + i] = (minMax[3+i] > 0.) + ? (1.01 * minMax[3+i]) : (0.99 * minMax[3+i]); } for (std::size_t i = 0; i < 3; i++) { res[i] = (std::size_t)ceil((minMax[3 + i] - minMax[i]) / cellSize); - if(res[1] == 0) + if(res[i] == 0) res[i] = 1; } diff --git a/Three/include/CGAL/Three/Scene_group_item.h b/Three/include/CGAL/Three/Scene_group_item.h index 626e69240ab..a479830e6e1 100644 --- a/Three/include/CGAL/Three/Scene_group_item.h +++ b/Three/include/CGAL/Three/Scene_group_item.h @@ -39,7 +39,7 @@ class DEMO_FRAMEWORK_EXPORT Scene_group_item : public Scene_item_rendering_helpe Q_OBJECT public : Scene_group_item(QString name = QString("New group")); - ~Scene_group_item() {} + ~Scene_group_item() { delete children;} //!Returns false to avoid disturbing the BBox of the scene. bool isFinite() const Q_DECL_OVERRIDE; //!Returns true to avoid disturbing the BBox of the scene. @@ -196,7 +196,7 @@ public : //! //! Only returns children that have this item as a parent. //! Children of these children are not returned. - QList getChildren() const {return children;} + QList getChildren() const {return *children;} //! \brief getChildrenForSelection returns the list of //! children to select along with the group. @@ -205,7 +205,7 @@ public : //! this function defines which of its children will be added too. //! Typically overriden to allow applying an operation from the //! Operation menu only to the parent item and not to its children. - virtual QList getChildrenForSelection() const {return children;} + virtual QList getChildrenForSelection() const {return *children;} //!Removes a Scene_item from the list of children. //!@see getChildren() @see addChild() void removeChild( Scene_item* item) @@ -214,7 +214,7 @@ public : return; update_group_number(item,0); item->moveToGroup(0); - children.removeOne(scene->item_id(item)); + children->removeOne(scene->item_id(item)); } //!Removes a Scene_item from the list of children using its index. //!@see getChildren() @see addChild() @@ -243,13 +243,13 @@ public Q_SLOTS: //! void adjustIds(Scene_interface::Item_id removed_id) { - for(int i = 0; i < children.size(); ++i) + for(int i = 0; i < children->size(); ++i) { - if(children[i] > removed_id) - --children[i]; - else if(children[i] == removed_id)//child has been removed from the scene, it doesn't exist anymore. + if((*children)[i] > removed_id) + --(*children)[i]; + else if((*children)[i] == removed_id)//child has been removed from the scene, it doesn't exist anymore. { - children.removeAll(removed_id); + children->removeAll(removed_id); } } } @@ -260,7 +260,7 @@ private: protected: Scene_interface *scene; //!Contains a reference to all the children of this group. - QList children; + QList* children; }; //end of class Scene_group_item diff --git a/Three/include/CGAL/Three/Scene_item_with_properties.h b/Three/include/CGAL/Three/Scene_item_with_properties.h index 24f32194f75..d6d3cab1845 100644 --- a/Three/include/CGAL/Three/Scene_item_with_properties.h +++ b/Three/include/CGAL/Three/Scene_item_with_properties.h @@ -14,6 +14,12 @@ #include +#ifdef demo_framework_EXPORTS +# define DEMO_FRAMEWORK_EXPORT Q_DECL_EXPORT +#else +# define DEMO_FRAMEWORK_EXPORT Q_DECL_IMPORT +#endif + namespace CGAL { namespace Three { @@ -22,7 +28,7 @@ namespace Three { //! Base class to allow an item to copy properties from another. //! Properties reprensent the current state of an item : its color, //! the position of its manipulated frame, ... -class Scene_item_with_properties { +class DEMO_FRAMEWORK_EXPORT Scene_item_with_properties { public: virtual ~Scene_item_with_properties(){} //!\brief Copies properties from another Scene_item.