GCC Code Coverage Report


Directory: ./
File: lib/geogram/voronoi/RVD_mesh_builder.cpp
Date: 2026-09-07 02:25:23
Exec Total Coverage
Lines: 27 28 96.4%
Functions: 2 2 100.0%
Branches: 14 15 93.3%

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/voronoi/RVD_mesh_builder.h>
41
42 namespace GEO {
43
44 1289 RVDVertexMap::RVDVertexMap() :
45 1289 nb_vertices_(0) {
46 1289 }
47
48 1143499 index_t RVDVertexMap::find_or_create_vertex(
49 index_t center_vertex_id, const SymbolicVertex& sym
50 ) {
51
4/5
✓ Branch 0 taken 53064 times.
✓ Branch 1 taken 347353 times.
✓ Branch 2 taken 559588 times.
✓ Branch 3 taken 183494 times.
✗ Branch 4 not taken.
1143499 switch(sym.nb_bisectors()) {
52 case 3:
53 {
54 index_t ib1 = sym.bisector(0);
55 index_t ib2 = sym.bisector(1);
56 index_t ib3 = sym.bisector(2);
57 53064 quadindex K(center_vertex_id + 1, ib1 + 1, ib2 + 1, ib3 + 1);
58 auto it = ppp_to_id_.find(K);
59
2/2
✓ Branch 0 taken 35703 times.
✓ Branch 1 taken 17361 times.
53064 if(it != ppp_to_id_.end()) {
60 35703 return it->second;
61 } else {
62 index_t result = new_vertex();
63 17361 ppp_to_id_[K] = result;
64 17361 return result;
65 }
66 }
67 case 2:
68 {
69 index_t f = sym.boundary_facet(0);
70 index_t ib1 = sym.bisector(0);
71 index_t ib2 = sym.bisector(1);
72 signed_quadindex K(
73 347353 signed_index_t(center_vertex_id) + 1,
74 -signed_index_t(f) - 1,
75 signed_index_t(ib1) + 1,
76 signed_index_t(ib2) + 1
77 347353 );
78 auto it = ppm_to_id_.find(K);
79
2/2
✓ Branch 0 taken 243183 times.
✓ Branch 1 taken 104170 times.
347353 if(it != ppm_to_id_.end()) {
80 243183 return it->second;
81 } else {
82 index_t result = new_vertex();
83 104170 ppm_to_id_[K] = result;
84 104170 return result;
85 }
86 }
87 case 1:
88 {
89 index_t bv1, bv2;
90 sym.get_boundary_edge(bv1, bv2);
91 index_t ib = sym.bisector(0);
92 signed_quadindex K(
93 559588 signed_index_t(center_vertex_id) + 1,
94 -signed_index_t(bv1) - 1,
95 -signed_index_t(bv2) - 1,
96 signed_index_t(ib) + 1
97 559588 );
98 auto it = pmm_to_id_.find(K);
99
2/2
✓ Branch 0 taken 421828 times.
✓ Branch 1 taken 137760 times.
559588 if(it != pmm_to_id_.end()) {
100 421828 return it->second;
101 } else {
102 index_t result = new_vertex();
103 137760 pmm_to_id_[K] = result;
104 137760 return result;
105 }
106 }
107 case 0:
108 {
109 index_t bv = sym.get_boundary_vertex();
110
2/2
✓ Branch 0 taken 719 times.
✓ Branch 1 taken 182775 times.
183494 if(bv >= bv_to_id_.size()) {
111 719 bv_to_id_.resize(bv + 1, -1);
112 }
113
2/2
✓ Branch 0 taken 31415 times.
✓ Branch 1 taken 152079 times.
183494 if(bv_to_id_[bv] == -1) {
114 31415 bv_to_id_[bv] = signed_index_t(new_vertex());
115 }
116 183494 return index_t(bv_to_id_[bv]);
117 }
118 default:
119 geo_assert_not_reached;
120 }
121 }
122 }
123