File: gwdwg.cpp

package info (click to toggle)
cgal 6.1.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 144,952 kB
  • sloc: cpp: 811,597; ansic: 208,576; sh: 493; python: 411; makefile: 286; javascript: 174
file content (61 lines) | stat: -rw-r--r-- 1,682 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#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;
}