mirror of https://github.com/CGAL/cgal
LCC CM GM
This commit is contained in:
parent
c7730920cf
commit
a75a88945d
|
|
@ -1,6 +1,7 @@
|
|||
#include <CGAL/Combinatorial_map.h>
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
typedef CGAL::Combinatorial_map<3> CMap_3;
|
||||
typedef CMap_3::Dart_handle Dart_handle;
|
||||
|
|
@ -13,19 +14,19 @@ int main()
|
|||
Dart_handle dh1 = cm.make_combinatorial_hexahedron();
|
||||
|
||||
// Add two edges along two opposite facets.
|
||||
CGAL_assertion( cm.is_insertable_cell_1_in_cell_2
|
||||
(cm.beta(dh1,1),cm.beta(dh1,0)) );
|
||||
assert( cm.is_insertable_cell_1_in_cell_2
|
||||
(cm.beta(dh1,1),cm.beta(dh1,0)) );
|
||||
|
||||
cm.insert_cell_1_in_cell_2(cm.beta(dh1,1), cm.beta(dh1,0));
|
||||
CGAL_assertion( cm.is_valid() );
|
||||
assert( cm.is_valid() );
|
||||
|
||||
Dart_handle dh2=cm.beta(dh1,2,1,1,2);
|
||||
|
||||
CGAL_assertion( cm.is_insertable_cell_1_in_cell_2
|
||||
(dh2,cm.beta(dh2,1,1)) );
|
||||
assert( cm.is_insertable_cell_1_in_cell_2
|
||||
(dh2,cm.beta(dh2,1,1)) );
|
||||
|
||||
cm.insert_cell_1_in_cell_2(dh2, cm.beta(dh2,1,1));
|
||||
CGAL_assertion( cm.is_valid() );
|
||||
assert( cm.is_valid() );
|
||||
|
||||
// Insert a facet along these two new edges plus two initial edges
|
||||
// of the hexahedron.
|
||||
|
|
@ -35,28 +36,28 @@ int main()
|
|||
path.push_back(cm.beta(dh2,0));
|
||||
path.push_back(cm.beta(dh2,2,1));
|
||||
|
||||
CGAL_assertion( (cm.is_insertable_cell_2_in_cell_3
|
||||
assert( (cm.is_insertable_cell_2_in_cell_3
|
||||
(path.begin(),path.end())) );
|
||||
|
||||
Dart_handle dh3=cm.insert_cell_2_in_cell_3(path.begin(),path.end());
|
||||
CGAL_assertion( cm.is_valid() );
|
||||
assert( cm.is_valid() );
|
||||
|
||||
// Display the combinatorial map characteristics.
|
||||
cm.display_characteristics(std::cout) << ", valid=" <<
|
||||
cm.is_valid() << std::endl;
|
||||
|
||||
// We use the removal operations to get back to the initial hexahedron.
|
||||
CGAL_assertion( (cm.is_removable<2>(dh3)) );
|
||||
assert( (cm.is_removable<2>(dh3)) );
|
||||
cm.remove_cell<2>(dh3);
|
||||
CGAL_assertion( cm.is_valid() );
|
||||
assert( cm.is_valid() );
|
||||
|
||||
CGAL_assertion( (cm.is_removable<1>(cm.beta(dh1,1))) );
|
||||
assert( (cm.is_removable<1>(cm.beta(dh1,1))) );
|
||||
cm.remove_cell<1>(cm.beta(dh1,1));
|
||||
CGAL_assertion( cm.is_valid() );
|
||||
assert( cm.is_valid() );
|
||||
|
||||
CGAL_assertion( (cm.is_removable<1>(cm.beta(dh2,0))) );
|
||||
assert( (cm.is_removable<1>(cm.beta(dh2,0))) );
|
||||
cm.remove_cell<1>(cm.beta(dh2,0));
|
||||
CGAL_assertion( cm.is_valid() );
|
||||
assert( cm.is_valid() );
|
||||
|
||||
// Display the combinatorial map characteristics.
|
||||
cm.display_characteristics(std::cout) << ", valid="
|
||||
|
|
@ -64,4 +65,3 @@ int main()
|
|||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#include <CGAL/Generalized_map.h>
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
typedef CGAL::Generalized_map<3> GMap_3;
|
||||
typedef GMap_3::Dart_handle Dart_handle;
|
||||
|
|
@ -26,9 +27,9 @@ int main()
|
|||
Dart_handle dh1 = gm.make_combinatorial_tetrahedron();
|
||||
Dart_handle dh2 = gm.make_combinatorial_tetrahedron();
|
||||
|
||||
CGAL_assertion( gm.is_valid() );
|
||||
CGAL_assertion( gm.is_volume_combinatorial_tetrahedron(dh1) );
|
||||
CGAL_assertion( gm.is_volume_combinatorial_tetrahedron(dh2) );
|
||||
assert( gm.is_valid() );
|
||||
assert( gm.is_volume_combinatorial_tetrahedron(dh1) );
|
||||
assert( gm.is_volume_combinatorial_tetrahedron(dh2) );
|
||||
|
||||
// 3) 3-sew them.
|
||||
gm.sew<3>(dh1, dh2);
|
||||
|
|
@ -59,4 +60,3 @@ int main()
|
|||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#include <CGAL/Generalized_map.h>
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
typedef CGAL::Generalized_map<3> GMap_3;
|
||||
typedef GMap_3::Dart_handle Dart_handle;
|
||||
|
|
@ -14,11 +15,11 @@ int main()
|
|||
|
||||
// Add two edges along two opposite facets.
|
||||
gm.insert_cell_1_in_cell_2(d1,gm.alpha<0,1,0>(d1));
|
||||
CGAL_assertion( gm.is_valid() );
|
||||
assert( gm.is_valid() );
|
||||
|
||||
Dart_handle d2=gm.alpha<2,1,0,1,2>(d1);
|
||||
gm.insert_cell_1_in_cell_2(d2,gm.alpha<0,1,0>(d2));
|
||||
CGAL_assertion( gm.is_valid() );
|
||||
assert( gm.is_valid() );
|
||||
|
||||
// Insert a facet along these two new edges plus two initial edges
|
||||
// of the hexahedron.
|
||||
|
|
@ -29,7 +30,7 @@ int main()
|
|||
path.push_back(gm.alpha<2,1>(d2));
|
||||
|
||||
Dart_handle d3=gm.insert_cell_2_in_cell_3(path.begin(),path.end());
|
||||
CGAL_assertion( gm.is_valid() );
|
||||
assert( gm.is_valid() );
|
||||
|
||||
// Display the generalized map characteristics.
|
||||
gm.display_characteristics(std::cout) << ", valid=" <<
|
||||
|
|
@ -37,14 +38,14 @@ int main()
|
|||
|
||||
// We use the removal operations to get back to the initial hexahedron.
|
||||
gm.remove_cell<2>(d3);
|
||||
CGAL_assertion( gm.is_valid() );
|
||||
assert( gm.is_valid() );
|
||||
|
||||
gm.remove_cell<1>(gm.alpha<1>(d1));
|
||||
CGAL_assertion( gm.is_valid() );
|
||||
assert( gm.is_valid() );
|
||||
|
||||
gm.remove_cell<1>(gm.alpha<1>(d2));
|
||||
CGAL_assertion( gm.is_valid() );
|
||||
CGAL_assertion( gm.is_volume_combinatorial_hexahedron(d1) );
|
||||
assert( gm.is_valid() );
|
||||
assert( gm.is_volume_combinatorial_hexahedron(d1) );
|
||||
|
||||
// Display the generalized map characteristics.
|
||||
gm.display_characteristics(std::cout) << ", valid="
|
||||
|
|
@ -52,4 +53,3 @@ int main()
|
|||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#include <CGAL/Generalized_map.h>
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
typedef CGAL::Generalized_map<4> GMap_4;
|
||||
typedef GMap_4::Dart_handle Dart_handle;
|
||||
|
|
@ -11,7 +12,7 @@ int main()
|
|||
Dart_handle d1 = gm.make_combinatorial_tetrahedron();
|
||||
Dart_handle d2 = gm.make_combinatorial_tetrahedron();
|
||||
|
||||
CGAL_assertion(gm.is_valid());
|
||||
assert(gm.is_valid());
|
||||
|
||||
gm.sew<4>(d1,d2);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#include <CGAL/HalfedgeDS_items_2.h>
|
||||
#include <CGAL/HalfedgeDS_vector.h>
|
||||
#include <CGAL/HalfedgeDS_decorator.h>
|
||||
#include <cassert>
|
||||
|
||||
struct Traits { typedef int Point_2; };
|
||||
typedef CGAL::HalfedgeDS_vector< Traits, CGAL::HalfedgeDS_items_2> HDS;
|
||||
|
|
@ -10,6 +11,6 @@ int main() {
|
|||
HDS hds(1,2,2);
|
||||
Decorator decorator(hds);
|
||||
decorator.create_loop();
|
||||
CGAL_assertion( decorator.is_valid());
|
||||
assert( decorator.is_valid());
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#include <CGAL/Linear_cell_complex_for_generalized_map.h>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <cassert>
|
||||
|
||||
typedef CGAL::Linear_cell_complex_for_generalized_map<4,5> LCC_4;
|
||||
typedef LCC_4::Dart_handle Dart_handle;
|
||||
|
|
@ -42,24 +43,24 @@ int main()
|
|||
|
||||
// Add one vertex on the middle of the edge containing dart d1.
|
||||
Dart_handle d3 = lcc.insert_barycenter_in_cell<1>(d1);
|
||||
CGAL_assertion( lcc.is_valid() );
|
||||
assert( lcc.is_valid() );
|
||||
|
||||
lcc.display_characteristics(std::cout);
|
||||
std::cout<<", valid="<<lcc.is_valid()<<std::endl;
|
||||
|
||||
// Add one edge to cut the face containing dart d3 in two.
|
||||
Dart_handle d4 = lcc.insert_cell_1_in_cell_2(d3, lcc.alpha(d1, 1, 0, 1));
|
||||
CGAL_assertion( lcc.is_valid() );
|
||||
assert( lcc.is_valid() );
|
||||
|
||||
lcc.display_characteristics(std::cout);
|
||||
std::cout<<", valid="<<lcc.is_valid()<<std::endl;
|
||||
|
||||
// We use removal operations to get back to the initial configuration.
|
||||
lcc.remove_cell<1>(d4);
|
||||
CGAL_assertion( lcc.is_valid() );
|
||||
assert( lcc.is_valid() );
|
||||
|
||||
lcc.remove_cell<0>(d3);
|
||||
CGAL_assertion( lcc.is_valid() );
|
||||
assert( lcc.is_valid() );
|
||||
|
||||
lcc.unsew<4>(d1);
|
||||
|
||||
|
|
@ -68,4 +69,3 @@ int main()
|
|||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <cassert>
|
||||
|
||||
|
||||
// This example works both with cmap and gmap as combinatorial data structure.
|
||||
|
|
@ -46,7 +47,7 @@ void display_voronoi(LCC_2& alcc, Dart_handle adart)
|
|||
toremove.pop();
|
||||
}
|
||||
|
||||
CGAL_assertion(alcc.is_without_boundary(1));
|
||||
assert(alcc.is_without_boundary(1));
|
||||
|
||||
std::cout<<"Voronoi subdvision, only finite faces:"<<std::endl<<" ";
|
||||
alcc.display_characteristics(std::cout) << ", valid="
|
||||
|
|
@ -122,7 +123,7 @@ int main(int narg, char** argv)
|
|||
|
||||
std::istream_iterator<Point> begin(iFile), end;
|
||||
T.insert(begin, end);
|
||||
CGAL_assertion(T.is_valid(false));
|
||||
assert(T.is_valid(false));
|
||||
|
||||
// 2) Convert the triangulation into a 2D lcc.
|
||||
LCC_2 lcc;
|
||||
|
|
@ -131,7 +132,7 @@ int main(int narg, char** argv)
|
|||
|
||||
Dart_handle dh=CGAL::import_from_triangulation_2<LCC_2, Triangulation>
|
||||
(lcc, T, &face_to_dart);
|
||||
CGAL_assertion(lcc.is_without_boundary());
|
||||
assert(lcc.is_without_boundary());
|
||||
|
||||
std::cout<<"Delaunay triangulation :"<<std::endl<<" ";
|
||||
lcc.display_characteristics(std::cout) << ", valid="
|
||||
|
|
@ -141,7 +142,7 @@ int main(int narg, char** argv)
|
|||
LCC_2 dual_lcc;
|
||||
Dart_handle ddh=lcc.dual(dual_lcc, dh);
|
||||
// Here, dual_lcc is the 2D Voronoi diagram.
|
||||
CGAL_assertion(dual_lcc.is_without_boundary());
|
||||
assert(dual_lcc.is_without_boundary());
|
||||
|
||||
// 4) We update the geometry of dual_lcc by using the std::map
|
||||
// face_to_dart.
|
||||
|
|
@ -159,4 +160,3 @@ int main(int narg, char** argv)
|
|||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <cassert>
|
||||
|
||||
/* // If you want to use exact constructions.
|
||||
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
|
||||
|
|
@ -48,7 +49,7 @@ void display_voronoi(LCC_3& alcc, Dart_handle adart)
|
|||
toremove.pop();
|
||||
}
|
||||
|
||||
CGAL_assertion(alcc.is_without_boundary(1) && alcc.is_without_boundary(2));
|
||||
assert(alcc.is_without_boundary(1) && alcc.is_without_boundary(2));
|
||||
|
||||
std::cout<<"Voronoi subdvision, only finite volumes:"<<std::endl<<" ";
|
||||
alcc.display_characteristics(std::cout) << ", valid="
|
||||
|
|
@ -126,7 +127,7 @@ int main(int narg, char** argv)
|
|||
|
||||
std::istream_iterator<Point> begin(iFile), end;
|
||||
T.insert(begin, end);
|
||||
CGAL_assertion(T.is_valid(false));
|
||||
assert(T.is_valid(false));
|
||||
|
||||
// 2) Convert the triangulation into a 3D lcc.
|
||||
LCC_3 lcc;
|
||||
|
|
@ -144,7 +145,7 @@ int main(int narg, char** argv)
|
|||
LCC_3 dual_lcc;
|
||||
Dart_handle ddh=lcc.dual(dual_lcc, dh);
|
||||
// Here, dual_lcc is the 3D Voronoi diagram.
|
||||
CGAL_assertion(dual_lcc.is_without_boundary());
|
||||
assert(dual_lcc.is_without_boundary());
|
||||
|
||||
// 4) We update the geometry of dual_lcc by using the std::map
|
||||
// face_to_dart.
|
||||
|
|
@ -161,4 +162,3 @@ int main(int narg, char** argv)
|
|||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue