mirror of https://github.com/CGAL/cgal
- Fix "warning: array subscript is above array bounds" with g++ -O3.
It was actually a real bug. - Rewrote the loops for clarity as well.
This commit is contained in:
parent
a944d53927
commit
eede712857
|
|
@ -321,14 +321,12 @@ Triangulation_hierarchy_3<Tr>::
|
||||||
remove(Vertex_handle v)
|
remove(Vertex_handle v)
|
||||||
{
|
{
|
||||||
CGAL_triangulation_precondition(v != Vertex_handle());
|
CGAL_triangulation_precondition(v != Vertex_handle());
|
||||||
Vertex_handle u = v->up();
|
for (int l = 0; l < maxlevel; ++l) {
|
||||||
int l = 0;
|
Vertex_handle u = v->up();
|
||||||
while (1) {
|
hierarchy[l]->remove(v);
|
||||||
hierarchy[l++]->remove(v);
|
if (u == Vertex_handle())
|
||||||
if (u == Vertex_handle() || l > maxlevel)
|
|
||||||
break;
|
break;
|
||||||
v = u;
|
v = u;
|
||||||
u = v->up();
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -339,23 +337,24 @@ Triangulation_hierarchy_3<Tr>::
|
||||||
move_point(Vertex_handle v, const Point & p)
|
move_point(Vertex_handle v, const Point & p)
|
||||||
{
|
{
|
||||||
CGAL_triangulation_precondition(v != Vertex_handle());
|
CGAL_triangulation_precondition(v != Vertex_handle());
|
||||||
Vertex_handle u = v->up();
|
|
||||||
Vertex_handle old, ret;
|
Vertex_handle old, ret;
|
||||||
int l = 0;
|
|
||||||
while (1) {
|
for (int l = 0; l < maxlevel; ++l) {
|
||||||
Vertex_handle w = hierarchy[l++]->move_point(v, p);
|
Vertex_handle u = v->up();
|
||||||
if (l == 1)
|
Vertex_handle w = hierarchy[l]->move_point(v, p);
|
||||||
|
if (l == 0) {
|
||||||
ret = w;
|
ret = w;
|
||||||
if (l > 1) {
|
}
|
||||||
|
else {
|
||||||
old->set_up(w);
|
old->set_up(w);
|
||||||
w->set_down(old);
|
w->set_down(old);
|
||||||
}
|
}
|
||||||
old = w;
|
if (u == Vertex_handle())
|
||||||
if (u == Vertex_handle() || l > maxlevel)
|
|
||||||
break;
|
break;
|
||||||
|
old = w;
|
||||||
v = u;
|
v = u;
|
||||||
u = v->up();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -440,12 +439,9 @@ Triangulation_hierarchy_3<Tr>::
|
||||||
random_level()
|
random_level()
|
||||||
{
|
{
|
||||||
int l = 0;
|
int l = 0;
|
||||||
while ( ! random(ratio) )
|
while ( ! random(ratio) && l < maxlevel-1 )
|
||||||
++l;
|
++l;
|
||||||
|
|
||||||
if (l >= maxlevel)
|
|
||||||
l = maxlevel - 1;
|
|
||||||
|
|
||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue