diff --git a/Kinetic_shape_reconstruction/doc/Kinetic_shape_reconstruction/PackageDescription.txt b/Kinetic_shape_reconstruction/doc/Kinetic_shape_reconstruction/PackageDescription.txt index 0674dc5d6d5..ffd43b3b445 100644 --- a/Kinetic_shape_reconstruction/doc/Kinetic_shape_reconstruction/PackageDescription.txt +++ b/Kinetic_shape_reconstruction/doc/Kinetic_shape_reconstruction/PackageDescription.txt @@ -1,9 +1,15 @@ /*! -\defgroup PkgKineticShapeReconstructionRef Kinetic Shape Reconstruction Reference +\defgroup PkgKineticShapePartitionRef Kinetic Shape Partition Reference -\defgroup PkgKineticPartition Kinetic Partitioning +Reference Manual for the Kinetic Shape Partition component -\addtogroup PkgKineticPartition +\defgroup PkgKineticShapePartitionConcepts Concepts +\ingroup PkgKineticShapePartitionRef + +Concepts used for the parameters of the `CGAL::Kinetic_Shape_Partitioning` + +\defgroup PkgKineticShapePartition Kinetic Shape Partitioning +\ingroup PkgKineticShapePartitionRef \cgalPkgDescriptionBegin{Kinetic Shape Reconstruction, PkgKineticShapeReconstruction} \cgalPkgPicture{kinetic_logo.png} diff --git a/Kinetic_shape_reconstruction/include/CGAL/KSR_3/Finalizer.h b/Kinetic_shape_reconstruction/include/CGAL/KSR_3/Finalizer.h index b4d86c5c305..d38de7eb99d 100644 --- a/Kinetic_shape_reconstruction/include/CGAL/KSR_3/Finalizer.h +++ b/Kinetic_shape_reconstruction/include/CGAL/KSR_3/Finalizer.h @@ -250,7 +250,7 @@ private: // Start new volume cell // First of pair is positive side, second is negative if (pair.first == -1) { - volume_indices[0] = volumes.size(); + volume_indices[0] = volumes.size();222 pair.first = static_cast(volumes.size()); volumes.push_back(Volume_cell()); volumes.back().add_pface(pface, pair.second); @@ -485,29 +485,6 @@ private: } else CGAL_assertion(false); } -/* - else if (im_side == COPLANAR) { - if (ip_side == ON_POSITIVE_SIDE) { - positive_side = dir_edges[ip].second; - negative_side = dir_edges[im].second; - } - else { - positive_side = dir_edges[im].second; - negative_side = dir_edges[ip].second; - } - else CGAL_assertion(false); - } - else if (ip_side == COPLANAR) { - if (im_side == ON_POSITIVE_SIDE) { - positive_side = dir_edges[im].second; - negative_side = dir_edges[ip].second; - } - else { - positive_side = dir_edges[ip].second; - negative_side = dir_edges[im].second; - } - else CGAL_assertion(false); - }*/ else if (ip_side == ON_POSITIVE_SIDE || im_side == ON_NEGATIVE_SIDE) { positive_side = dir_edges[ip].second; negative_side = dir_edges[im].second; @@ -617,7 +594,7 @@ private: Halfedge first = h; do { Halfedge n = h; - Point_3 tn = m_data.support_plane(sp).to_3d(mesh.point(mesh.target(h))); + //Point_3 tn = m_data.support_plane(sp).to_3d(mesh.point(mesh.target(h))); do { if (n == h) @@ -625,7 +602,7 @@ private: else n = mesh.next(mesh.opposite(n)); - Point_3 tn2 = m_data.support_plane(sp).to_3d(mesh.point(mesh.target(h))); + //Point_3 tn2 = m_data.support_plane(sp).to_3d(mesh.point(mesh.target(h))); visited_halfedges[n] = true; f_other = mesh.face(mesh.opposite(n)); diff --git a/Kinetic_shape_reconstruction/include/CGAL/Kinetic_shape_partitioning_3.h b/Kinetic_shape_reconstruction/include/CGAL/Kinetic_shape_partitioning_3.h index 7ed96b934a2..7954c463b25 100644 --- a/Kinetic_shape_reconstruction/include/CGAL/Kinetic_shape_partitioning_3.h +++ b/Kinetic_shape_reconstruction/include/CGAL/Kinetic_shape_partitioning_3.h @@ -44,34 +44,37 @@ namespace CGAL { /*! -* \ingroup PkgKineticPartition +* \ingroup PkgKineticShapePartition \brief Creates the kinetic partitioning of the bounding box. - \tparam Traits + \tparam GeomTraits must be a model of `KineticShapePartitionTraits_3`. + + \tparam IntersectionTraits + must be a model of `Kernel` using exact computations. Defaults to `CGAL::Exact_predicates_exact_constructions_kernel`. */ -template +template class Kinetic_shape_partitioning_3 { public: - using Kernel = typename Traits::Kernel; - using Intersection_Kernel = typename Traits::Intersection_Kernel; + using Kernel = typename GeomTraits; + using Intersection_Kernel = IntersectionTraits; - using Point_3 = typename Traits::Point_3; + using Point_3 = typename GeomTraits::Point_3; private: - using FT = typename Traits::FT; + using FT = typename GeomTraits::FT; using Data_structure = KSR_3::Data_structure; using IVertex = typename Data_structure::IVertex; using IEdge = typename Data_structure::IEdge; - using From_exact = typename Traits::From_exact; + using From_exact = typename CGAL::Cartesian_converter; - using Initializer = KSR_3::Initializer; - using Propagation = KSR_3::FacePropagation; - using Finalizer = KSR_3::Finalizer; + using Initializer = KSR_3::Initializer; + using Propagation = KSR_3::FacePropagation; + using Finalizer = KSR_3::Finalizer; using Polygon_mesh = CGAL::Surface_mesh; using Timer = CGAL::Real_timer; @@ -101,6 +104,11 @@ public: \cgalParamType{bool} \cgalParamDefault{false} \cgalParamNEnd + \cgalParamNBegin{debug} + \cgalParamDescription{Export of intermediate results.} + \cgalParamType{bool} + \cgalParamDefault{false} + \cgalParamNEnd \cgalNamedParamsEnd */ template @@ -165,7 +173,7 @@ public: */ template< typename InputRange, - typename PolygonMap + typename PolygonMap, typename NamedParameters = parameters::Default_named_parameters> Kinetic_shape_partitioning_3( const InputRange& input_range, @@ -191,9 +199,8 @@ public: a range of polygons defined by a range of indices into input_range */ - template< - typename PolygonMap> - bool insert( + template + void insert( const InputRange& input_range, const PolygonMap polygon_map) {} @@ -252,7 +259,7 @@ public: typename InputRange, typename PolygonMap, typename NamedParameters = parameters::Default_named_parameters> - bool initialize( + void initialize( const InputRange& input_range, const PolygonMap polygon_map, const NamedParameters& np = CGAL::parameters::default_values()) { @@ -316,12 +323,9 @@ public: \param k maximum number of allowed intersections for each input polygon before its expansion stops. - @return - success of kinetic partitioning. It can fail if the input data is empty, the partitioning has not been initialized or k is 0. - - \pre `successful initialization` + \pre `successful initialization and k != 0` */ - bool partition(std::size_t k) { + void partition(std::size_t k) { Timer timer; std::cout.precision(20); @@ -329,13 +333,13 @@ public: if (m_data.number_of_support_planes() < 6) { std::cout << "Kinetic partitioning not initialized or empty. Number of support planes: " << m_data.number_of_support_planes() << std::endl; - return false; + return; } if (k == 0) { // for k = 0, we skip propagation std::cout << "k needs to be a positive number" << std::endl; - return false; + return; } if (m_parameters.verbose) { @@ -402,7 +406,7 @@ public: std::cout << "* finalization: " << time_to_finalize << std::endl; } - return true; + return; } /// @} @@ -417,7 +421,7 @@ public: \brief Number of support planes in the kinetic partitioning. They originate from the planes of the input polygons and the bounding box. @return - number of vertices. + number of support planes. \pre `successful partitioning` */ @@ -439,7 +443,7 @@ public: } /*! - \brief Number of convex faces in the kinetic partitioning. + \brief Number of faces in the kinetic partitioning. @return number of faces. @@ -451,7 +455,7 @@ public: } /*! - \brief Number of convex volumes created by the kinetic partitioning. + \brief Number of volumes created by the kinetic partitioning. @return number of volumes. @@ -548,7 +552,7 @@ public: \brief Creates a linear cell complex from the kinetic partitioning. \tparam LCC - Linear_cell_complex_for_combinatorial_map<3, 3,...> + most be a model of `Linear_cell_complex` The dimension of the combinatorial map and the dimension of the ambient space have to be 3. \param lcc diff --git a/Kinetic_shape_reconstruction/include/CGAL/Kinetic_shape_partitioning_Traits.h b/Kinetic_shape_reconstruction/include/CGAL/Kinetic_shape_partitioning_Traits.h deleted file mode 100644 index ef8fd49a7d4..00000000000 --- a/Kinetic_shape_reconstruction/include/CGAL/Kinetic_shape_partitioning_Traits.h +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) 2019 GeometryFactory SARL (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) : Simon Giraudot, Dmitry Anisimov, Sven Oesau - -#ifndef CGAL_KINETIC_SHAPE_PARTITIONING_TRAITS_3_H -#define CGAL_KINETIC_SHAPE_PARTITIONING_TRAITS_3_H - -// #include - -#include - -namespace CGAL { - -/*! - \ingroup PkgKineticPartition - \brief %Default traits class for the `CGAL::Kinetic_shape_partition_3`. - - \cgalModels `KineticShapePartitioningTraits_3` - - \tparam GeomTraits must be a model of the concept `Kernel`. This Kernel is used for non critical calculations and assumed for the input data. - - \tparam IntersectionTraits must be a model of the concept `Kernel`. A Kernel with exact constructions is advised. - - \tparam InputRange must be a model of `Range` with random access iterators, providing input points through the following property map. - - \tparam PointMap must be a model of `ReadablePropertyMap` with `std::iterator_traits::%value_type` as key type and `Geom_traits::Point_3` as value type. -*/ -template -class Kinetic_shape_partitioning_traits_3 { - -public: - using Kernel = GeomTraits; - using Intersection_Kernel = IntersectionTraits; - using Input_range = InputRange; /// must be a model of `ConstRange` whose iterator type is `RandomAccessIterator`and value type is `Point_3` - using Point_map = PointMap; - - using FT = typename Kernel::FT; - - using Point_2 = typename Kernel::Point_2; - using Point_3 = typename Kernel::Point_3; - - using Vector_2 = typename Kernel::Vector_2; - using Vector_3 = typename Kernel::Vector_3; - - using Direction_2 = typename Kernel::Direction_2; - - using Segment_2 = typename Kernel::Segment_2; - using Segment_3 = typename Kernel::Segment_3; - - using Line_2 = typename Kernel::Line_2; - using Line_3 = typename Kernel::Line_3; - - using Plane_3 = typename Kernel::Plane_3; - - using IK_Point_2 = typename Intersection_Kernel::Point_2; - using IK_Point_3 = typename Intersection_Kernel::Point_3; - using IK_Segment_3 = typename Intersection_Kernel::Segment_3; - using IK_Line_3 = typename Intersection_Kernel::Line_3; - - using Transform_3 = typename Kernel::Aff_transformation_3; - - using Triangle_2 = typename Kernel::Triangle_2; - using Triangle_3 = typename Kernel::Triangle_3; - using Tetrahedron_3 = typename Kernel::Tetrahedron_3; - - using From_exact = CGAL::Cartesian_converter; - using To_exact = CGAL::Cartesian_converter; - -}; - -} // namespace CGAL - -#endif // CGAL_KINETIC_SHAPE_PARTITIONING_TRAITS_3_H diff --git a/Kinetic_shape_reconstruction/include/CGAL/Kinetic_shape_reconstruction_3.h b/Kinetic_shape_reconstruction/include/CGAL/Kinetic_shape_reconstruction_3.h index 9c6357e6578..9ca2a1e96b9 100644 --- a/Kinetic_shape_reconstruction/include/CGAL/Kinetic_shape_reconstruction_3.h +++ b/Kinetic_shape_reconstruction/include/CGAL/Kinetic_shape_reconstruction_3.h @@ -20,7 +20,7 @@ namespace CGAL { /*! -* \ingroup PkgKineticPartition +* \ingroup PkgKineticShapePartition \brief Piece-wise linear reconstruction via inside/outside labeling of a kinetic partition using graph cut. \tparam GeomTraits @@ -29,26 +29,26 @@ namespace CGAL \tparam NormalMap must be a model of `ConstRange` whose iterator type is `RandomAccessIterator`. It must map the elements in `KineticShapePartitionTraits_3::Input_range` to `Vector_3`. */ -template +template class Kinetic_shape_reconstruction_3 { public: using Input_range = typename Traits::Input_range; - using Kernel = typename Traits::Kernel; - using Intersection_Kernel = typename Traits::Intersection_Kernel; + using Kernel = typename GeomTraits; + using Intersection_kernel = typename IntersectionKernel; using FT = typename Kernel::FT; - using Point_2 = typename Traits::Point_2; - using Point_3 = typename Traits::Point_3; - using Plane_3 = typename Traits::Plane_3; - - using Point_map = typename Traits::Point_map; - using Normal_map = NormalMap; + using Point_2 = typename Kernel::Point_2; + using Point_3 = typename Kernel::Point_3; + using Plane_3 = typename Kernel::Plane_3; using Indices = std::vector; using Polygon_3 = std::vector; - using KSP = Kinetic_shape_partitioning_3; + using KSP = Kinetic_shape_partitioning_3; + + using Point_map = typename PointMap; + using Normal_map = typename NormalMap; using Mesh = Surface_mesh; diff --git a/STL_Extension/include/CGAL/STL_Extension/internal/parameters_interface.h b/STL_Extension/include/CGAL/STL_Extension/internal/parameters_interface.h index 5ea2aec77cd..c3c4755b9cf 100644 --- a/STL_Extension/include/CGAL/STL_Extension/internal/parameters_interface.h +++ b/STL_Extension/include/CGAL/STL_Extension/internal/parameters_interface.h @@ -256,6 +256,7 @@ CGAL_add_named_parameter(bbox_dilation_ratio_t, bbox_dilation_ratio, bbox_dilati CGAL_add_named_parameter(reorient_bbox_t, reorient_bbox, reorient_bbox) CGAL_add_named_parameter(distance_tolerance_t, distance_tolerance, distance_tolerance) CGAL_add_named_parameter(angle_tolerance_t, angle_tolerance, angle_tolerance) +CGAL_add_named_parameter(debug_t, debug, debug) // region growing CGAL_add_named_parameter(k_neighbors_t, k_neighbors, k_neighbors)