mirror of https://github.com/CGAL/cgal
merge my work into cgal/Triangulation_3-CDT_3-lrineau
This commit is contained in:
commit
4e9ecde5e1
|
|
@ -35,7 +35,6 @@ namespace CGAL {
|
|||
* @cgalModels{ConformingConstrainedDelaunayTriangulationCellBase_3, SimplicialMeshCellBase_3, RemeshingCellBase_3}
|
||||
*
|
||||
* \note This cell base class also models the `SimplicialMeshCellBase_3` and `RemeshingCellBase_3` concepts, allowing the use of functionality from \ref Chapter_Tetrahedral_Remeshing "Tetrahedral Remeshing" and \ref Chapter_3D_Simplicial_Mesh_Data_Structure "3D Simplicial Mesh Data Structures", if the corresponding vertex base also models the right concepts.
|
||||
* \todo After discussion with Jane. Maybe there should be a second pair of Vb/Cb, designed to model the concepts of simplicial mesh and remeshing.
|
||||
*
|
||||
* \sa `CGAL::Conforming_constrained_Delaunay_triangulation_vertex_base_3`
|
||||
*/
|
||||
|
|
@ -46,9 +45,8 @@ class Conforming_constrained_Delaunay_triangulation_cell_base_3
|
|||
using Base = Base_with_time_stamp<Cell_base>;
|
||||
Conforming_constrained_Delaunay_triangulation_cell_data_3 ccdt_3_data_;
|
||||
|
||||
mutable bool sliver_cache_validity_ = false;
|
||||
CDT_3_signed_index subdomain_index_ = -1;
|
||||
double sliver_value_ = 0.;
|
||||
mutable double sliver_value_ = 0.;
|
||||
public:
|
||||
// To get correct cell type in TDS
|
||||
template < class TDS3 >
|
||||
|
|
@ -82,15 +80,14 @@ public:
|
|||
|
||||
// model of RemeshingCellBase_3
|
||||
void set_sliver_value(double value) {
|
||||
sliver_cache_validity_ = true;
|
||||
sliver_value_ = value;
|
||||
}
|
||||
double sliver_value() const {
|
||||
CGAL_assertion(is_cache_valid());
|
||||
return sliver_value_;
|
||||
}
|
||||
bool is_cache_valid() const { return sliver_cache_validity_; }
|
||||
void reset_cache_validity() const { sliver_cache_validity_ = false; }
|
||||
bool is_cache_valid() const { return sliver_value_ != sliver_value_ /* ie is a NaN */; }
|
||||
void reset_cache_validity() const { sliver_value_ = std::numeric_limits<double>::quiet_NaN(); }
|
||||
|
||||
static std::string io_signature() {
|
||||
static_assert(
|
||||
|
|
|
|||
|
|
@ -189,17 +189,17 @@ auto make_conforming_constrained_Delaunay_triangulation_3(const PointRange &poin
|
|||
auto geom_traits_np = parameters::get_parameter(np, internal_np::geom_traits);
|
||||
using Geom_traits_np_type = decltype(geom_traits_np);
|
||||
if constexpr (!std::is_same_v<Geom_traits_np_type, internal_np::Param_not_found>) {
|
||||
return Geom_traits_np_type{};
|
||||
return static_cast<Geom_traits_np_type*>(nullptr);
|
||||
} else {
|
||||
using Point = CGAL::cpp20::remove_cvref_t<decltype(get(point_map, *points.begin()))>;
|
||||
using Kernel = typename CGAL::Kernel_traits<Point>::Kernel;
|
||||
return Kernel{};
|
||||
return static_cast<Kernel*>(nullptr);
|
||||
}
|
||||
};
|
||||
|
||||
using Geom_traits = decltype(get_geom_traits_type());
|
||||
using CDT =
|
||||
typename CGAL::Default::Get<Triangulation, Conforming_constrained_Delaunay_triangulation_3<Geom_traits>>::type;
|
||||
using Geom_traits = std::remove_pointer_t<decltype(get_geom_traits_type())>;
|
||||
using Default_CDT = Conforming_constrained_Delaunay_triangulation_3<Geom_traits>;
|
||||
using CDT = typename CGAL::Default::Get<Triangulation, Default_CDT>::type;
|
||||
CDT cdt(points, polygons, np);
|
||||
auto remeshing_cdt{std::move(cdt).convert_for_remeshing()};
|
||||
static_assert(std::is_same_v<decltype(remeshing_cdt), CDT>);
|
||||
|
|
|
|||
|
|
@ -383,21 +383,19 @@ if(CGAL_Qt6_FOUND AND Qt6_FOUND)
|
|||
target_link_libraries(cgal_lab PRIVATE Qt6::WebSockets)
|
||||
endif()
|
||||
cgal_add_compilation_test(cgal_lab)
|
||||
|
||||
#
|
||||
# the `CGALlab` executable
|
||||
# required as a dependency by all plugins
|
||||
#
|
||||
add_executable(CGALlab CGALlab.cpp)
|
||||
target_link_libraries(CGALlab PRIVATE cgal_lab)
|
||||
add_to_cached_list(CGAL_EXECUTABLE_TARGETS CGALlab)
|
||||
cgal_add_compilation_test(CGALlab)
|
||||
|
||||
target_link_libraries(CGALlab PRIVATE demo_framework)
|
||||
|
||||
# Link with CGAL
|
||||
target_link_libraries(CGALlab PRIVATE CGAL::CGAL_Qt6)
|
||||
|
||||
add_to_cached_list(CGAL_EXECUTABLE_TARGETS CGALlab)
|
||||
|
||||
###########
|
||||
# PLUGINS #
|
||||
###########
|
||||
#
|
||||
# PLUGINS
|
||||
#
|
||||
|
||||
file(
|
||||
GLOB DEMO_PLUGINS
|
||||
|
|
@ -409,11 +407,14 @@ if(CGAL_Qt6_FOUND AND Qt6_FOUND)
|
|||
|
||||
add_subdirectory(implicit_functions)
|
||||
|
||||
add_dependencies(CDT_3 IO_surface_meshes detect_sharp_edges_plugin)
|
||||
add_dependencies(Mesh_3 IO_surface_meshes)
|
||||
|
||||
#
|
||||
# EXECUTABLES
|
||||
#
|
||||
add_executable(CGAL_Mesh_3 Mesh_3.cpp)
|
||||
add_dependencies(CGAL_Mesh_3 Mesh_3)
|
||||
add_dependencies(CGAL_Mesh_3 Mesh_3 IO_surface_meshes)
|
||||
target_link_libraries(CGAL_Mesh_3 PRIVATE cgal_lab)
|
||||
add_to_cached_list(CGAL_EXECUTABLE_TARGETS CGAL_Mesh_3)
|
||||
|
||||
|
|
|
|||
|
|
@ -9,15 +9,16 @@ class File_loader_dialog : public QDialog, private Ui::FileLoaderDialog
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
File_loader_dialog()
|
||||
File_loader_dialog(QWidget* parent = nullptr)
|
||||
: QDialog(parent)
|
||||
{
|
||||
setupUi(this);
|
||||
}
|
||||
static
|
||||
std::pair<QString,bool>
|
||||
getItem(QString filename, const QStringList& item_list, bool* ok)
|
||||
getItem(QWidget* parent, QString filename, const QStringList& item_list, bool* ok)
|
||||
{
|
||||
File_loader_dialog dialog;
|
||||
File_loader_dialog dialog(parent);
|
||||
dialog.buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
|
||||
dialog.buttonBox->button(QDialogButtonBox::Ok)->setFocus();
|
||||
dialog.pluginBox->addItems(item_list);
|
||||
|
|
|
|||
|
|
@ -1129,10 +1129,10 @@ void MainWindow::open(QString filename)
|
|||
ok=true;
|
||||
break;
|
||||
case 0:
|
||||
load_pair = File_loader_dialog::getItem(fileinfo.fileName(), all_items, &ok);
|
||||
load_pair = File_loader_dialog::getItem(this, fileinfo.fileName(), all_items, &ok);
|
||||
break;
|
||||
default:
|
||||
load_pair = File_loader_dialog::getItem(fileinfo.fileName(), selected_items, &ok);
|
||||
load_pair = File_loader_dialog::getItem(this, fileinfo.fileName(), selected_items, &ok);
|
||||
}
|
||||
//viewer->makeCurrent();
|
||||
if(!ok || load_pair.first.isEmpty()) { return; }
|
||||
|
|
|
|||
|
|
@ -58,62 +58,59 @@ class CDT_3_plugin : public QObject, public CGAL_Lab_plugin_interface
|
|||
|
||||
void cdt_3()
|
||||
{
|
||||
for(CGAL::Three::Scene_interface::Item_id index : scene->selectionIndices())
|
||||
{
|
||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
Scene_surface_mesh_item* mesh_item =
|
||||
qobject_cast<Scene_surface_mesh_item*>(scene->item(scene->mainSelectionIndex()));
|
||||
Scene_polygon_soup_item* soup_item =
|
||||
qobject_cast<Scene_polygon_soup_item*>(scene->item(index));
|
||||
if(mesh_item)
|
||||
{
|
||||
auto* mesh = mesh_item->face_graph();
|
||||
if(!mesh)
|
||||
return;
|
||||
auto patch_id_pmap = mesh->property_map<SMesh::Face_index, int>("f:patch_id");
|
||||
auto cdt = patch_id_pmap
|
||||
? CGAL::make_conforming_constrained_Delaunay_triangulation_3(*mesh, CGAL::parameters::face_patch_map(*patch_id_pmap))
|
||||
: CGAL::make_conforming_constrained_Delaunay_triangulation_3(*mesh);
|
||||
auto triangulation_item = std::make_unique<Scene_c3t3_item>();
|
||||
auto& item_tr = triangulation_item->triangulation();
|
||||
CGAL::Three::OverrideCursorScopeGuard guard(Qt::WaitCursor);
|
||||
Scene_item* item = scene->item(scene->mainSelectionIndex());
|
||||
Scene_surface_mesh_item* mesh_item = qobject_cast<Scene_surface_mesh_item*>(item);
|
||||
Scene_polygon_soup_item* soup_item = qobject_cast<Scene_polygon_soup_item*>(item);
|
||||
if(mesh_item)
|
||||
item = mesh_item;
|
||||
else if(soup_item)
|
||||
item = soup_item;
|
||||
else
|
||||
item = nullptr;
|
||||
|
||||
const auto cdt_tr = CGAL::convert_to_triangulation_3(cdt);
|
||||
auto inf_v = item_tr.tds().copy_tds(cdt_tr.tds(), cdt_tr.infinite_vertex(), Vertex_converter(), Cell_converter());
|
||||
item_tr.set_infinite_vertex(inf_v);
|
||||
triangulation_item->c3t3_changed();
|
||||
|
||||
triangulation_item->setParent(mesh_item->parent());
|
||||
triangulation_item->setName("CDT of " + mesh_item->name());
|
||||
triangulation_item->show_intersection(false);
|
||||
scene->addItem(triangulation_item.release());
|
||||
mesh_item->setVisible(false);
|
||||
}
|
||||
else if(soup_item)
|
||||
{
|
||||
auto cdt = CGAL::make_conforming_constrained_Delaunay_triangulation_3(
|
||||
soup_item->points(), soup_item->polygons());
|
||||
|
||||
auto triangulation_item = std::make_unique<Scene_c3t3_item>();
|
||||
auto& item_tr = triangulation_item->triangulation();
|
||||
|
||||
const auto cdt_tr = CGAL::convert_to_triangulation_3(cdt);
|
||||
auto inf_v =
|
||||
item_tr.tds().copy_tds(cdt_tr.tds(), cdt_tr.infinite_vertex(), Vertex_converter(), Cell_converter());
|
||||
item_tr.set_infinite_vertex(inf_v);
|
||||
triangulation_item->c3t3_changed();
|
||||
|
||||
triangulation_item->setParent(soup_item->parent());
|
||||
triangulation_item->setName("CDT of " + soup_item->name());
|
||||
triangulation_item->show_intersection(false);
|
||||
scene->addItem(triangulation_item.release());
|
||||
soup_item->setVisible(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
CGAL::Three::Three::warning(tr("This function is only applicable on PLCs and polygon soups."));
|
||||
}
|
||||
if(item == nullptr) {
|
||||
CGAL::Three::Three::warning(tr("This function is only applicable on PLCs and polygon soups."));
|
||||
return;
|
||||
}
|
||||
QApplication::restoreOverrideCursor();
|
||||
|
||||
auto* const mesh = mesh_item ? mesh_item->face_graph() : nullptr;
|
||||
if(!mesh) return;
|
||||
|
||||
using CDT = CGAL::Conforming_constrained_Delaunay_triangulation_3<EPICK>;
|
||||
CDT cdt = std::invoke([&] {
|
||||
CDT cdt;
|
||||
if(mesh_item) {
|
||||
auto patch_id_pmap_opt = mesh->property_map<SMesh::Face_index, int>("f:patch_id");
|
||||
|
||||
if(patch_id_pmap_opt.has_value()) {
|
||||
cdt = CGAL::make_conforming_constrained_Delaunay_triangulation_3(
|
||||
*mesh, CGAL::parameters::face_patch_map(*patch_id_pmap_opt));
|
||||
}
|
||||
else {
|
||||
cdt = CGAL::make_conforming_constrained_Delaunay_triangulation_3(*mesh);
|
||||
}
|
||||
}
|
||||
else if(soup_item) {
|
||||
cdt = CGAL::make_conforming_constrained_Delaunay_triangulation_3(
|
||||
soup_item->points(), soup_item->polygons());
|
||||
|
||||
}
|
||||
return cdt;
|
||||
});
|
||||
auto triangulation_item = std::make_unique<Scene_c3t3_item>();
|
||||
auto& item_tr = triangulation_item->triangulation();
|
||||
|
||||
const auto cdt_tr = CGAL::convert_to_triangulation_3(std::move(cdt));
|
||||
auto inf_v = item_tr.tds().copy_tds(cdt_tr.tds(), cdt_tr.infinite_vertex(), Vertex_converter(), Cell_converter());
|
||||
item_tr.set_infinite_vertex(inf_v);
|
||||
triangulation_item->c3t3_changed();
|
||||
|
||||
triangulation_item->setParent(item->parent());
|
||||
triangulation_item->setName("CDT of " + item->name());
|
||||
triangulation_item->show_intersection(false);
|
||||
scene->addItem(triangulation_item.release());
|
||||
item->setVisible(false);
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ target_link_libraries(lcc_io_plugin PRIVATE scene_lcc_item)
|
|||
find_package(OpenMesh QUIET)
|
||||
if(OpenMesh_FOUND)
|
||||
include(CGAL_OpenMesh_support)
|
||||
cgal_lab_plugin(om_plugin OM_io_plugin KEYWORDS Viewer PMP)
|
||||
cgal_lab_plugin(om_plugin OM_io_plugin KEYWORDS Viewer PMP IO_surface_meshes)
|
||||
target_link_libraries(om_plugin PUBLIC scene_surface_mesh_item scene_polygon_soup_item scene_selection_item)
|
||||
target_link_libraries(om_plugin PRIVATE CGAL::OpenMesh_support)
|
||||
else()
|
||||
|
|
@ -71,7 +71,7 @@ endif()
|
|||
|
||||
if(VTK_FOUND AND VTK_LIBRARIES)
|
||||
message(STATUS "VTK ${VTK_VERSION} found ${VTK_LIBRARIES}")
|
||||
cgal_lab_plugin(vtk_plugin VTK_io_plugin KEYWORDS Viewer Mesh_3)
|
||||
cgal_lab_plugin(vtk_plugin VTK_io_plugin KEYWORDS Viewer IO_surface_meshes)
|
||||
target_link_libraries(vtk_plugin
|
||||
PRIVATE
|
||||
scene_surface_mesh_item
|
||||
|
|
@ -119,7 +119,7 @@ if(3MF_LIBRARIES
|
|||
AND 3MF_INCLUDE_DIR
|
||||
AND EXISTS "${3MF_INCLUDE_DIR}/Model/COM/NMR_DLLInterfaces.h")
|
||||
include_directories(${3MF_INCLUDE_DIR})
|
||||
cgal_lab_plugin(io_3mf_plugin 3mf_io_plugin KEYWORDS Viewer PMP)
|
||||
cgal_lab_plugin(io_3mf_plugin 3mf_io_plugin KEYWORDS Viewer PMP IO_surface_meshes)
|
||||
target_link_libraries(io_3mf_plugin PRIVATE scene_surface_mesh_item scene_points_with_normal_item scene_polylines_item ${3MF_LIBRARIES})
|
||||
target_compile_definitions(io_3mf_plugin PRIVATE -DCGAL_LINKED_WITH_3MF)
|
||||
else()
|
||||
|
|
|
|||
|
|
@ -35,11 +35,19 @@
|
|||
|
||||
namespace CGAL{
|
||||
namespace Three{
|
||||
//define enum depending on Qt version
|
||||
|
||||
struct OverrideCursorScopeGuard
|
||||
{
|
||||
OverrideCursorScopeGuard(QCursor cursor) { QApplication::setOverrideCursor(cursor); }
|
||||
~OverrideCursorScopeGuard() { QApplication::restoreOverrideCursor(); }
|
||||
};
|
||||
|
||||
class CGAL_Lab_plugin_interface;
|
||||
class THREE_EXPORT Three{
|
||||
public:
|
||||
|
||||
using CursorScopeGuard = CGAL::Three::OverrideCursorScopeGuard; // for compatibility
|
||||
|
||||
Three();
|
||||
virtual ~Three(){}
|
||||
static QMainWindow* mainWindow();
|
||||
|
|
@ -122,19 +130,6 @@ protected:
|
|||
static QMutex* s_mutex;
|
||||
static QWaitCondition* s_wait_condition;
|
||||
static bool s_is_locked;
|
||||
|
||||
public:
|
||||
struct CursorScopeGuard
|
||||
{
|
||||
CursorScopeGuard(QCursor cursor)
|
||||
{
|
||||
QApplication::setOverrideCursor(cursor);
|
||||
}
|
||||
~CursorScopeGuard()
|
||||
{
|
||||
QApplication::restoreOverrideCursor();
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue