Created
June 10, 2016 13:23
-
-
Save afabri/f1fa1552e8421c95d35a52f471429d35 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <CGAL/Simple_cartesian.h> | |
#include <CGAL/Polyhedron_3.h> | |
#include <CGAL/Polygon_mesh_processing/polygon_soup_to_polygon_mesh.h> | |
#include <iostream> | |
#include <vector> | |
typedef CGAL::Simple_cartesian<double> Kernel; | |
typedef CGAL::Polyhedron_3<Kernel> Polyhedron; | |
typedef Kernel::Point_3 Point_3; | |
typedef std::vector<Point_3> points; | |
typedef std::vector<std::size_t> Polygon; | |
typedef std::vector<Polygon> Polygons; | |
int main(int argc, char* argv[]) | |
{ | |
points points; | |
points.push_back(Point_3(0,0,0)); | |
points.push_back(Point_3(1,0,0)); | |
points.push_back(Point_3(0,1,0)); | |
points.push_back(Point_3(-1,0,0)); | |
points.push_back(Point_3(0,-1,0)); | |
Polygons polygons; | |
Polygon p; | |
p.push_back(0); | |
p.push_back(1); | |
p.push_back(2); | |
polygons.push_back(p); | |
p.clear(); | |
p.push_back(0); | |
p.push_back(0); | |
p.push_back(0); | |
polygons.push_back(p); | |
p.clear(); | |
p.push_back(0); | |
p.push_back(1); | |
p.push_back(4); | |
polygons.push_back(p); | |
p.clear(); | |
p.push_back(0); | |
p.push_back(3); | |
p.push_back(2); | |
polygons.push_back(p); | |
p.clear(); | |
p.push_back(0); | |
p.push_back(3); | |
p.push_back(4); | |
polygons.push_back(p); | |
CGAL::Polygon_mesh_processing::orient_polygon_soup(points,polygons); | |
for(int i=0; i < points.size(); i++){ | |
std::cerr << points[i] << std::endl; | |
} | |
std::cerr << std::endl; | |
for(int i=0; i < polygons.size(); i++){ | |
std::cerr << polygons[i][0] << " " << polygons[i][1] << " "<< polygons[i][2] << " "<< std::endl; | |
} | |
Polyhedron mesh; | |
CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh(points, polygons, mesh); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment