final cleanup of the test suite

This commit is contained in:
Manuel Caroli 2009-05-06 16:21:18 +00:00
parent 539e0b1dea
commit f04dce71d2
5 changed files with 115 additions and 118 deletions

1
.gitattributes vendored
View File

@ -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

View File

@ -0,0 +1,114 @@
template <class Stream, class Triangulation>
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<number_of_cells; i++) {
out << "3 " << i*4 +8 << " " << i*4+1+8 << " " << i*4+2+8 << std::endl;
out << "3 " << i*4 +8 << " " << i*4+1+8 << " " << i*4+3+8 << std::endl;
out << "3 " << i*4 +8 << " " << i*4+2+8 << " " << i*4+3+8 << std::endl;
out << "3 " << i*4+1+8 << " " << i*4+2+8 << " " << i*4+3+8 << std::endl;
}
return out;
}
template<class Stream, class Triangulation, class Cell_iterator>
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<number_of_cells; i++) {
out << "3 " << i*4 << " " << i*4+1 << " " << i*4+2 << std::endl;
out << "3 " << i*4 << " " << i*4+1 << " " << i*4+3 << std::endl;
out << "3 " << i*4 << " " << i*4+2 << " " << i*4+3 << std::endl;
out << "3 " << i*4+1 << " " << i*4+2 << " " << i*4+3 << std::endl;
}
return out;
}
#if 0
//TODO: rewrite this to wrap the stream coming from draw_dual
template <class Stream>
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<Segment,Offset> 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

View File

@ -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 <class Stream, class Triangulation>
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<number_of_cells; i++) {
out << "3 " << i*4 +8 << " " << i*4+1+8 << " " << i*4+2+8 << std::endl;
out << "3 " << i*4 +8 << " " << i*4+1+8 << " " << i*4+3+8 << std::endl;
out << "3 " << i*4 +8 << " " << i*4+2+8 << " " << i*4+3+8 << std::endl;
out << "3 " << i*4+1+8 << " " << i*4+2+8 << " " << i*4+3+8 << std::endl;
}
return out;
}
template<class Stream, class Triangulation, class Cell_iterator>
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<number_of_cells; i++) {
out << "3 " << i*4 << " " << i*4+1 << " " << i*4+2 << std::endl;
out << "3 " << i*4 << " " << i*4+1 << " " << i*4+3 << std::endl;
out << "3 " << i*4 << " " << i*4+2 << " " << i*4+3 << std::endl;
out << "3 " << i*4+1 << " " << i*4+2 << " " << i*4+3 << std::endl;
}
return out;
}
#if 0
//TODO: rewrite this to wrap the stream coming from draw_dual
template <class Stream>
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<Segment,Offset> 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

View File

@ -124,7 +124,6 @@ std::pair<Point, Offset> 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;

View File

@ -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