Skip to content

Instantly share code, notes, and snippets.

@afabri
Created May 11, 2021 07:33
Show Gist options
  • Save afabri/d92d2d5b6dba5075662995e10525a78f to your computer and use it in GitHub Desktop.
Save afabri/d92d2d5b6dba5075662995e10525a78f to your computer and use it in GitHub Desktop.
Need for orientation
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/IO/polygon_soup_io.h>
#include <CGAL/Polygon_mesh_processing/orient_polygon_soup.h>
#include <CGAL/Polygon_mesh_processing/polygon_soup_to_polygon_mesh.h>
#include <iostream>
#include <fstream>
#include <vector>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef K::FT FT;
typedef K::Point_3 Point_3;
typedef CGAL::Surface_mesh<Point_3> Mesh;
typedef std::vector<std::size_t> CGAL_Polygon;
namespace PMP = CGAL::Polygon_mesh_processing;
int main(int, char**)
{
// First, construct a polygon soup with some problems
std::vector<Point_3> points;
std::vector<CGAL_Polygon> polygons;
CGAL::read_polygon_soup("triangulation.obj", points, polygons);
std::cout << points.size() << " " << polygons.size() << std::endl;
Mesh mesh;
//PMP::orient_polygon_soup(points, polygons);
PMP::polygon_soup_to_polygon_mesh(points, polygons, mesh);
std::cout << "Mesh has " << num_vertices(mesh) << " vertices and " << num_faces(mesh) << " faces" << std::endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment