GCC Code Coverage Report


Directory: ./
File: mesh/mesh_halfedges.cpp
Date: 2026-09-27 03:22:43
Exec Total Coverage
Lines: 41 68 60.3%
Functions: 3 5 60.0%
Branches: 34 124 27.4%

Line Branch Exec Source
1 /*
2 * Copyright (c) 2000-2022 Inria
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * * Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 * * Neither the name of the ALICE Project-Team nor the names of its
14 * contributors may be used to endorse or promote products derived from this
15 * software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
21 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 * POSSIBILITY OF SUCH DAMAGE.
28 *
29 * Contact: Bruno Levy
30 *
31 * https://www.inria.fr/fr/bruno-levy
32 *
33 * Inria,
34 * Domaine de Voluceau,
35 * 78150 Le Chesnay - Rocquencourt
36 * FRANCE
37 *
38 */
39
40 #include <geogram/mesh/mesh_halfedges.h>
41
42 namespace GEO {
43
44 8635 bool MeshHalfedges::move_to_next_around_vertex(Halfedge& H) const {
45
1/6
✗ Branch 1 not taken.
✓ Branch 2 taken 8635 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
8635 geo_debug_assert(halfedge_is_valid(H));
46 8635 index_t v = mesh_.facet_corners.vertex(H.corner);
47 8635 index_t f = mesh_.facet_corners.adjacent_facet(H.corner);
48
2/2
✓ Branch 0 taken 3311 times.
✓ Branch 1 taken 5324 times.
8635 if(f == NO_FACET) {
49 3311 return false;
50 }
51 5324 if(
52
2/4
✗ Branch 1 not taken.
✓ Branch 2 taken 5324 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5324 times.
5324 facet_region_.is_bound() &&
53 ✗ facet_region_[H.facet] != facet_region_[f]
54 ) {
55 ✗ return false;
56 }
57
2/4
✓ Branch 1 taken 5324 times.
✗ Branch 2 not taken.
✓ Branch 8 taken 9737 times.
✗ Branch 9 not taken.
9737 for(index_t c: mesh_.facets.corners(f)) {
58
1/2
✓ Branch 1 taken 9737 times.
✗ Branch 2 not taken.
9737 index_t pc = mesh_.facets.prev_corner_around_facet(f, c);
59 9737 if(
60
5/6
✓ Branch 1 taken 9737 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 5324 times.
✓ Branch 4 taken 4413 times.
✓ Branch 5 taken 5324 times.
✓ Branch 6 taken 4413 times.
15061 mesh_.facet_corners.vertex(c) == v &&
61
2/4
✓ Branch 1 taken 5324 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 5324 times.
✗ Branch 4 not taken.
5324 mesh_.facet_corners.adjacent_facet(pc) == H.facet
62 ) {
63 5324 H.corner = c;
64 5324 H.facet = f;
65 5324 return true;
66 }
67 }
68 ✗ geo_assert_not_reached;
69 }
70
71 4391046 bool MeshHalfedges::move_to_prev_around_vertex(Halfedge& H) const {
72
1/6
✗ Branch 1 not taken.
✓ Branch 2 taken 4391046 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
4391046 geo_debug_assert(halfedge_is_valid(H));
73 4391046 index_t v = mesh_.facet_corners.vertex(H.corner);
74 4391046 index_t pc = mesh_.facets.prev_corner_around_facet(H.facet, H.corner);
75 4391046 index_t f = mesh_.facet_corners.adjacent_facet(pc);
76
2/2
✓ Branch 0 taken 1760175 times.
✓ Branch 1 taken 2630871 times.
4391046 if(f == NO_FACET) {
77 1760175 return false;
78 }
79 2630871 if(
80
2/4
✗ Branch 1 not taken.
✓ Branch 2 taken 2630871 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2630871 times.
2630871 facet_region_.is_bound() &&
81 ✗ facet_region_[H.facet] != facet_region_[f]
82 ) {
83 ✗ return false;
84 }
85
2/4
✓ Branch 1 taken 2630871 times.
✗ Branch 2 not taken.
✓ Branch 8 taken 5132677 times.
✗ Branch 9 not taken.
5132677 for(index_t c: mesh_.facets.corners(f)) {
86 5132677 if(
87
5/6
✓ Branch 1 taken 5132677 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2630871 times.
✓ Branch 4 taken 2501806 times.
✓ Branch 5 taken 2630871 times.
✓ Branch 6 taken 2501806 times.
7763548 mesh_.facet_corners.vertex(c) == v &&
88
2/4
✓ Branch 1 taken 2630871 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2630871 times.
✗ Branch 4 not taken.
2630871 mesh_.facet_corners.adjacent_facet(c) == H.facet
89 ) {
90 2630871 H.corner = c;
91 2630871 H.facet = f;
92 2630871 return true;
93 }
94 }
95 ✗ geo_assert_not_reached;
96 }
97
98 3311 void MeshHalfedges::move_to_next_around_border(Halfedge& H) const {
99
1/6
✗ Branch 1 not taken.
✓ Branch 2 taken 3311 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
3311 geo_debug_assert(halfedge_is_valid(H));
100
1/6
✗ Branch 1 not taken.
✓ Branch 2 taken 3311 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
3311 geo_debug_assert(halfedge_is_border(H));
101 3311 move_to_next_around_facet(H);
102 3311 index_t count = 0;
103
2/2
✓ Branch 1 taken 5324 times.
✓ Branch 2 taken 3311 times.
8635 while(move_to_next_around_vertex(H)) {
104 5324 ++count;
105
1/6
✗ Branch 0 not taken.
✓ Branch 1 taken 5324 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
5324 geo_assert(count < 10000);
106 }
107 3311 }
108
109 ✗ void MeshHalfedges::move_to_prev_around_border(Halfedge& H) const {
110 ✗ geo_debug_assert(halfedge_is_valid(H));
111 ✗ geo_debug_assert(halfedge_is_border(H));
112 ✗ index_t count = 0;
113 ✗ while(move_to_prev_around_vertex(H)) {
114 ✗ ++count;
115 ✗ geo_assert(count < 10000);
116 }
117 ✗ move_to_prev_around_facet(H);
118 ✗ }
119
120 ✗ void MeshHalfedges::move_to_opposite(Halfedge& H) const {
121 ✗ geo_debug_assert(halfedge_is_valid(H));
122 ✗ index_t v = mesh_.facet_corners.vertex(
123 ✗ mesh_.facets.next_corner_around_facet(H.facet, H.corner)
124 );
125 ✗ index_t f = mesh_.facet_corners.adjacent_facet(H.corner);
126 ✗ geo_assert(f != NO_FACET);
127 ✗ for(index_t c: mesh_.facets.corners(f)) {
128 ✗ if(mesh_.facet_corners.vertex(c) == v) {
129 ✗ H.facet = f;
130 ✗ H.corner = c;
131 ✗ return;
132 }
133 }
134 ✗ geo_assert_not_reached;
135 }
136 }
137