mirror of https://github.com/CGAL/cgal
a small bug
This commit is contained in:
parent
0a0d49b535
commit
1f5c21ec14
|
|
@ -18,8 +18,8 @@ typedef Kernel::Point_3 Point;
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
//const std::string INPUT_FILENAME_WITHOUT_EXT = "data/sphere_20k";
|
//const std::string INPUT_FILENAME_WITHOUT_EXT = "data/sphere_20k";
|
||||||
//const std::string INPUT_FILENAME_WITHOUT_EXT = "data/saint_jean_370K";
|
const std::string INPUT_FILENAME_WITHOUT_EXT = "data/saint_jean_370K";
|
||||||
const std::string INPUT_FILENAME_WITHOUT_EXT = "data/qtr_piston_noise";
|
//const std::string INPUT_FILENAME_WITHOUT_EXT = "data/qtr_piston_noise";
|
||||||
|
|
||||||
// Reads a .xyz point set file in points[], *with normals*.
|
// Reads a .xyz point set file in points[], *with normals*.
|
||||||
std::vector<Point> points;
|
std::vector<Point> points;
|
||||||
|
|
@ -58,13 +58,13 @@ int main(void)
|
||||||
|
|
||||||
//way 2 begin
|
//way 2 begin
|
||||||
CGAL::wlop_simplify_and_regularize_point_set<CGAL::Parallel_tag>(
|
CGAL::wlop_simplify_and_regularize_point_set<CGAL::Parallel_tag>(
|
||||||
points.begin(),
|
points.begin(),
|
||||||
points.end(),
|
points.end(),
|
||||||
back_inserter(output),
|
back_inserter(output),
|
||||||
retain_percentage,
|
retain_percentage,
|
||||||
neighbor_radius,
|
neighbor_radius,
|
||||||
iter_number,
|
iter_number,
|
||||||
need_compute_density);
|
need_compute_density);
|
||||||
//way 2 end
|
//way 2 end
|
||||||
|
|
||||||
long memory = CGAL::Memory_sizer().virtual_size();
|
long memory = CGAL::Memory_sizer().virtual_size();
|
||||||
|
|
|
||||||
|
|
@ -214,7 +214,8 @@ compute_density_weight_for_original_point(
|
||||||
FT density_weight = (FT)1.0;
|
FT density_weight = (FT)1.0;
|
||||||
FT iradius16 = -(FT)4.0 / radius2;
|
FT iradius16 = -(FT)4.0 / radius2;
|
||||||
|
|
||||||
std::vector<typename Primitive::Id>::iterator iter = neighbor_original_points.begin();
|
std::vector<typename Primitive::Id>::iterator iter;
|
||||||
|
iter = neighbor_original_points.begin();
|
||||||
for (; iter != neighbor_original_points.end(); iter++)
|
for (; iter != neighbor_original_points.end(); iter++)
|
||||||
{
|
{
|
||||||
Point& np = *(*iter);
|
Point& np = *(*iter);
|
||||||
|
|
@ -265,7 +266,8 @@ compute_density_weight_for_sample_point(
|
||||||
FT density_weight = (FT)1.0;
|
FT density_weight = (FT)1.0;
|
||||||
FT iradius16 = -(FT)4.0 / radius2;
|
FT iradius16 = -(FT)4.0 / radius2;
|
||||||
|
|
||||||
std::vector<typename Primitive::Id>::iterator iter = neighbor_sample_points.begin();
|
std::vector<typename Primitive::Id>::iterator iter;
|
||||||
|
iter = neighbor_sample_points.begin();
|
||||||
for (; iter != neighbor_sample_points.end(); iter++)
|
for (; iter != neighbor_sample_points.end(); iter++)
|
||||||
{
|
{
|
||||||
Point& np = *(*iter);
|
Point& np = *(*iter);
|
||||||
|
|
@ -292,13 +294,14 @@ compute_density_weight_for_sample_point(
|
||||||
///
|
///
|
||||||
/// The core of the algorithm is a Weighted Locally Optimal projection operator
|
/// The core of the algorithm is a Weighted Locally Optimal projection operator
|
||||||
/// with a density uniformization term.
|
/// with a density uniformization term.
|
||||||
/// For more details, please see: http://web.siat.ac.cn/~huihuang/WLOP/WLOP_page.html
|
/// For more details, please see:
|
||||||
|
/// http://web.siat.ac.cn/~huihuang/WLOP/WLOP_page.html
|
||||||
///
|
///
|
||||||
/// @tparam RandomAccessIterator iterator over input points.
|
/// @tparam RandomAccessIterator iterator over input points.
|
||||||
/// @tparam PointPMap is a model of `ReadablePropertyMap`
|
/// @tparam PointPMap is a model of `ReadablePropertyMap`
|
||||||
/// with a value_type = Point_3<Kernel>.
|
/// with a value_type = Point_3<Kernel>.
|
||||||
/// It can be omitted if RandomAccessIterator value_type is convertible to
|
/// It can be omitted if RandomAccessIterator value_type is convertible
|
||||||
/// Point_3<Kernel>.
|
/// to Point_3<Kernel>.
|
||||||
/// @tparam Kernel Geometric traits class.
|
/// @tparam Kernel Geometric traits class.
|
||||||
/// It can be omitted and deduced automatically from PointPMap value_type.
|
/// It can be omitted and deduced automatically from PointPMap value_type.
|
||||||
///
|
///
|
||||||
|
|
@ -327,14 +330,10 @@ wlop_simplify_and_regularize_point_set(
|
||||||
///< slow. Default: 0.05 * diameter of bbox.
|
///< slow. Default: 0.05 * diameter of bbox.
|
||||||
const unsigned int iter_number, ///< number of iterations. Default: 35.
|
const unsigned int iter_number, ///< number of iterations. Default: 35.
|
||||||
const bool need_compute_density, ///< if needed to compute density when the
|
const bool need_compute_density, ///< if needed to compute density when the
|
||||||
///< input is highly nonuniform, but it
|
///< input is nonuniform, Default: ture.
|
||||||
///< takes time. Default: ture.
|
|
||||||
const Kernel& ///< geometric traits.
|
const Kernel& ///< geometric traits.
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
#ifdef CGAL_DEBUG_MODE
|
|
||||||
Timer task_timer;
|
|
||||||
#endif
|
|
||||||
// basic geometric types
|
// basic geometric types
|
||||||
typedef typename Kernel::Point_3 Point;
|
typedef typename Kernel::Point_3 Point;
|
||||||
typedef typename Kernel::Vector_3 Vector;
|
typedef typename Kernel::Vector_3 Vector;
|
||||||
|
|
@ -411,26 +410,19 @@ wlop_simplify_and_regularize_point_set(
|
||||||
FT radius2 = radius * radius;
|
FT radius2 = radius * radius;
|
||||||
CGAL_point_set_processing_precondition(radius > 0);
|
CGAL_point_set_processing_precondition(radius > 0);
|
||||||
|
|
||||||
#ifdef CGAL_DEBUG_MODE
|
|
||||||
task_timer.start();
|
|
||||||
#endif
|
|
||||||
// Initiate a AABB_Tree search for original points
|
// Initiate a AABB_Tree search for original points
|
||||||
AABB_Tree orignal_aabb_tree(first_original_iter, beyond);
|
AABB_Tree orignal_aabb_tree(first_original_iter, beyond);
|
||||||
|
|
||||||
#ifdef CGAL_DEBUG_MODE
|
|
||||||
long memory = CGAL::Memory_sizer().virtual_size();
|
|
||||||
std::cout << "compute density for original done: " << task_timer.time() << " seconds, "
|
|
||||||
<< (memory>>20) << " Mb allocated" << std::endl << std::endl;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
std::vector<Point> update_sample_points(number_of_sample);
|
std::vector<Point> update_sample_points(number_of_sample);
|
||||||
std::vector<Point>::iterator sample_iter;
|
std::vector<Point>::iterator sample_iter;
|
||||||
|
|
||||||
|
#ifdef CGAL_DEBUG_MODE
|
||||||
|
Timer task_timer;
|
||||||
|
task_timer.start();
|
||||||
|
#endif
|
||||||
|
|
||||||
for (unsigned int iter_n = 0; iter_n < iter_number; ++iter_n)
|
for (unsigned int iter_n = 0; iter_n < iter_number; ++iter_n)
|
||||||
{
|
{
|
||||||
#ifdef CGAL_DEBUG_MODE
|
|
||||||
task_timer.reset();
|
|
||||||
#endif
|
|
||||||
RandomAccessIterator first_sample_iter = sample_points.begin();
|
RandomAccessIterator first_sample_iter = sample_points.begin();
|
||||||
AABB_Tree sample_aabb_tree(sample_points.begin(), sample_points.end());
|
AABB_Tree sample_aabb_tree(sample_points.begin(), sample_points.end());
|
||||||
|
|
||||||
|
|
@ -508,10 +500,11 @@ wlop_simplify_and_regularize_point_set(
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CGAL_DEBUG_MODE
|
#ifdef CGAL_DEBUG_MODE
|
||||||
memory = CGAL::Memory_sizer().virtual_size();
|
long memory = CGAL::Memory_sizer().virtual_size();
|
||||||
std::cout << "Iteration: " << iter_n << " takes "
|
std::cout << "Iteration: " << iter_n << " takes "
|
||||||
<< task_timer.time() << " seconds, "
|
<< task_timer.time() << " seconds, "
|
||||||
<< (memory>>20) << " Mb allocated" << std::endl;
|
<< (memory>>20) << " Mb allocated" << std::endl;
|
||||||
|
task_timer.reset();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -548,7 +541,7 @@ wlop_simplify_and_regularize_point_set(
|
||||||
{
|
{
|
||||||
typedef typename boost::property_traits<PointPMap>::value_type Point;
|
typedef typename boost::property_traits<PointPMap>::value_type Point;
|
||||||
typedef typename Kernel_traits<Point>::Kernel Kernel;
|
typedef typename Kernel_traits<Point>::Kernel Kernel;
|
||||||
typedef typename value_type_traits<OutputIterator>::type OutputIteratorType;
|
typedef typename value_type_traits<OutputIterator>::type OutputIteratorType;
|
||||||
return wlop_simplify_and_regularize_point_set
|
return wlop_simplify_and_regularize_point_set
|
||||||
<Concurrency_tag, OutputIteratorType>(
|
<Concurrency_tag, OutputIteratorType>(
|
||||||
first, beyond,
|
first, beyond,
|
||||||
|
|
@ -623,12 +616,13 @@ wlop_simplify_and_regularize_point_set(
|
||||||
<Concurrency_tag, OutputIteratorType>(
|
<Concurrency_tag, OutputIteratorType>(
|
||||||
first, beyond,
|
first, beyond,
|
||||||
output,
|
output,
|
||||||
#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
|
#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
|
||||||
make_dereference_property_map(first),
|
make_dereference_property_map(first),
|
||||||
#else
|
#else
|
||||||
make_identity_property_map(typename std::iterator_traits<RandomAccessIterator >::
|
make_identity_property_map(typename std::iterator_traits
|
||||||
value_type()),
|
<RandomAccessIterator >::
|
||||||
#endif
|
value_type()),
|
||||||
|
#endif
|
||||||
retain_percentage,
|
retain_percentage,
|
||||||
neighbor_radius,
|
neighbor_radius,
|
||||||
max_iter_number,
|
max_iter_number,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue