CGAL 6.1.2 - CGAL and the Boost Graph Library: BGL_surface_mesh/gwdwg.cpp

CGAL 6.1.2 - CGAL and the Boost Graph Library

Loading...
Searching...
No Matches
BGL_surface_mesh/gwdwg.cpp
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/boost/graph/Graph_with_descriptor_with_graph.h>
#include <CGAL/boost/graph/helpers.h>
#include <CGAL/boost/graph/Euler_operations.h>
#include <CGAL/boost/graph/generators.h>
#include <fstream>
typedef CGAL::Simple_cartesian<double> K;
typedef K::Point_3 Point_3;
typedef CGAL::Surface_mesh<Point_3> SM;
typedef CGAL::Polyhedron_3<K> Polyhedron;
typedef CGAL::Graph_with_descriptor_with_graph<SM> Mesh;
typedef CGAL::Graph_with_descriptor_with_graph<Polyhedron> PMesh;
typedef boost::graph_traits<Mesh>::vertex_descriptor vertex_descriptor;
typedef boost::graph_traits<PMesh>::vertex_descriptor pvertex_descriptor;
int main()
{
SM sm;
Mesh mesh(sm);
CGAL::make_hexahedron(
Point_3(-1,-1,-1),
Point_3(1,-1,-1),
Point_3(1,1,-1),
Point_3(-1,1,-1),
Point_3(-1,1,1),
Point_3(-1,-1,1),
Point_3(1,-1,1),
Point_3(1,1,1),
sm
);
vertex_descriptor vd = * vertices(mesh).first;
std::cout << "Mesh is aware that it is based on a "<<typeid(*vd.graph).name()<<"."<< std::endl;
Polyhedron poly;
PMesh pmesh(poly);
CGAL::make_hexahedron(
Point_3(-0.5,-0.5,-0.5),
Point_3(0.5,-0.5,-0.5),
Point_3(0.5,0.5,-0.5),
Point_3(-0.5,0.5,-0.5),
Point_3(-0.5,0.5,0.5),
Point_3(-0.5,-0.5,0.5),
Point_3(0.5,-0.5,0.5),
Point_3(0.5,0.5,0.5),
poly
);
pvertex_descriptor pvd = * vertices(pmesh).first;
std::cout << "Pmesh is aware that it is based on a "<<typeid(*pvd.graph).name()<<"."<< std::endl;
return 0;
}
CGAL::Polyhedron_3
CGAL::Surface_mesh
CGAL::make_hexahedron
boost::graph_traits< Graph >::halfedge_descriptor make_hexahedron(const P &p0, const P &p1, const P &p2, const P &p3, const P &p4, const P &p5, const P &p6, const P &p7, Graph &g, const NamedParameters &np=parameters::default_values())
creates an isolated hexahedron with its vertices initialized to p0, p1, ... , and p7,...
Definition: generators.h:307
CGAL::Graph_with_descriptor_with_graph
The class Graph_with_descriptor_with_graph wraps a graph into another graph in such a way that its de...
Definition: Graph_with_descriptor_with_graph.h:123
CGAL::Simple_cartesian