CGAL::Bbox_3 might behave differently in Debug/Release mode.

This commit is contained in:
Shihao Wu 2015-02-19 15:41:37 +02:00
parent 6fc6e1ef42
commit ad20bfab93
3 changed files with 31 additions and 3 deletions

View File

@ -38,7 +38,7 @@ int main(int argc, char* argv[])
//Algorithm parameters //Algorithm parameters
const double sharpness_angle = 25; // control sharpness of the result. const double sharpness_angle = 25; // control sharpness of the result.
const double edge_sensitivity = 0; // higher values will sample more points near the edges const double edge_sensitivity = 0; // higher values will sample more points near the edges
const double neighbor_radius = 0.45; // initial size of neighborhood. const double neighbor_radius = 0.25; // initial size of neighborhood.
const unsigned int number_of_output_points = points.size() * 4; const unsigned int number_of_output_points = points.size() * 4;
//Run algorithm //Run algorithm

View File

@ -74,6 +74,15 @@ base_point_selection(
typedef typename Kernel::FT FT; typedef typename Kernel::FT FT;
typedef typename rich_grid_internal::Rich_point<Kernel> Rich_point; typedef typename rich_grid_internal::Rich_point<Kernel> Rich_point;
if (neighbor_points.empty())
{
#ifdef CGAL_DEBUG_MODE
std::cout << "empty neighborhood" << std::endl;
#endif
output_base_index = query.index;
return 0.0;
}
FT best_dist2 = -10.0; FT best_dist2 = -10.0;
const Rich_point& v = query; const Rich_point& v = query;
typename std::vector<Rich_point>::const_iterator iter = neighbor_points.begin(); typename std::vector<Rich_point>::const_iterator iter = neighbor_points.begin();
@ -324,6 +333,8 @@ edge_aware_upsample_point_set(
typename Kernel::FT neighbor_radius, ///< typename Kernel::FT neighbor_radius, ///<
///< indicates the radius of the largest hole that should be filled. ///< indicates the radius of the largest hole that should be filled.
///< The default value is set to 3 times the average spacing of the point set. ///< The default value is set to 3 times the average spacing of the point set.
///< If the value given by user is smaller than the default value,
///< the function will use the default value instead.
const unsigned int number_of_output_points,///< number of output const unsigned int number_of_output_points,///< number of output
///< points to generate. ///< points to generate.
const Kernel& /*kernel*/ ///< geometric traits. const Kernel& /*kernel*/ ///< geometric traits.
@ -354,7 +365,14 @@ edge_aware_upsample_point_set(
first, beyond, first, beyond,
point_pmap, point_pmap,
nb_neighbors); nb_neighbors);
neighbor_radius = average_spacing * 2.0;
if (neighbor_radius < average_spacing * 3.0)
{
neighbor_radius = average_spacing * 3.0;
#ifdef CGAL_DEBUG_MODE
std::cout << "neighbor radius: " << neighbor_radius << std::endl;
#endif
}
Timer task_timer; Timer task_timer;
@ -362,6 +380,9 @@ edge_aware_upsample_point_set(
// copy rich point set // copy rich point set
std::vector<Rich_point> rich_point_set(number_of_input); std::vector<Rich_point> rich_point_set(number_of_input);
CGAL::Bbox_3 bbox; CGAL::Bbox_3 bbox;
Point p_temp(0., 0., 0.);
bbox += p_temp.bbox();
ForwardIterator it = first; // point iterator ForwardIterator it = first; // point iterator
for(unsigned int i = 0; it != beyond; ++it, ++i) for(unsigned int i = 0; it != beyond; ++it, ++i)
{ {
@ -378,6 +399,9 @@ edge_aware_upsample_point_set(
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);
} }
std::cout << bbox.xmin() << " " << bbox.xmax() << " " << bbox.ymin() << " " << bbox.ymin() << " " << std::endl;
system("Pause");
// compute neighborhood // compute neighborhood
rich_grid_internal::compute_ball_neighbors_one_self(rich_point_set, rich_grid_internal::compute_ball_neighbors_one_self(rich_point_set,
bbox, bbox,
@ -452,7 +476,7 @@ edge_aware_upsample_point_set(
density_pass_threshold = sqrt(sum_density / count_density) * 0.65; density_pass_threshold = sqrt(sum_density / count_density) * 0.65;
sum_density = 0.; sum_density = 0.;
count_density = 0; count_density = 1;
FT density_pass_threshold2 = density_pass_threshold * FT density_pass_threshold2 = density_pass_threshold *
density_pass_threshold; density_pass_threshold;

View File

@ -190,10 +190,14 @@ void Rich_grid<Kernel>::init(std::vector<Rich_point<Kernel> > &vert,
radius = _radius; radius = _radius;
std::cout << "bbox.xmax() " << bbox.xmax() << std::endl;
std::cout << "bbox.xmin() " << bbox.xmin() << std::endl;
x_side = (unsigned int)ceil((bbox.xmax() - bbox.xmin()) / radius); x_side = (unsigned int)ceil((bbox.xmax() - bbox.xmin()) / radius);
y_side = (unsigned int)ceil((bbox.ymax() - bbox.ymin()) / radius); y_side = (unsigned int)ceil((bbox.ymax() - bbox.ymin()) / radius);
z_side = (unsigned int)ceil((bbox.zmax() - bbox.zmin()) / radius); z_side = (unsigned int)ceil((bbox.zmax() - bbox.zmin()) / radius);
std::cout << "x side " << x_side << std::endl;
x_side = (x_side > 0) ? x_side : 1; x_side = (x_side > 0) ? x_side : 1;
y_side = (y_side > 0) ? y_side : 1; y_side = (y_side > 0) ? y_side : 1;