File: gmap_3_insert.cpp

package info (click to toggle)
cgal 6.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 141,840 kB
  • sloc: cpp: 797,081; ansic: 203,398; sh: 490; python: 411; makefile: 286; javascript: 174
file content (34 lines) | stat: -rw-r--r-- 973 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
#include <CGAL/Generalized_map.h>
#include <iostream>
#include <cstdlib>
#include <cassert>

typedef CGAL::Generalized_map<3> GMap_3;
typedef GMap_3::Dart_descriptor  Dart_descriptor;

int main()
{
  GMap_3 gm;

  // Create one combinatorial hexahedron
  Dart_descriptor d1 = gm.make_combinatorial_hexahedron();

  // Create one square face
  Dart_descriptor d2=gm.make_combinatorial_polygon(4);

  assert(gm.is_insertable_cell_1_between_two_cells_2(d1,d2));

  // Insert the square face as a hole of the face of the hexahedron containing d1
  gm.insert_cell_1_between_two_cells_2(d1, d2);

  // Display the combinatorial map characteristics.
  gm.display_characteristics(std::cout)<<", valid="
                                       <<gm.is_valid()<<std::endl;

  std::size_t nb=0;
  for(Dart_descriptor dh=gm.darts().begin(); dh!=gm.darts().end(); ++dh)
  { if (gm.is_free<2>(dh)) ++nb; }
  std::cout<<"Number of 2-free darts: "<<nb<<std::endl;

  return EXIT_SUCCESS;
}