implements checking for lonely edges
This commit is contained in:
parent
b748a8d9ae
commit
717603d5d3
21
src/main.cpp
21
src/main.cpp
@ -1,6 +1,7 @@
|
||||
#include "my_mesh.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user