Fixed longstanding bug (in some degenerate cases, the cutoff was too small).

This commit is contained in:
Michael Hoffmann 2012-05-24 12:19:58 +00:00
parent 08ee461e38
commit 563203363d
1 changed files with 11 additions and 2 deletions

View File

@ -1136,7 +1136,8 @@ rectangular_3_center_2_type2(
// now s_b corresponds to the first moment in [s, m+1)
// where q_t and q_r cover B
CGAL_optimisation_assertion_code(bool loopcheck = false;)
CGAL_3CENTER_REPEAT_CHECK:
// place q_t and q_r
q_t = op.place_x_square(q_t_afap, r, op.delta()(*s_b));
q_r = op.place_y_square(q_r_afap, r, op.delta()(*s_b));
@ -1157,7 +1158,15 @@ rectangular_3_center_2_type2(
(!Q_t_empty && op.compute_x_distance(q_t, Q_t) > op.delta()(*s_b)) ||
(!Q_r_empty && op.compute_y_distance(q_r, Q_r) > op.delta()(*s_b))) {
// no covering
CGAL_optimisation_assertion(b1 - s >= cutoff);
if (b1 - s < cutoff) {
// in degenerate situations it can happen that the number of
// points in R is too small => decrease radius and check again
--s_b;
CGAL_optimisation_assertion(!loopcheck);
CGAL_optimisation_assertion(s != s_b);
CGAL_optimisation_assertion_code(loopcheck = true;)
goto CGAL_3CENTER_REPEAT_CHECK;
}
s = b1;
rho_min = op.delta()(*s_b);
q_t_at_rho_min = q_t, q_r_at_rho_min = q_r;