int main() { LCC_3 lcc; // Create two tetrahedra. Dart_handle d1 = lcc.make_tetrahedron(Point(-1, 0, 0), Point(0, 2, 0), Point(1, 0, 0), Point(1, 1, 2)); Dart_handle d2 = lcc.make_tetrahedron(Point(0, 2, -1), Point(-1, 0, -1), Point(1, 0, -1), Point(1, 1, -3)); // Display all the vertices of the lcc by iterating on the // Vertex_attribute container. CGAL::set_ascii_mode(std::cout); std::cout<<"Vertices: "; for (LCC_3::Vertex_attribute_const_range::iterator v=lcc.vertex_attributes().begin(), vend=lcc.vertex_attributes().end(); v!=vend; ++v) std::cout << lcc.point_of_vertex_attribute(v) << "; "; std::cout<<std::endl; // Display the vertices of each volume by iterating on darts. std::for_each(lcc.one_dart_per_cell<3>().begin(), lcc.one_dart_per_cell<3>().end(), Display_vol_vertices<LCC_3>(lcc)); // 3-Sew the 2 tetrahedra along one facet lcc.sew<3>(d1, d2); // Display the vertices of each volume by iterating on darts. std::for_each(lcc.one_dart_per_cell<3>().begin(), lcc.one_dart_per_cell<3>().end(), Display_vol_vertices<LCC_3>(lcc)); // Translate the second tetrahedra by a given vector LCC_3::Vector v(3,1,1); for (LCC_3::One_dart_per_incident_cell_range<0,3>::iterator it=lcc.one_dart_per_incident_cell<0,3>(d2).begin(), itend=lcc.one_dart_per_incident_cell<0,3>(d2).end(); it!=itend; ++it) { lcc.point(it)=LCC_3::Traits::Construct_translated_point_3() (lcc.point(it),v); } // Display the vertices of each volume by iterating on darts. std::for_each(lcc.one_dart_per_cell<3>().begin(), lcc.one_dart_per_cell<3>().end(), Display_vol_vertices<LCC_3>(lcc)); // We display the lcc characteristics. std::cout<<"LCC characteristics: "; lcc.display_characteristics(std::cout) << ", valid=" << lcc.is_valid() << std::endl; return EXIT_SUCCESS; }
int main() { LCC_3 lcc; // Create one tetrahedra. Dart_handle d1 = lcc.make_tetrahedron(Point(-1, 0, 0), Point(0, 2, 0), Point(1, 0, 0), Point(1, 1, 2)); lcc.display_characteristics(std::cout) << ", valid=" << lcc.is_valid()<<std::endl; constrained_delaunay_triangulation(lcc,d1); lcc.display_characteristics(std::cout) << ", valid=" << lcc.is_valid()<<std::endl; lcc.clear(); std::cout<<std::endl <<"###################################################### \n" <<std::endl; // Create one hexahedron. d1 = lcc.make_hexahedron(Point(0,0,0), Point(1,0,0), Point(1,1,0), Point(0,1,0), Point(0,1,1), Point(0,0,1), Point(1,0,1), Point(1,1,1)); lcc.display_characteristics(std::cout) << ", valid=" << lcc.is_valid()<<std::endl; constrained_delaunay_triangulation(lcc,d1); lcc.display_characteristics(std::cout) << ", valid=" << lcc.is_valid()<<std::endl; constrained_delaunay_triangulation(lcc,lcc.beta<2>(d1)); lcc.display_characteristics(std::cout) << ", valid=" << lcc.is_valid()<<std::endl; lcc.clear(); std::cout<<std::endl <<"###################################################### \n" <<std::endl; std::vector<Point> points; points.push_back(Point(0,0,0)); points.push_back(Point(5,15,0)); points.push_back(Point(8,18,0)); points.push_back(Point(12,5,0)); points.push_back(Point(8,3,0)); points.push_back(Point(8,-9,0)); points.push_back(Point(5,0,0)); points.push_back(Point(2,-3,2)); d1=make_facet(lcc,points); lcc.display_characteristics(std::cout) << ", valid=" << lcc.is_valid()<<std::endl; #ifdef CGAL_LCC_USE_VIEWER display_lcc(lcc); #endif // CGAL_LCC_USE_VIEWER constrained_delaunay_triangulation(lcc,d1); lcc.display_characteristics(std::cout) << ", valid=" << lcc.is_valid()<<std::endl; #ifdef CGAL_LCC_USE_VIEWER display_lcc(lcc); #endif // CGAL_LCC_USE_VIEWER lcc.clear(); std::cout<<std::endl <<"###################################################### \n" <<std::endl; return EXIT_SUCCESS; }