From 2d2507b3644ee9b232cfb4c3a931bb951d01ffdf Mon Sep 17 00:00:00 2001 From: Giles Bathgate Date: Mon, 3 Jan 2022 16:01:29 +0000 Subject: [PATCH] Implement append operation in Nef_polyhedron_3 --- Nef_3/include/CGAL/Nef_3/Append_volumes.h | 42 +++++++++++++++++++++++ Nef_3/include/CGAL/Nef_polyhedron_3.h | 11 ++++++ 2 files changed, 53 insertions(+) create mode 100644 Nef_3/include/CGAL/Nef_3/Append_volumes.h diff --git a/Nef_3/include/CGAL/Nef_3/Append_volumes.h b/Nef_3/include/CGAL/Nef_3/Append_volumes.h new file mode 100644 index 00000000000..69a292fa7c2 --- /dev/null +++ b/Nef_3/include/CGAL/Nef_3/Append_volumes.h @@ -0,0 +1,42 @@ +// Copyright (c) 2022 Max-Planck-Institute Saarbruecken (Germany). +// 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 +// +// + +#ifndef CGAL_NEF3_APPEND_VOLUMES_H +#define CGAL_NEF3_APPEND_VOLUMES_H + +#include + + +#include +#include + +namespace CGAL { + +template +class Append_volumes : public Modifier_base +{ + typedef typename Nef_3::SNC_structure SNC_structure; + typedef typename Nef_3::Shell_entry_const_iterator Shell_entry_const_iterator; +public: + Append_volumes (const Nef_3& n) : nef(n) {} + + void operator()(SNC_structure& snc) + { + Shell_entry_const_iterator si; + CGAL_forall_shells_of(si,nef.volumes_begin()) + CGAL::shell_to_nef_3(nef,si,snc); + } +private: + const Nef_3& nef; +}; + +} //namespace CGAL +#endif // CGAL_NEF3_APPEND_VOLUMES_H diff --git a/Nef_3/include/CGAL/Nef_polyhedron_3.h b/Nef_3/include/CGAL/Nef_polyhedron_3.h index 74bb56ba885..48c23dcc085 100644 --- a/Nef_3/include/CGAL/Nef_polyhedron_3.h +++ b/Nef_3/include/CGAL/Nef_polyhedron_3.h @@ -43,6 +43,7 @@ #include #include #include +#include #include #include @@ -1441,6 +1442,16 @@ protected: return res; } + Nef_polyhedron_3 + append(const Nef_polyhedron_3& N1) + /*{\Mop returns |\Mvar| with N1 appended }*/ { + CGAL_NEF_TRACEN(" append between nef3 "<<&*this<<" and "<<&N1); + Append_volumes appender(N1); + delegate(appender,true,false); + mark_bounded_volumes(); + return *this; + } + Nef_polyhedron_3 difference(const Nef_polyhedron_3& N1) const /*{\Mop returns |\Mvar| $-$ |N1|. }*/ {