diff --git a/.gitattributes b/.gitattributes index 38ad27244ac..8241a059e7f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2768,6 +2768,7 @@ Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_remove_traits_3 Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_statically_filtered_traits_3.h -text Periodic_3_triangulation_3/include/CGAL/Static_filters/Periodic_3_orientation_3.h -text Periodic_3_triangulation_3/include/CGAL/Static_filters/Periodic_3_side_of_oriented_sphere_3.h -text +Periodic_3_triangulation_3/include/CGAL/periodic_3_triangulation_3_io.h -text Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/data/P3DT3_covering_test.tri -text Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/data/P3DT3_covering_test_HOM.tri -text Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/include/CGAL/_test_cls_periodic_3_circulator.h -text diff --git a/Periodic_3_triangulation_3/include/CGAL/periodic_3_triangulation_3_io.h b/Periodic_3_triangulation_3/include/CGAL/periodic_3_triangulation_3_io.h new file mode 100644 index 00000000000..7d84e2f47a5 --- /dev/null +++ b/Periodic_3_triangulation_3/include/CGAL/periodic_3_triangulation_3_io.h @@ -0,0 +1,114 @@ +template +Stream &write_triangulation_to_off(Stream &out, Triangulation &t) { + typedef typename Triangulation::Point Point; + typedef typename Triangulation::Iso_cuboid Iso_cuboid; + int number_of_cells = t.tds().number_of_cells(); + out << "OFF " + << "\n" << 4*number_of_cells + 8 + << " " << 4*number_of_cells + 6 + << " " << 0 + << std::endl; + + Iso_cuboid cb = t.domain(); + + out << cb.xmin() << " " << cb.ymin() << " " << cb.zmax() << std::endl; + out << cb.xmax() << " " << cb.ymin() << " " << cb.zmax() << std::endl; + out << cb.xmin() << " " << cb.ymax() << " " << cb.zmax() << std::endl; + out << cb.xmax() << " " << cb.ymax() << " " << cb.zmax() << std::endl; + out << cb.xmin() << " " << cb.ymax() << " " << cb.zmin() << std::endl; + out << cb.xmax() << " " << cb.ymax() << " " << cb.zmin() << std::endl; + out << cb.xmin() << " " << cb.ymin() << " " << cb.zmin() << std::endl; + out << cb.xmax() << " " << cb.ymin() << " " << cb.zmin() << std::endl; + + if (t.number_of_sheets() == CGAL::make_array(1,1,1)) { + for (typename Triangulation::Cell_iterator it = t.cells_begin(); + it != t.cells_end(); it++) { + for (int i=0; i<4; i++) { + Point p = t.point(t.periodic_point(it,i)); + out << p.x() << " " + << p.y() << " " + << p.z() << std::endl; + } + } + } else { + for (typename Triangulation::Cell_iterator it = t.cells_begin(); + it != t.cells_end(); it++) { + for (int i=0; i<4; i++) { + typename Triangulation::Vertex_handle vh; + typename Triangulation::Offset off; + t.get_vertex(it, i, vh, off); + Point p = t.point(t.periodic_point(it, i)); + + out << p.x() << " " + << p.y() << " " + << p.z() << std::endl; + } + } + } + out << "4 0 1 3 2" << std::endl; + out << "4 2 3 5 4" << std::endl; + out << "4 4 5 7 6" << std::endl; + out << "4 6 7 1 0" << std::endl; + out << "4 1 7 5 3" << std::endl; + out << "4 6 0 2 4" << std::endl; + + for (int i=0; i +Stream &write_cells_to_off(Stream &out, Triangulation &t, int number_of_cells, + Cell_iterator cit, Cell_iterator cells_end) { + typedef typename Triangulation::Point Point; + out << "OFF " + << "\n" << 4*number_of_cells + << " " << 4*number_of_cells + << " " << 0 + << std::endl; + + while (cit != cells_end) { + for (int i=0; i<4; i++) { + Point p = t.get_point(*cit,i); + out << p.x() << " " << p.y() << " " << p.z() << std::endl; + } + ++cit; + } + + for (int i=0; i +Stream& draw_dual_to_off(Stream &os) { + os << "OFF " << "\n" + << 2*number_of_facets() << " " + << number_of_facets() << " 0" << std::endl; + for (Facet_iterator fit = facets_begin(), end = facets_end(); + fit != end; ++fit) { + if (!is_canonical(*fit)) continue; + std::pair pso = dual(*fit); + os << pso.first.source() << std::endl + << pso.first.target() - pso.second<< std::endl; + } + CGAL_assertion( i==number_of_facets()); + for(unsigned int i=0 ; i < number_of_facets() ; i++) { + os << "2 " << i*2 << " " << i*2+1 << std::endl; + } + return os; +} +#endif + diff --git a/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/include/CGAL/_test_cls_periodic_3_delaunay_3.h b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/include/CGAL/_test_cls_periodic_3_delaunay_3.h index bf9b3e18ae0..dff8b1fcd93 100644 --- a/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/include/CGAL/_test_cls_periodic_3_delaunay_3.h +++ b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/include/CGAL/_test_cls_periodic_3_delaunay_3.h @@ -423,119 +423,3 @@ _test_cls_periodic_3_delaunay_3(const Periodic_3Triangulation_3 &, pts.push_back(Point(2,5,2)); P3T3(pts.begin(), pts.end(), Iso_cuboid(0,0,0,10,10,10)); } - -// TODO: put the following functions together with some io functionality -template -Stream &write_triangulation_to_off(Stream &out, Triangulation &t) { - typedef typename Triangulation::Point Point; - typedef typename Triangulation::Iso_cuboid Iso_cuboid; - int number_of_cells = t.tds().number_of_cells(); - out << "OFF " - << "\n" << 4*number_of_cells + 8 - << " " << 4*number_of_cells + 6 - << " " << 0 - << std::endl; - - Iso_cuboid cb = t.domain(); - - out << cb.xmin() << " " << cb.ymin() << " " << cb.zmax() << std::endl; - out << cb.xmax() << " " << cb.ymin() << " " << cb.zmax() << std::endl; - out << cb.xmin() << " " << cb.ymax() << " " << cb.zmax() << std::endl; - out << cb.xmax() << " " << cb.ymax() << " " << cb.zmax() << std::endl; - out << cb.xmin() << " " << cb.ymax() << " " << cb.zmin() << std::endl; - out << cb.xmax() << " " << cb.ymax() << " " << cb.zmin() << std::endl; - out << cb.xmin() << " " << cb.ymin() << " " << cb.zmin() << std::endl; - out << cb.xmax() << " " << cb.ymin() << " " << cb.zmin() << std::endl; - - if (t.number_of_sheets() == CGAL::make_array(1,1,1)) { - for (typename Triangulation::Cell_iterator it = t.cells_begin(); - it != t.cells_end(); it++) { - for (int i=0; i<4; i++) { - Point p = t.point(t.periodic_point(it,i)); - out << p.x() << " " - << p.y() << " " - << p.z() << std::endl; - } - } - } else { - for (typename Triangulation::Cell_iterator it = t.cells_begin(); - it != t.cells_end(); it++) { - for (int i=0; i<4; i++) { - typename Triangulation::Vertex_handle vh; - typename Triangulation::Offset off; - t.get_vertex(it, i, vh, off); - Point p = t.point(t.periodic_point(it, i)); - - out << p.x() << " " - << p.y() << " " - << p.z() << std::endl; - } - } - } - out << "4 0 1 3 2" << std::endl; - out << "4 2 3 5 4" << std::endl; - out << "4 4 5 7 6" << std::endl; - out << "4 6 7 1 0" << std::endl; - out << "4 1 7 5 3" << std::endl; - out << "4 6 0 2 4" << std::endl; - - for (int i=0; i -Stream &write_cells_to_off(Stream &out, Triangulation &t, int number_of_cells, - Cell_iterator cit, Cell_iterator cells_end) { - typedef typename Triangulation::Point Point; - out << "OFF " - << "\n" << 4*number_of_cells - << " " << 4*number_of_cells - << " " << 0 - << std::endl; - - while (cit != cells_end) { - for (int i=0; i<4; i++) { - Point p = t.get_point(*cit,i); - out << p.x() << " " << p.y() << " " << p.z() << std::endl; - } - ++cit; - } - - for (int i=0; i -Stream& draw_dual_to_off(Stream &os) { - os << "OFF " << "\n" - << 2*number_of_facets() << " " - << number_of_facets() << " 0" << std::endl; - for (Facet_iterator fit = facets_begin(), end = facets_end(); - fit != end; ++fit) { - if (!is_canonical(*fit)) continue; - std::pair pso = dual(*fit); - os << pso.first.source() << std::endl - << pso.first.target() - pso.second<< std::endl; - } - CGAL_assertion( i==number_of_facets()); - for(unsigned int i=0 ; i < number_of_facets() ; i++) { - os << "2 " << i*2 << " " << i*2+1 << std::endl; - } - return os; -} -#endif - diff --git a/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/include/CGAL/_test_periodic_3_static_filters.h b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/include/CGAL/_test_periodic_3_static_filters.h index 62b099bb2a6..442c31ab992 100644 --- a/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/include/CGAL/_test_periodic_3_static_filters.h +++ b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/include/CGAL/_test_periodic_3_static_filters.h @@ -124,7 +124,6 @@ std::pair pick_coplanar( { // s = p + (p-q)*my_rand() + (p-r)*my_rand(); (almost) - // TODO this currently only works for the domain being a unit cube double r1 = my_rand_dbl(), r2 = my_rand_dbl(); double x = p.x()+po.x() + (q.x()+qo.x() - (p.x()+po.x()))*r1 + (r.x()+ro.x() - (p.x()+po.x()))*r2; diff --git a/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_triangulation_traits_3.cpp b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_triangulation_traits_3.cpp index 2f44639e9a8..9684cf60a57 100755 --- a/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_triangulation_traits_3.cpp +++ b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_triangulation_traits_3.cpp @@ -109,7 +109,6 @@ int main() #endif #ifdef CGAL_USE_LEDA - // TODO: This is not tested as I don't have leda on my machine. std::cout<<" LEDA...";std::cout.flush(); #define RT leda_integer #define FT leda_rational