Use 'if' rather than %

This commit is contained in:
Marc Glisse 2024-02-10 20:40:17 +01:00
parent 96f698ca09
commit 270a2398d6
1 changed files with 11 additions and 3 deletions

View File

@ -993,7 +993,7 @@ Triangulation<TT, TDS>
// Otherwise, let's find the right infinite cell
else
{
inf_v_cell = inf_v_cell->neighbor((inf_v_index + 1) % 2);
inf_v_cell = inf_v_cell->neighbor((inf_v_index + 1) & 1);
inf_v_index = inf_v_cell->index(infinite_vertex());
// Is "inf_v_cell" the right infinite cell?
// Then inf_v_index should be 1
@ -1096,9 +1096,14 @@ Triangulation<TT, TDS>
// For the remembering stochastic walk, we need to start trying
// with a random index:
int j, i = rng_.get_int(0, cur_dim);
// we check |p| against all the full_cell's hyperplanes in turn
for(j = 0; j <= cur_dim; ++j, i = (i + 1) % (cur_dim + 1) )
// i = (i + 1) % m where 0 <= i < m
auto incr_mod = [] (int&i, int m) {
if( ++i >= m ) i = 0; // >= or ==
};
// we check |p| against all the full_cell's hyperplanes in turn
for(j = 0; j <= cur_dim; ++j, incr_mod(i, cur_dim + 1))
{
Full_cell_handle next = s->neighbor(i);
if( previous == next )
@ -1127,6 +1132,9 @@ Triangulation<TT, TDS>
// full_cell because orientation_[i] == NEGATIVE
previous = s;
s = next;
// We only need to test is_infinite(next->vertex(next->index(previous)))
// or equivalently is_infinite(next->vertex(previous->mirror_index(i)))
// but it does not seem to help, even when storing mirror indices.
if( is_infinite(next) )
{ // we have arrived OUTSIDE the convex hull of the triangulation,
// so we stop the search