File: sm_join.cpp

package info (click to toggle)
cgal 4.9-1
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 85,584 kB
  • sloc: cpp: 640,841; ansic: 140,696; sh: 708; fortran: 131; makefile: 114; python: 92
file content (40 lines) | stat: -rw-r--r-- 1,136 bytes parent folder | download
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
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Surface_mesh.h>
#include <iostream>
#include <fstream>

#include <boost/foreach.hpp>

typedef CGAL::Simple_cartesian<double>                       Kernel;
typedef Kernel::Point_3                                      Point;
typedef CGAL::Surface_mesh<Point>                            Mesh;

typedef boost::graph_traits<Mesh>::vertex_descriptor vertex_descriptor;

int main(int argc, char* argv[]) 
{
  Mesh sm1, sm2;
  std::ifstream in1((argc>1)?argv[1]:"data/triangle.off");
  in1 >> sm1;
 
  std::ifstream in2((argc>2)?argv[2]:"data/quad.off");

  Mesh::Property_map<vertex_descriptor,std::string> name1, name2;
  bool created;
  sm1.add_property_map<vertex_descriptor,int>("v:weight",7812);
  boost::tie(name1, created) = sm1.add_property_map<vertex_descriptor,std::string>("v:name","hello");
  boost::tie(name2, created) = sm2.add_property_map<vertex_descriptor,std::string>("v:name","world");

  in2 >> sm2;

  sm1 += sm2;

 
  BOOST_FOREACH(vertex_descriptor vd , vertices(sm1)){
    std::cerr << vd << " " <<  name1[vd] <<std::endl;
  }
  
  
  std::cout << sm1 << std::endl;

}