// Copyright (c) 2005-2008 Max-Planck-Institute Saarbruecken (Germany). // All rights reserved. // // This file is part of CGAL (www.cgal.org). // // $URL: https://github.com/CGAL/cgal/blob/v5.1/Minkowski_sum_3/include/CGAL/minkowski_sum_3.h $ // $Id: minkowski_sum_3.h 0779373 2020-03-26T13:31:46+01:00 Sébastien Loriot // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial // // // Author(s) : Peter Hachenberger #ifndef CGAL_MINKOWSKI_SUM_3_H #define CGAL_MINKOWSKI_SUM_3_H #include #include #include #include /// \file minkowski_sum_3.h namespace CGAL { /*! \ingroup PkgMinkowskiSum3Ref The function `minkowski_sum_3()` computes the Minkowski sum of two given 3D Nef polyhedra \f$ N0\f$ and \f$ N1\f$. Note that the function runs in \f$ O(n^3m^3)\f$ time in the worst case, where \f$ n\f$ and \f$ m\f$ are the complexities of the two input polyhedra (the complexity of a `Nef_polyhedron_3` is the sum of its `Vertices`, `Halfedges` and `SHalfedges`). An input polyhedron may consist of:
  1. singular vertices
  2. singular edges
  3. singular convex facets without holes
  4. surfaces with convex facets that have no holes.
  5. three-dimensional features, whose coplanar facets have common selection marks (this includes open and closed solids)
Taking a different viewpoint, the implementation is restricted as follows:
  1. The input polyhedra must be bounded (selected outer volume is ignored).
  2. All sets of coplanar facets of a full-dimensional feature must have the same selection mark (in case of different selection marks, unselected is assumed).
  3. All facets of lower-dimensional features need to be convex and must not have holes (non-convex facets and holes are ignored).
\post If either of the input polyhedra is non-convex, it is modified during the computation, i.e., it is decomposed into convex pieces. \sa `CGAL::Nef_polyhedron_3` \sa \link CGAL::convex_decomposition_3 `CGAL::convex_decomposition_3()`\endlink */ template Nef_polyhedron_3 minkowski_sum_3(Nef_polyhedron_3& N0, Nef_polyhedron_3& N1) { typedef typename Nef_polyhedron_3::Kernel Kernel; typedef typename Is_extended_kernel::value_type Is_extended_kernel; if(check_tag(Is_extended_kernel())) { std::cerr << "extended kernel is not supported" << std::endl; return N0; } if(N0.volumes_begin()->mark()) { std::cerr << "first parameter is an infinite point set" << std::endl; return N0; } if(N1.volumes_begin()->mark()) { std::cerr << "second parameter is an infinite point set" << std::endl; return N1; } CGAL::convex_decomposition_3(N0); CGAL::convex_decomposition_3(N1); CGAL_assertion(N0.is_valid()); CGAL_assertion(N1.is_valid()); Nef_polyhedron_3 result = CGAL::bipartite_nary_union_sorted_combined(N0, N1); CGAL_assertion(result.is_valid()); return result; } } //namespace CGAL #endif // CGAL_MINKOWSKI_SUM_3_H