• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pmp-library / pmp-library / 25867435085

14 May 2026 03:00PM UTC coverage: 89.656% (-0.02%) from 89.671%
25867435085

push

github

dsieger
Report isolated vertices

2 of 3 new or added lines in 1 file covered. (66.67%)

1 existing line in 1 file now uncovered.

5209 of 5810 relevant lines covered (89.66%)

628467.03 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

73.47
/src/pmp/algorithms/analysis.cpp
1
// Copyright 2026 the Polygon Mesh Processing Library developers.
2
// SPDX-License-Identifier: MIT
3

4
#include "pmp/algorithms/analysis.h"
5

6
#include <queue>
7

8
namespace pmp {
9

10
namespace {
11

12
// const version of connected_components, count only
13
int count_connected_components(const SurfaceMesh& mesh)
8✔
14
{
15
    std::vector<bool> visited(mesh.n_vertices(), false);
8✔
16

17
    int count = 0;
8✔
18

19
    for (auto v : mesh.vertices())
104✔
20
    {
21
        if (visited[v.idx()])
96✔
22
            continue;
86✔
23

24
        std::queue<Vertex> queue;
10✔
25
        queue.push(v);
10✔
26
        visited[v.idx()] = true;
10✔
27

28
        while (!queue.empty())
106✔
29
        {
30
            auto vv = queue.front();
96✔
31
            queue.pop();
96✔
32

33
            for (auto vc : mesh.vertices(vv))
384✔
34
            {
35
                if (!visited[vc.idx()])
288✔
36
                {
37
                    visited[vc.idx()] = true;
86✔
38
                    queue.push(vc);
86✔
39
                }
40
            }
41
        }
42

43
        ++count;
10✔
44
    }
10✔
45

46
    return count;
8✔
47
}
8✔
48
} // namespace
49

50
AnalysisReport analyze(const SurfaceMesh& mesh)
8✔
51
{
52
    AnalysisReport report;
8✔
53

54
    // basic stats
55
    report.n_vertices = mesh.n_vertices();
8✔
56
    report.n_edges = mesh.n_edges();
8✔
57
    report.n_faces = mesh.n_faces();
8✔
58

59
    // mesh type
60
    report.is_triangle_mesh = mesh.is_triangle_mesh();
8✔
61
    report.is_quad_mesh = mesh.is_quad_mesh();
8✔
62

63
    // manifoldness and boundary
64
    for (auto v : mesh.vertices())
200✔
65
    {
66
        if (!mesh.is_manifold(v))
96✔
67
            report.is_manifold = false;
1✔
68
        if (mesh.is_boundary(v))
96✔
69
            report.has_boundary = true;
42✔
70
        if (mesh.is_isolated(v))
96✔
71
            ++report.n_isolated_vertices;
3✔
72
    }
73

74
    report.n_components = count_connected_components(mesh);
8✔
75

76
    return report;
8✔
77
}
78

79
std::ostream& operator<<(std::ostream& os, const AnalysisReport& report)
×
80
{
81
    os << "Analysis Report:\n";
×
82
    os << "  vertices: " << report.n_vertices << "\n";
×
83
    os << "  edges: " << report.n_edges << "\n";
×
84
    os << "  faces: " << report.n_faces << "\n";
×
85
    os << "  boundary: " << (report.has_boundary ? "yes" : "no") << "\n";
×
86
    os << "  manifold: " << (report.is_manifold ? "yes" : "no") << "\n";
×
87
    os << "  triangle mesh: " << (report.is_triangle_mesh ? "yes" : "no")
×
88
       << "\n";
×
89
    os << "  quad mesh: " << (report.is_quad_mesh ? "yes" : "no") << "\n";
×
90
    os << "  components: " << report.n_components << "\n";
×
NEW
91
    os << "  isolated vertices: " << report.n_isolated_vertices << "\n";
×
UNCOV
92
    return os;
×
93
}
94

95
} // namespace pmp
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc