From bf86ca842c4b515997a92ccf81c619eb5f026ad6 Mon Sep 17 00:00:00 2001 From: iyaz Date: Fri, 6 Sep 2013 00:48:58 +0300 Subject: [PATCH] add number_of_cluster > 0 as a precondition, fix typos in internal comments --- .../Surface_mesh_segmentation.h | 7 ++++--- .../include/CGAL/mesh_segmentation.h | 12 ++++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/Surface_mesh_segmentation/include/CGAL/internal/Surface_mesh_segmentation/Surface_mesh_segmentation.h b/Surface_mesh_segmentation/include/CGAL/internal/Surface_mesh_segmentation/Surface_mesh_segmentation.h index 511df5ce3b2..b521ae3a828 100644 --- a/Surface_mesh_segmentation/include/CGAL/internal/Surface_mesh_segmentation/Surface_mesh_segmentation.h +++ b/Surface_mesh_segmentation/include/CGAL/internal/Surface_mesh_segmentation/Surface_mesh_segmentation.h @@ -26,7 +26,7 @@ namespace CGAL namespace internal { -// Postprocess functions for sdf values +// Post-process functions for sdf values template class Postprocess_sdf_values { @@ -166,7 +166,7 @@ public: * - Expectation_maximization for soft clustering * - An implementation of alpha-expansion graph cut for hard clustering * - * Other than being a connector, it is also responsable for preprocess and postprocess on intermadiate data, which are: + * Other than being a connector, it is also responsible for pre-process and postprocess on intermediate data, which are: * - log-normalizing probabilities received from soft clustering * - log-normalizing and calculating dihedral-angle based weights for edges * - smoothing and log-normalizing sdf values received from sdf calculation (Filters.h) @@ -244,6 +244,7 @@ public: int partition(int number_of_centers, double smoothing_lambda, SDFPropertyMap sdf_pmap, FacetSegmentMap segment_pmap, bool clusters_to_segments) { + CGAL_precondition(number_of_centers > 0); smoothing_lambda = (std::max)(0.0, smoothing_lambda); // min zero smoothing_lambda *= CGAL_SMOOTHING_LAMBDA_MULTIPLIER; // scale it into meaningful range for graph-cut @@ -335,7 +336,7 @@ private: } /** - * Receives probability-matrix with probabilities betwen [0-1], and returns log-normalized probabilities + * Receives probability-matrix with probabilities between [0-1], and returns log-normalized probabilities * which are suitable to use in graph-cut. * @param[in, out] probabilities probability matrix in [center][facet] order */ diff --git a/Surface_mesh_segmentation/include/CGAL/mesh_segmentation.h b/Surface_mesh_segmentation/include/CGAL/mesh_segmentation.h index 8c05f432629..093a1812ec9 100644 --- a/Surface_mesh_segmentation/include/CGAL/mesh_segmentation.h +++ b/Surface_mesh_segmentation/include/CGAL/mesh_segmentation.h @@ -43,15 +43,18 @@ compute_sdf_values( const Polyhedron& polyhedron, * -1 is used to indicate when no SDF value could be computed for a facet. * * @pre @a polyhedron.is_pure_triangle() + * * @tparam Polyhedron a %CGAL polyhedron * @tparam SDFPropertyMap a `ReadWritePropertyMap` with `Polyhedron::Facet_const_handle` as key and `double` as value type * @tparam GeomTraits a model of SegmentationGeomTraits + * * @param polyhedron surface mesh on which SDF values are computed * @param[out] sdf_values the SDF value of each facet * @param cone_angle opening angle in radians for the cone of each facet * @param number_of_rays number of rays picked in the cone of each facet. In our experiments, we observe that increasing the number of rays beyond the default has a little effect on the quality of the segmentation result * @param postprocess if `true`, `CGAL::postprocess_sdf_values` is called on raw SDF value computed. * @param traits traits class + * * @return minimum and maximum raw SDF values if @a postprocess is `true`, otherwise minimum and maximum SDF values (before linear normalization) */ template 0 + * * @tparam Polyhedron a %CGAL polyhedron * @tparam SDFPropertyMap a `ReadablePropertyMap` with `Polyhedron::Facet_const_handle` as key and `double` as value type * @tparam SegmentPropertyMap a `ReadWritePropertyMap` with `Polyhedron::Facet_const_handle` as key and `int` as value type * @tparam GeomTraits a model of SegmentationGeomTraits + * * @param polyhedron surface mesh corresponding to the SDF values * @param sdf_values the SDF value of each facet between [0-1] * @param[out] segment_ids the segment or cluster id of each facet @@ -133,6 +140,7 @@ postprocess_sdf_values(const Polyhedron& polyhedron, SDFPropertyMap sdf_values) * @param smoothing_lambda factor which indicates the importance of the surface features for the energy minimization. It is recommended to choose a value in the interval [0,1]. See the section \ref Surface_mesh_segmentationGraphCut for more details. * @param extract_segments if `true` fill `segment_ids` with segment-ids and cluster-ids otherwise (see \cgalFigureRef{Cluster_vs_segment}) * @param traits traits class + * * @return number of segments if `extract_segments` is set to `true` and `number_of_clusters` otherwise */ template 0 + * * @tparam Polyhedron a %CGAL polyhedron * @tparam SegmentPropertyMap a `ReadWritePropertyMap` with `Polyhedron::Facet_const_handle` as key and `int` as value type * @tparam GeomTraits a model of SegmentationGeomTraits + * * @param polyhedron surface mesh on which SDF values are computed * @param[out] segment_ids the segment or cluster id of each facet * @param cone_angle opening angle in radians for the cone of each facet @@ -213,6 +224,7 @@ compute_sdf_values_and_segment(const Polyhedron& polyhedron, * @param smoothing_lambda factor which indicates the importance of the surface features for the energy minimization. It is recommended to choose a value in the interval [0,1]. See the section \ref Surface_mesh_segmentationGraphCut for more details. * @param extract_segments if `true` fill `segment_ids` with segment-ids and cluster-ids otherwise (see \cgalFigureRef{Cluster_vs_segment}) * @param traits traits class + * * @return number of segments if `extract_segments` is set to `true` and `number_of_clusters` otherwise */ template < class Polyhedron, class SegmentPropertyMap, class GeomTraits