From 717603d5d39c590a9f66bff6ff729da1f1c5f122 Mon Sep 17 00:00:00 2001 From: ccolin Date: Thu, 1 Oct 2020 16:32:33 +0200 Subject: [PATCH] implements checking for lonely edges --- src/main.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 24b30ec..0dfd3d5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,6 +1,7 @@ #include "my_mesh.h" #include +#include bool check_faces_are_triangles(MyMesh &mesh) { @@ -39,15 +40,15 @@ bool check_vertices_arent_lonely(MyMesh &mesh) { } -bool check_edges_arent_lonely(MyMesh &mesh) { - MyMesh::HalfedgeHandle heh, heh_init; - heh = heh_init = mesh.halfedge_handle((*mesh.vertices_begin())); - heh = mesh.next_halfedge_handle(heh); - while (heh != heh_init) { - if (mesh.is_boundary(heh)) { - return false; - } - heh = mesh.next_halfedge_handle(heh); +bool check_edges_arent_lonely(const char *path) { + using namespace std; + ifstream f(path); + string line; + while (getline(f, line)) { + istringstream iss(line); + char first; + iss >> first; + if (first == 'l') return false; } return true; } @@ -72,7 +73,7 @@ int main(int argc, char *argv[]) { << (check_vertices_arent_lonely(mesh) ? "oui" : "non") << endl; cout << "Les arêtes sont sur une face : " - << (check_edges_arent_lonely(mesh) ? "oui" : "non") + << (check_edges_arent_lonely(argv[1]) ? "oui" : "non") << endl; return 0; }