Implement append operation in Nef_polyhedron_3

This commit is contained in:
Giles Bathgate 2022-01-03 16:01:29 +00:00
parent 7fc5f0eb91
commit 2d2507b364
2 changed files with 53 additions and 0 deletions

View File

@ -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 <CGAL/license/Nef_3.h>
#include <CGAL/Nef_polyhedron_3.h>
#include <CGAL/Nef_3/shell_to_nef_3.h>
namespace CGAL {
template<typename Nef_3>
class Append_volumes : public Modifier_base<typename Nef_3::SNC_structure>
{
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

View File

@ -43,6 +43,7 @@
#include <CGAL/Nef_polyhedron_S2.h>
#include <CGAL/Modifier_base.h>
#include <CGAL/Nef_3/Mark_bounded_volumes.h>
#include <CGAL/Nef_3/Append_volumes.h>
#include <CGAL/IO/Verbose_ostream.h>
#include <CGAL/Nef_3/polygon_mesh_to_nef_3.h>
@ -1441,6 +1442,16 @@ protected:
return res;
}
Nef_polyhedron_3<Kernel,Items, Mark>
append(const Nef_polyhedron_3<Kernel,Items, Mark>& N1)
/*{\Mop returns |\Mvar| with N1 appended }*/ {
CGAL_NEF_TRACEN(" append between nef3 "<<&*this<<" and "<<&N1);
Append_volumes<Nef_polyhedron_3> appender(N1);
delegate(appender,true,false);
mark_bounded_volumes();
return *this;
}
Nef_polyhedron_3<Kernel,Items, Mark>
difference(const Nef_polyhedron_3<Kernel,Items, Mark>& N1) const
/*{\Mop returns |\Mvar| $-$ |N1|. }*/ {