add new compile target for viewer

This commit is contained in:
Tarik Moussa
2026-03-17 21:18:59 +02:00
parent 2479aedeee
commit e150cf6ef3
6 changed files with 55 additions and 61 deletions

View File

@@ -1,7 +1,9 @@
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/IO/polygon_mesh_io.h>
#include "simple_visualize.h"
#include "viewer_utils.h"
#include "mesh_utils.hpp"
#include <CLI11.hpp>
@@ -23,7 +25,7 @@ bool parse_arguments(int argc, char* argv[], std::string& input_file, std::strin
CLI::App app{"demo of conformallab"};
app.add_option("-i,--input", input_file, "Input OFF file")->required();
app.add_option("-o,--output", output_file, "Output OFF file (optional)");
app.add_flag("-s,--show", show, "Show the input mesh in a viewer");
app.add_flag("-s,--show", show, "Show the input mesh in a viewer ");
app.add_flag("-v,--verbose",verbose, "Enable verbose output");
app.set_help_flag("-h,--help", "Show this help message and exit");
@@ -83,7 +85,12 @@ int main(int argc, char* argv[])
// CGAL -> libigl
if(show){
std::cout << "Visualizing input mesh...\n";
mesh_utils::simple_visualize_mesh<Kernel>(surface_mesh,true);
Eigen::MatrixXd V;
Eigen::MatrixXi F;
mesh_utils::cgal_to_eigen<Kernel>(surface_mesh, V, F);
viewer_utils::simple_visualize(V, F);
}
// for now, we just write the input mesh to the output file as a placeholder

View File

@@ -0,0 +1,9 @@
#include "viewer_utils.h"
namespace viewer_utils {
void simple_visualize(Eigen::MatrixXd& V, Eigen::MatrixXi& F) {
igl::opengl::glfw::Viewer viewer;
viewer.data().set_mesh(V, F);
viewer.launch();
}
}