From 03fbb454c616c40beb4a6ea281ded46007907f61 Mon Sep 17 00:00:00 2001 From: Shihao Wu Date: Sun, 14 Dec 2014 19:29:00 +0800 Subject: [PATCH] fixed a bug: added a radius parameter in Pwn_updater. --- .../include/CGAL/bilateral_smooth_point_set.h | 56 ++++++------------- .../CGAL/edge_aware_upsample_point_set.h | 2 +- 2 files changed, 17 insertions(+), 41 deletions(-) diff --git a/Point_set_processing_3/include/CGAL/bilateral_smooth_point_set.h b/Point_set_processing_3/include/CGAL/bilateral_smooth_point_set.h index fa48dc25503..a5407f61711 100644 --- a/Point_set_processing_3/include/CGAL/bilateral_smooth_point_set.h +++ b/Point_set_processing_3/include/CGAL/bilateral_smooth_point_set.h @@ -110,8 +110,8 @@ template CGAL::Point_with_normal_3 compute_denoise_projection( const CGAL::Point_with_normal_3& query, ///< 3D point to project - const std::vector,tbb:: - scalable_allocator > >& neighbor_pwns, // + const std::vector, + tbb::scalable_allocator > >& neighbor_pwns, // typename Kernel::FT radius, ///< accept neighborhood radius typename Kernel::FT sharpness_angle ///< control sharpness(0-90) ) @@ -284,16 +284,19 @@ class Pwn_updater typedef typename Kernel::FT FT; FT sharpness_angle; + FT radius; Pwns* pwns; Pwns* update_pwns; std::vector >* pwns_neighbors; public: - Pwn_updater(FT s, + Pwn_updater(FT sharpness, + FT r, Pwns *in, Pwns *out, std::vector >* neighbors): - sharpness_angle(s), + sharpness_angle(sharpness), + radius(r), pwns(in), update_pwns(out), pwns_neighbors(neighbors){} @@ -306,7 +309,7 @@ public: (*update_pwns)[i] = bilateral_smooth_point_set_internal:: compute_denoise_projection((*pwns)[i], (*pwns_neighbors)[i], - 0.15, + radius, sharpness_angle); } @@ -401,7 +404,7 @@ bilateral_smooth_point_set( const Point& p = get(point_pmap, *it); const Vector& n = get(normal_pmap, *it); #endif - CGAL_point_set_processing_precondition(n.squared_length() < 1e-10); + CGAL_point_set_processing_precondition(n.squared_length() > 1e-10); pwns.push_back(Pwn(p, n)); } @@ -427,43 +430,15 @@ bilateral_smooth_point_set( CGAL::Timer task_timer; task_timer.start(); #endif - FT guess_neighbor_radius = (FT)(std::numeric_limits::max)(); + FT guess_neighbor_radius = 0.0; -#ifdef CGAL_LINKED_WITH_TBB - if (boost::is_convertible::value) + for(pwn_iter = pwns.begin(); pwn_iter != pwns.end(); ++pwn_iter) { - //tbb::task_scheduler_init init(4); - - #ifdef CGAL_DEBUG_MODE - std::cout<<"parallel mode !"<(0,nb_points), - [&](const tbb::blocked_range& r) - { - for (size_t i = r.begin(); i != r.end(); i++) - { - FT max_spacing = bilateral_smooth_point_set_internal:: - compute_max_spacing(pwns[i], tree, k); - - guess_neighbor_radius = (CGAL::max)(max_spacing, guess_neighbor_radius); - } - } - ); - } - else -#endif - { - #ifdef CGAL_DEBUG_MODE - std::cout<<"sequential mode!"<(*pwn_iter, tree, k); - guess_neighbor_radius = (CGAL::max)(max_spacing, guess_neighbor_radius); - } + FT max_spacing = bilateral_smooth_point_set_internal:: + compute_max_spacing(*pwn_iter, tree, k); + guess_neighbor_radius = (CGAL::max)(max_spacing, guess_neighbor_radius); } + #ifdef CGAL_DEBUG_MODE task_timer.stop(); #endif @@ -528,6 +503,7 @@ bilateral_smooth_point_set( //tbb::task_scheduler_init init(4); tbb::blocked_range block(0, nb_points); Pwn_updater pwn_updater(sharpness_angle, + guess_neighbor_radius, &pwns, &update_pwns, &pwns_neighbors); diff --git a/Point_set_processing_3/include/CGAL/edge_aware_upsample_point_set.h b/Point_set_processing_3/include/CGAL/edge_aware_upsample_point_set.h index 8f4c96b7d8f..fb415ed9811 100644 --- a/Point_set_processing_3/include/CGAL/edge_aware_upsample_point_set.h +++ b/Point_set_processing_3/include/CGAL/edge_aware_upsample_point_set.h @@ -365,7 +365,7 @@ edge_aware_upsample_point_set( rich_point_set[i].index = i; bbox += rich_point_set[i].pt.bbox(); - CGAL_point_set_processing_precondition(rich_point_set[i].normal.squared_length() < 1e-10); + CGAL_point_set_processing_precondition(rich_point_set[i].normal.squared_length() > 1e-10); } // compute neighborhood