From 2a25a6080eb3ca09023a29e10cf8fda6b08e7ad1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 27 Mar 2025 18:51:01 +0100 Subject: [PATCH] use exception --- .../Self_intersection_exception.h | 34 +++++++++++++++++++ .../Corefinement/intersection_callbacks.h | 9 +---- .../refine_with_plane.h | 3 +- 3 files changed, 37 insertions(+), 9 deletions(-) create mode 100644 Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Self_intersection_exception.h diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Self_intersection_exception.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Self_intersection_exception.h new file mode 100644 index 00000000000..5dec557d109 --- /dev/null +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Self_intersection_exception.h @@ -0,0 +1,34 @@ +// Copyright (c) 2016 GeometryFactory (France). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org). +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial +// +// +// Author(s) : Sebastien Loriot + +#ifndef CGAL_POLYGON_MESH_PROCESSING_INTERNAL_SELF_INTERSECTION_EXCEPTION_H +#define CGAL_POLYGON_MESH_PROCESSING_INTERNAL_SELF_INTERSECTION_EXCEPTION_H + +#include + +#include + +namespace CGAL { +namespace Polygon_mesh_processing { +namespace Corefinement { + +struct Self_intersection_exception : + public std::runtime_error +{ + Self_intersection_exception() + : std::runtime_error("Self-intersection detected in input mesh") + {} +}; + +} } } // end of CGAL::Polygon_mesh_processing::Corefinement + +#endif // CGAL_POLYGON_MESH_PROCESSING_INTERNAL_SELF_INTERSECTION_EXCEPTION_H diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/intersection_callbacks.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/intersection_callbacks.h index d96f289ef83..6e0a2f38f9c 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/intersection_callbacks.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/intersection_callbacks.h @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -28,14 +29,6 @@ namespace CGAL { namespace Polygon_mesh_processing { namespace Corefinement { -struct Self_intersection_exception : - public std::runtime_error -{ - Self_intersection_exception() - : std::runtime_error("Self-intersection detected in input mesh") - {} -}; - template class Collect_face_bbox_per_edge_bbox { protected: diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/refine_with_plane.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/refine_with_plane.h index f7b4cc172e1..f7fe7c1cd15 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/refine_with_plane.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/refine_with_plane.h @@ -20,6 +20,7 @@ #include #include #include +#include #ifndef CGAL_PLANE_CLIP_DO_NOT_USE_BOX_INTERSECTION_D #include #endif @@ -353,7 +354,7 @@ void refine_with_plane(PolygonMesh& pm, auto last = std::unique(test_faces.begin(), test_faces.end()); test_faces.erase(last, test_faces.end()); if (does_self_intersect(test_faces, pm, np)) - throw std::runtime_error("TODO Corefinement::Self_intersection_exception"); + throw Corefinement::Self_intersection_exception(); } //TODO: parallel for