53 lines
1.6 KiB
C++
53 lines
1.6 KiB
C++
#include "geometrycentral/surface/manifold_surface_mesh.h"
|
|
#include "geometrycentral/surface/meshio.h"
|
|
#include "geometrycentral/surface/vertex_position_geometry.h"
|
|
|
|
#include "polyscope/polyscope.h"
|
|
#include "polyscope/surface_mesh.h"
|
|
#include "polyscope/point_cloud.h"
|
|
|
|
using namespace geometrycentral;
|
|
using namespace geometrycentral::surface;
|
|
|
|
// == Geometry-central data
|
|
std::unique_ptr<ManifoldSurfaceMesh> mesh;
|
|
std::unique_ptr<VertexPositionGeometry> geometry;
|
|
|
|
int main(int argc, char **argv) {
|
|
|
|
// Initialize polyscope
|
|
polyscope::init();
|
|
|
|
// Load mesh
|
|
std::tie(mesh, geometry) = readManifoldSurfaceMesh(argv[1]);
|
|
|
|
// Register the mesh with polyscope
|
|
auto pcl = polyscope::registerSurfaceMesh("Input obj",
|
|
geometry->inputVertexPositions,
|
|
mesh->getFaceVertexList(),
|
|
polyscopePermutations(*mesh));
|
|
geometry->requireVertexPositions();
|
|
|
|
std::vector<int> nbAdjFaces;
|
|
for (auto i=0; i < geometry->inputVertexPositions.size(); i++) {
|
|
nbAdjFaces.push_back(0);
|
|
}
|
|
|
|
for(Face f: mesh->faces()) {
|
|
std::cout << " Je suis sur la face " << f.getIndex() << " : " << std::endl;
|
|
for(Vertex v: f.adjacentVertices()) {
|
|
auto coord = geometry->vertexPositions[v];
|
|
std::cout << " vertex: "<<v.getIndex() << "(" <<coord.x<< ", " <<coord.y<< ", " <<coord.z <<")"<<std::endl;
|
|
|
|
nbAdjFaces[v.getIndex()]++;
|
|
}
|
|
}
|
|
|
|
pcl->addVertexScalarQuantity("nb of adjacent faces", nbAdjFaces);
|
|
|
|
// Give control to the polyscope gui
|
|
polyscope::show();
|
|
|
|
return EXIT_SUCCESS;
|
|
}
|