mirror of https://github.com/CGAL/cgal
walk_to_next_3: reformat to indentation by 2 space
This commit is contained in:
parent
dcfd783953
commit
f193744e66
|
|
@ -334,11 +334,8 @@ Triangulation_segment_cell_iterator_3<Tr,Inc>::walk_to_next_3(const Simplex& pre
|
||||||
const Simplex& cur) const
|
const Simplex& cur) const
|
||||||
{
|
{
|
||||||
const auto cur_cell = cur.cell;
|
const auto cur_cell = cur.cell;
|
||||||
std::array<const Point*, 4> vert
|
std::array<const Point*, 4> vert = {&(cur_cell->vertex(0)->point()), &(cur_cell->vertex(1)->point()),
|
||||||
= {&(cur_cell->vertex(0)->point()),
|
&(cur_cell->vertex(2)->point()), &(cur_cell->vertex(3)->point())};
|
||||||
&(cur_cell->vertex(1)->point()),
|
|
||||||
&(cur_cell->vertex(2)->point()),
|
|
||||||
&(cur_cell->vertex(3)->point()) };
|
|
||||||
|
|
||||||
int inside = 0, outside = 0, regular_case = 0, degenerate = 0;
|
int inside = 0, outside = 0, regular_case = 0, degenerate = 0;
|
||||||
|
|
||||||
|
|
@ -354,8 +351,7 @@ Triangulation_segment_cell_iterator_3<Tr,Inc>::walk_to_next_3(const Simplex& pre
|
||||||
prev_after_walk = {cur_cell, Tr::CELL, -1, -1};
|
prev_after_walk = {cur_cell, Tr::CELL, -1, -1};
|
||||||
cur_after_walk = {{}, Tr::CELL, -1, -1};
|
cur_after_walk = {{}, Tr::CELL, -1, -1};
|
||||||
};
|
};
|
||||||
auto case_segment_exits_cur_cell_by = [&](int facet_nb,
|
auto case_segment_exits_cur_cell_by = [&](int facet_nb, Cell_handle nnext = {}) {
|
||||||
Cell_handle nnext = {}) {
|
|
||||||
if(nnext == Cell_handle{}) {
|
if(nnext == Cell_handle{}) {
|
||||||
nnext = cur_cell->neighbor(facet_nb);
|
nnext = cur_cell->neighbor(facet_nb);
|
||||||
}
|
}
|
||||||
|
|
@ -375,21 +371,21 @@ Triangulation_segment_cell_iterator_3<Tr,Inc>::walk_to_next_3(const Simplex& pre
|
||||||
Orientation oi01 = _tr->orientation(*vert[i], *vert[j0], *vert[j1], _target);
|
Orientation oi01 = _tr->orientation(*vert[i], *vert[j0], *vert[j1], _target);
|
||||||
if(oi01 == POSITIVE) {
|
if(oi01 == POSITIVE) {
|
||||||
case_segment_exits_cur_cell_by(j2);
|
case_segment_exits_cur_cell_by(j2);
|
||||||
if (o1 == ZERO) degenerate = 1; //EDGE i j1
|
if(o1 == ZERO)
|
||||||
}
|
degenerate = 1; // EDGE i j1
|
||||||
else { // o0 > 0, o1 <= 0, oi01 <= 0
|
} else { // o0 > 0, o1 <= 0, oi01 <= 0
|
||||||
case_target_is_inside_cur_cell(1);
|
case_target_is_inside_cur_cell(1);
|
||||||
if(oi01 == ZERO) { // on FACET j2 (i, j0, j1)
|
if(oi01 == ZERO) { // on FACET j2 (i, j0, j1)
|
||||||
degenerate = 1;
|
degenerate = 1;
|
||||||
} // end oi01 == ZERO
|
} // end oi01 == ZERO
|
||||||
}
|
}
|
||||||
} // end o1 <= 0
|
} // end o1 <= 0
|
||||||
else { // o1 > 0
|
else
|
||||||
|
{ // o1 > 0
|
||||||
Orientation oi12 = _tr->orientation(*vert[i], *vert[j1], *vert[j2], _target);
|
Orientation oi12 = _tr->orientation(*vert[i], *vert[j1], *vert[j2], _target);
|
||||||
if(oi12 == POSITIVE) {
|
if(oi12 == POSITIVE) {
|
||||||
case_segment_exits_cur_cell_by(j0);
|
case_segment_exits_cur_cell_by(j0);
|
||||||
}
|
} else { // o0 > 0, o1 > 0, oi12 <= 0
|
||||||
else { // o0 > 0, o1 > 0, oi12 <= 0
|
|
||||||
case_target_is_inside_cur_cell(2);
|
case_target_is_inside_cur_cell(2);
|
||||||
if(oi12 == ZERO) { // on FACET j0 (i, j1, j2)
|
if(oi12 == ZERO) { // on FACET j0 (i, j1, j2)
|
||||||
degenerate = 1;
|
degenerate = 1;
|
||||||
|
|
@ -397,7 +393,8 @@ Triangulation_segment_cell_iterator_3<Tr,Inc>::walk_to_next_3(const Simplex& pre
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // end o0 > 0
|
} // end o0 > 0
|
||||||
else if (o0 == ZERO) {
|
else if(o0 == ZERO)
|
||||||
|
{
|
||||||
// target is on plane (source, vert[i], vert[j0])
|
// target is on plane (source, vert[i], vert[j0])
|
||||||
Orientation o1 = _tr->orientation(_source, *vert[i], *vert[j1], _target);
|
Orientation o1 = _tr->orientation(_source, *vert[i], *vert[j1], _target);
|
||||||
if(o1 == NEGATIVE) {
|
if(o1 == NEGATIVE) {
|
||||||
|
|
@ -405,30 +402,25 @@ Triangulation_segment_cell_iterator_3<Tr,Inc>::walk_to_next_3(const Simplex& pre
|
||||||
if(oi12 == POSITIVE) {
|
if(oi12 == POSITIVE) {
|
||||||
degenerate = 2;
|
degenerate = 2;
|
||||||
case_segment_exits_cur_cell_by(44, cur_cell->neighbor(j2)); // EDGE i j0
|
case_segment_exits_cur_cell_by(44, cur_cell->neighbor(j2)); // EDGE i j0
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
case_target_is_inside_cur_cell(3);
|
case_target_is_inside_cur_cell(3);
|
||||||
if(oi12 == ZERO) { // target is *on* EDGE i j0
|
if(oi12 == ZERO) { // target is *on* EDGE i j0
|
||||||
degenerate = 1;
|
degenerate = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else if(o1 == ZERO) {
|
||||||
else if (o1 == ZERO) {
|
|
||||||
// o0 == o1 == 0 -> target is on line source-vert[i]
|
// o0 == o1 == 0 -> target is on line source-vert[i]
|
||||||
if(_tr->orientation(*vert[i], *vert[j0], *vert[j2], _target) == POSITIVE)
|
if(_tr->orientation(*vert[i], *vert[j0], *vert[j2], _target) == POSITIVE)
|
||||||
case_target_is_inside_cur_cell(55);
|
case_target_is_inside_cur_cell(55);
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
degenerate = 3;
|
degenerate = 3;
|
||||||
case_segment_exits_cur_cell_by(5, cur_cell->neighbor(j2)); // VERTEX i
|
case_segment_exits_cur_cell_by(5, cur_cell->neighbor(j2)); // VERTEX i
|
||||||
}
|
}
|
||||||
}
|
} else { // o0 == 0, o1 > 0
|
||||||
else { // o0 == 0, o1 > 0
|
|
||||||
Orientation oi12 = _tr->orientation(*vert[i], *vert[j1], *vert[j2], _target);
|
Orientation oi12 = _tr->orientation(*vert[i], *vert[j1], *vert[j2], _target);
|
||||||
if(oi12 == POSITIVE) {
|
if(oi12 == POSITIVE) {
|
||||||
case_segment_exits_cur_cell_by(j0);
|
case_segment_exits_cur_cell_by(j0);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
case_target_is_inside_cur_cell(4);
|
case_target_is_inside_cur_cell(4);
|
||||||
if(oi12 == ZERO) { // on FACET j0 (i, j1, j2)
|
if(oi12 == ZERO) { // on FACET j0 (i, j1, j2)
|
||||||
degenerate = 1;
|
degenerate = 1;
|
||||||
|
|
@ -436,28 +428,27 @@ Triangulation_segment_cell_iterator_3<Tr,Inc>::walk_to_next_3(const Simplex& pre
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // end o0 == 0
|
} // end o0 == 0
|
||||||
else { // o0 < 0
|
else
|
||||||
|
{ // o0 < 0
|
||||||
Orientation o2 = _tr->orientation(_source, *vert[i], *vert[j2], _target);
|
Orientation o2 = _tr->orientation(_source, *vert[i], *vert[j2], _target);
|
||||||
if(o2 != NEGATIVE) {
|
if(o2 != NEGATIVE) {
|
||||||
// o2 >= 0
|
// o2 >= 0
|
||||||
Orientation oi20 = _tr->orientation(*vert[i], *vert[j2], *vert[j0], _target);
|
Orientation oi20 = _tr->orientation(*vert[i], *vert[j2], *vert[j0], _target);
|
||||||
if(oi20 == POSITIVE) {
|
if(oi20 == POSITIVE) {
|
||||||
case_segment_exits_cur_cell_by(j1);
|
case_segment_exits_cur_cell_by(j1);
|
||||||
if (o2 == ZERO) degenerate = 4; // EDGE i j2
|
if(o2 == ZERO)
|
||||||
}
|
degenerate = 4; // EDGE i j2
|
||||||
else {
|
} else {
|
||||||
case_target_is_inside_cur_cell(5);
|
case_target_is_inside_cur_cell(5);
|
||||||
if(oi20 == ZERO) { // on FACET j1 (i, j2, j0)
|
if(oi20 == ZERO) { // on FACET j1 (i, j2, j0)
|
||||||
degenerate = 1;
|
degenerate = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
Orientation oi12 = _tr->orientation(*vert[i], *vert[j1], *vert[j2], _target);
|
Orientation oi12 = _tr->orientation(*vert[i], *vert[j1], *vert[j2], _target);
|
||||||
if(oi12 == POSITIVE) {
|
if(oi12 == POSITIVE) {
|
||||||
case_segment_exits_cur_cell_by(j0);
|
case_segment_exits_cur_cell_by(j0);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
case_target_is_inside_cur_cell(6);
|
case_target_is_inside_cur_cell(6);
|
||||||
if(oi12 == ZERO) { // on FACET j0 (i, j1, j2)
|
if(oi12 == ZERO) { // on FACET j0 (i, j1, j2)
|
||||||
degenerate = 1;
|
degenerate = 1;
|
||||||
|
|
@ -466,13 +457,11 @@ Triangulation_segment_cell_iterator_3<Tr,Inc>::walk_to_next_3(const Simplex& pre
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!degenerate)
|
if(!degenerate) {
|
||||||
{
|
|
||||||
return {prev_after_walk, cur_after_walk};
|
return {prev_after_walk, cur_after_walk};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// We check in which direction the target lies
|
// We check in which direction the target lies
|
||||||
// by comparing its position relative to the planes through the
|
// by comparing its position relative to the planes through the
|
||||||
// source and the edges of the cell.
|
// source and the edges of the cell.
|
||||||
|
|
@ -491,8 +480,7 @@ Triangulation_segment_cell_iterator_3<Tr,Inc>::walk_to_next_3(const Simplex& pre
|
||||||
calc[ij] = true;
|
calc[ij] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else if(cur.lt == Tr::EDGE) {
|
||||||
else if( cur.lt == Tr::EDGE ) {
|
|
||||||
// The plane through the edge is set to coplanar.
|
// The plane through the edge is set to coplanar.
|
||||||
int ij = edgeIndex(cur.li, cur.lj);
|
int ij = edgeIndex(cur.li, cur.lj);
|
||||||
o[ij] = COPLANAR;
|
o[ij] = COPLANAR;
|
||||||
|
|
@ -501,12 +489,12 @@ Triangulation_segment_cell_iterator_3<Tr,Inc>::walk_to_next_3(const Simplex& pre
|
||||||
|
|
||||||
// For the remembering stochastic walk, we start trying with a random facet.
|
// For the remembering stochastic walk, we start trying with a random facet.
|
||||||
CGAL_triangulation_assertion_code(bool incell = true;)
|
CGAL_triangulation_assertion_code(bool incell = true;)
|
||||||
|
|
||||||
for(int li = 0; li < 4; ++li)
|
for(int li = 0; li < 4; ++li)
|
||||||
{
|
{
|
||||||
// Skip the previous cell.
|
// Skip the previous cell.
|
||||||
Cell_handle next = cur_cell->neighbor(li);
|
Cell_handle next = cur_cell->neighbor(li);
|
||||||
if( next == prev.cell )
|
if(next == prev.cell) {
|
||||||
{
|
|
||||||
op[li] = POSITIVE;
|
op[li] = POSITIVE;
|
||||||
pos += li;
|
pos += li;
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -529,7 +517,6 @@ Triangulation_segment_cell_iterator_3<Tr,Inc>::walk_to_next_3(const Simplex& pre
|
||||||
for(int lj = 0; lj < 4; ++lj) {
|
for(int lj = 0; lj < 4; ++lj) {
|
||||||
if(li == lj)
|
if(li == lj)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// We check the orientation of the target compared to the plane
|
// We check the orientation of the target compared to the plane
|
||||||
// Through the source and the edge opposite of ij.
|
// Through the source and the edge opposite of ij.
|
||||||
const int oij = 5 - edgeIndex(li, lj);
|
const int oij = 5 - edgeIndex(li, lj);
|
||||||
|
|
@ -539,19 +526,19 @@ Triangulation_segment_cell_iterator_3<Tr,Inc>::walk_to_next_3(const Simplex& pre
|
||||||
vert[lj] = backup_vert_lj;
|
vert[lj] = backup_vert_lj;
|
||||||
calc[oij] = true;
|
calc[oij] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(o[oij] == POSITIVE) {
|
if(o[oij] == POSITIVE) {
|
||||||
// The target is not inside the pyramid.
|
// The target is not inside the pyramid.
|
||||||
// Invert the planes.
|
// Invert the planes.
|
||||||
for(int j = 0; j < 4; ++j) {
|
for(int j = 0; j < 4; ++j) {
|
||||||
if( li == j ) continue;
|
if(li == j)
|
||||||
|
continue;
|
||||||
int oij = 5 - edgeIndex(li, j);
|
int oij = 5 - edgeIndex(li, j);
|
||||||
if(calc[oij]) o[oij] = -o[oij];
|
if(calc[oij])
|
||||||
|
o[oij] = -o[oij];
|
||||||
}
|
}
|
||||||
Or = 0;
|
Or = 0;
|
||||||
break;
|
break;
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
Or -= o[oij];
|
Or -= o[oij];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -565,27 +552,21 @@ Triangulation_segment_cell_iterator_3<Tr,Inc>::walk_to_next_3(const Simplex& pre
|
||||||
// The target is inside the pyramid.
|
// The target is inside the pyramid.
|
||||||
switch(Or) {
|
switch(Or) {
|
||||||
case 3: {
|
case 3: {
|
||||||
if(regular_case)
|
if(regular_case) {
|
||||||
{
|
|
||||||
CGAL_triangulation_assertion(li == outside);
|
CGAL_triangulation_assertion(li == outside);
|
||||||
CGAL_triangulation_assertion(!inside);
|
CGAL_triangulation_assertion(!inside);
|
||||||
}
|
}
|
||||||
return { {cur_cell, Tr::FACET, li},
|
return {{cur_cell, Tr::FACET, li}, {next, Tr::FACET, next->index(cur_cell)}};
|
||||||
{next, Tr::FACET, next->index(cur_cell)} };
|
|
||||||
}
|
}
|
||||||
case 2: {
|
case 2: {
|
||||||
if(regular_case)
|
if(regular_case)
|
||||||
CGAL_triangulation_assertion(degenerate);
|
CGAL_triangulation_assertion(degenerate);
|
||||||
|
|
||||||
for(int j = 0; j < 4; ++j) {
|
for(int j = 0; j < 4; ++j) {
|
||||||
if(li != j && o[5 - edgeIndex(li, j)] == COPLANAR) {
|
if(li != j && o[5 - edgeIndex(li, j)] == COPLANAR) {
|
||||||
Edge opp = opposite_edge(prev.cell, li, j);
|
Edge opp = opposite_edge(prev.cell, li, j);
|
||||||
return { {cur_cell, Tr::EDGE, opp.second, opp.third},
|
return {
|
||||||
{next, Tr::EDGE,
|
{cur_cell, Tr::EDGE, opp.second, opp.third},
|
||||||
next->index(cur_cell->vertex( opp.second )),
|
{next, Tr::EDGE, next->index(cur_cell->vertex(opp.second)), next->index(cur_cell->vertex(opp.third))}};
|
||||||
next->index(cur_cell->vertex( opp.third ))
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CGAL_unreachable();
|
CGAL_unreachable();
|
||||||
|
|
@ -594,11 +575,9 @@ Triangulation_segment_cell_iterator_3<Tr,Inc>::walk_to_next_3(const Simplex& pre
|
||||||
case 1:
|
case 1:
|
||||||
if(regular_case)
|
if(regular_case)
|
||||||
CGAL_triangulation_assertion(degenerate);
|
CGAL_triangulation_assertion(degenerate);
|
||||||
|
|
||||||
for(int j = 0; j < 4; ++j) {
|
for(int j = 0; j < 4; ++j) {
|
||||||
if(li != j && o[5 - edgeIndex(li, j)] == NEGATIVE) {
|
if(li != j && o[5 - edgeIndex(li, j)] == NEGATIVE) {
|
||||||
return { {cur_cell, Tr::VERTEX, j},
|
return {{cur_cell, Tr::VERTEX, j}, {next, Tr::VERTEX, next->index(cur_cell->vertex(j))}};
|
||||||
{next, Tr::VERTEX, next->index(cur_cell->vertex(j))} };
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CGAL_unreachable();
|
CGAL_unreachable();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue