From c49c118e6876a50654fb81d30356f199b32f63a9 Mon Sep 17 00:00:00 2001 From: Mariette Yvinec Date: Thu, 22 Oct 1998 15:16:42 +0000 Subject: [PATCH] merged with branch b6aout --- .../Triangulation_2/test/Triangulation_2/TODO | 10 +- .../_test_cls_constrained_triangulation_2.C | 359 ++++++++++++++++++ .../include/CGAL/_test_cls_distance.C | 62 +++ .../include/CGAL/_test_cls_geom_traits.C | 5 +- .../include/CGAL/_test_cls_tds_vertex.C | 2 + .../include/CGAL/_test_cls_triangulation_2.C | 99 ++++- .../CGAL/_test_cls_triangulation_vertex.C | 5 + .../include/CGAL/_test_short_names_2.h | 14 + .../CGAL/_test_triangulation_circulators.C | 2 + .../include/CGAL/_test_types.C | 17 +- .../include/CGAL/_test_types.h | 2 + .../test/Triangulation_2/makefile | 11 +- .../test_constrained_triangulation_2.C | 48 +++ .../test_delaunay_triangulation_2.C | 2 +- 14 files changed, 613 insertions(+), 25 deletions(-) create mode 100644 Packages/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_constrained_triangulation_2.C create mode 100644 Packages/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_distance.C create mode 100644 Packages/Triangulation_2/test/Triangulation_2/include/CGAL/_test_short_names_2.h create mode 100644 Packages/Triangulation_2/test/Triangulation_2/test_constrained_triangulation_2.C diff --git a/Packages/Triangulation_2/test/Triangulation_2/TODO b/Packages/Triangulation_2/test/Triangulation_2/TODO index 893eb6c244d..9d3962c9515 100644 --- a/Packages/Triangulation_2/test/Triangulation_2/TODO +++ b/Packages/Triangulation_2/test/Triangulation_2/TODO @@ -9,12 +9,10 @@ TODO pour la test suite de triangulation: RESTE A TESTER: -dans _test_cls_geom_traits() -* manque _test_cls_distance() +Done : dans _test_cls_geom_traits() +* manque _test_cls_distance() ## Erreur compile avec la distance "vide"(cf. _test_cls_distance.C dans _test_cls_triangulation_2() -* la fonction flip() -* le Line_face_circulator et la fonction line_walk() * les fonctions advanced insert_on_edge, insert_collinear_outside, insert_in_face, remove_degree_3 * traversal of the convex hull: quand plusieurs points sont @@ -24,8 +22,6 @@ dans _test_cls_triangulation_2() * le leda_window << Triangulation doit etre teste dans la demo dans _test_cls_triangulation_vertex() -* je comprends pas du tout la description de is_valid et donc pas - teste * je ne sais pas comment tester les typedefs CGAL_Point_2 dans euclidean_traits (pour verifier que c'est bien ce qui est dit). A priori il faudrait utiliser une fonction "bidon" @@ -55,4 +51,4 @@ dans test_cls_delaunay_triangulation() et bien sur... * Regular triangulation -* Constrained triangulation + diff --git a/Packages/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_constrained_triangulation_2.C b/Packages/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_constrained_triangulation_2.C new file mode 100644 index 00000000000..f59446e59c9 --- /dev/null +++ b/Packages/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_constrained_triangulation_2.C @@ -0,0 +1,359 @@ +// ============================================================================ +// +// Copyright (c) 1998 The CGAL Consortium +// +// This software and related documentation is part of an INTERNAL +// release +// of the Computational Geometry Algorithms Library (CGAL). It is +// not +// intended for general use. +// +// ---------------------------------------------------------------------------- +// +// release : +// release_date : +// +// source : +// file : +// revision : +// revision_date : +// author(s) : Francois Rebufat +// (Francois.Rebufat@sophia.inria.fr) +// +// coordinator : INRIA Sophia-Antipolis +// ============================================================================ + + +#include + +template +void +CGAL__test_cls_constrained_triangulation(const Triangulation &) +{ + typedef Triangulation Cls; + + // We assume the traits class has been tested already + // actually, any traits is good if it has been tested + typedef typename Cls::Geom_traits Gt; + + + typedef typename Cls::Point Point; + typedef typename Cls::Segment Segment; + typedef typename Cls::Triangle Triangle; + + + + + typedef typename Cls::Vertex_handle Vertex_handle; + typedef typename Cls::Face_handle Face_handle; + typedef pair Edge; + + typedef typename Cls::Locate_type Locate_type; + + typedef pair Constraint ; + typedef list list_constraints; + typedef typename list_constraints::iterator list_iterator; + + + // Constructors + cout << " constructors " << endl; + list_constraints l; + + // Empty triangulation (0-dimensional) + cout << " 0-Dim " <vertex(li)->point(), Point(0,0)) ); + f = T1_1.locate(Point(9,6),lt,li); assert( lt == Cls::VERTEX ); + assert( T1_1.geom_traits().compare(f->vertex(li)->point(), Point(9,6)) ); + f = T1_1.locate(Point(1.5,1),lt,li); assert( lt == Cls::EDGE ); + assert( (T1_1.geom_traits().compare(f->vertex(f->ccw(li))->point(), Point(0,0)) + && T1_1.geom_traits().compare(f->vertex(f->cw(li))->point(), Point(3,2))) + || (T1_1.geom_traits().compare(f->vertex(f->ccw(li))->point(), Point(3,2)) + && T1_1.geom_traits().compare(f->vertex(f->cw(li))->point(), Point(0,0)))); + f = T1_1.locate(Point(-3,-2),lt,li); assert( lt == Cls::COLLINEAR_OUTSIDE ); + assert( T1_1.geom_traits().compare(f->vertex(li)->point(), Point(0,0)) ); + f = T1_1.locate(Point(1,1),lt,li); assert( lt == Cls::OUTSIDE ); + li = f->index(T1_1.infinite_vertex()); + assert( CGAL__test_is_to_the_left(T1_1,Point(1,1),f,li) ); + f = T1_1.locate(Point(0,100),lt,li); assert( lt == Cls::OUTSIDE ); + li = f->index(T1_1.infinite_vertex()); + assert( CGAL__test_is_to_the_left(T1_1,Point(0,100),f,li) ); + + // 2-dimensional + cout << " point locations 2-dim" << endl; + f = T2_2.locate(Point(0,0),lt,li); assert( lt == Cls::VERTEX ); + assert( T2_2.geom_traits().compare(f->vertex(li)->point(), Point(0,0)) ); + f = T2_2.locate(Point(3,2),lt,li); assert( lt == Cls::VERTEX ); + assert( T2_2.geom_traits().compare(f->vertex(li)->point(), Point(3,2)) ); + + f = T2_2.locate(lpt[0],lt,li); assert( lt == Cls::VERTEX ); + assert( T2_2.geom_traits().compare(f->vertex(li)->point(), lpt[0]) ); + f = T2_2.locate(lpt[2],lt,li); assert( lt == Cls::VERTEX ); + assert( T2_2.geom_traits().compare(f->vertex(li)->point(), lpt[2]) ); + f = T2_2.locate(lpt[4],lt,li); assert( lt == Cls::VERTEX ); + assert( T2_2.geom_traits().compare(f->vertex(li)->point(), lpt[4]) ); + f = T2_2.locate(lpt[6],lt,li); assert( lt == Cls::VERTEX ); + assert( T2_2.geom_traits().compare(f->vertex(li)->point(), lpt[6]) ); + f = T2_2.locate(lpt[8],lt,li); assert( lt == Cls::VERTEX ); + assert( T2_2.geom_traits().compare(f->vertex(li)->point(), lpt[8]) ); + f = T2_2.locate(lpt[15],lt,li); assert( lt == Cls::VERTEX ); + assert( T2_2.geom_traits().compare(f->vertex(li)->point(), lpt[15]) ); + f = T2_2.locate(lpt[19],lt,li); assert( lt == Cls::VERTEX ); + assert( T2_2.geom_traits().compare(f->vertex(li)->point(), lpt[19]) ); + + f = T2_2.locate(Point(0.5,0),lt,li); assert( lt == Cls::EDGE ); + assert( (T2_2.geom_traits().compare(f->vertex(f->ccw(li))->point(),lpt[1]) + && T2_2.geom_traits().compare(f->vertex(f->cw(li))->point(),lpt[0])) + || (T2_2.geom_traits().compare(f->vertex(f->ccw(li))->point(), lpt[0]) + && T2_2.geom_traits().compare(f->vertex(f->cw(li))->point(),lpt[1]))); + f = T2_2.locate(Point(10,10),lt,li); assert( lt == Cls::OUTSIDE ); + li = f->index(T2_2.infinite_vertex()); + assert( CGAL__test_is_to_the_left(T2_2,Point(10,10),f,li) ); + f = T2_2.locate(Point(-1,3),lt,li); assert( lt == Cls::OUTSIDE ); + li = f->index(T2_2.infinite_vertex()); + assert( CGAL__test_is_to_the_left(T2_2,Point(-1,3),f,li) ); + + + + /*************************/ + /******* Iterators *******/ + cout << " iterators" << endl; + CGAL__test_iterators(T1_1); + CGAL__test_iterators(T1_2); + CGAL__test_iterators(T2_1); + CGAL__test_iterators(T2_2); + + /***************************/ + /******* Circulators *******/ + cout << " circulators" << endl; + CGAL__test_circulators(T1_1); + CGAL__test_circulators(T1_2); + CGAL__test_circulators(T2_1); + CGAL__test_circulators(T2_2); + + +// Line_face_circulator + cout << " line face circulator " << endl; + typedef typename Cls::Line_face_circulator LFC; + + LFC fc= T2_2.line_walk(Point(-1,-1),Point(10,10)); + assert(fc.ptr()!=NULL); + assert(!fc.is_empty()); + LFC fc2=fc; + assert(fc==fc2); + fc++; + fc--; + ++fc; + --fc; + Point pp(0.5,0.2); + f = T2_2.locate(pp,lt,li); + assert(lt==Cls::FACE); + fc= T2_2.line_walk(pp,Point(10,10),f); + fc2=fc; + assert(fc==fc2); + fc++; + fc--; + ++fc; + --fc; + int n=0; + do {fc2++ ; n = n+1;} while (fc2 != fc); + // testing with dummy triangulations + assert(T2_1.number_of_vertices()==5); + assert(T2_1.is_valid()); + fc= T2_1.line_walk(Point(-5,-5),Point(5,5)); + fc2=fc; + n=0; + assert(fc==fc2); + do {fc2++ ; n = n+1;} while (fc2 != fc); + assert(n==4); + fc= T2_1.line_walk(Point(0,-1),Point(1,0)); + fc2=fc; + n=0; + assert(fc==fc2); + do {fc2++ ; n = n+1;} while (fc2 != fc); + assert(n==3); + fc= T2_1.line_walk(Point(-1,0),Point(0,1)); + assert(fc.ptr()==NULL); + assert(fc.is_empty()); + + /*****************************/ + /******** Miscellaneaous *****/ + cout << " misc." << endl; + assert( T0_1.ccw(0) == 1 ); + assert( T0_1.ccw(1) == 2 ); + assert( T0_1.ccw(2) == 0 ); + assert( T0_1.cw(0) == 2 ); + assert( T0_1.cw(1) == 0 ); + assert( T0_1.cw(2) == 1 ); + + + f = T2_1.locate(Point(0.2,0.5),lt,li); + Triangle t = T2_1.triangle(f); assert( &t == &t ); + Segment s = T2_1.segment(f,li); assert( &s == &s ); + s = T2_1.segment(Edge(f,li)); assert( &s == &s ); + s = T2_1.segment(T2_1.finite_vertex()->incident_edges()); assert( &s == &s ); + s = T2_1.segment(T2_1.edges_begin()); assert( &s == &s ); + + + /********************/ + /******** I/O *******/ + cout << " output to a file" << endl; + + ofstream of0_1("T01.triangulation", ios::out); + of0_1 << T0_1; of0_1.close(); + + ofstream of0_2("T02.triangulation"); + of0_2 << T0_2; of0_2.close(); + + ofstream of1_1("T11.triangulation"); + of1_1 << T1_1; of1_1.close(); + + ofstream of1_2("T12.triangulation"); + of1_2 << T1_2; of1_2.close(); + + ofstream of2_1("T21.triangulation"); + of2_1 << T2_1; of2_1.close(); + + ofstream of2_2("T22.triangulation"); + of2_2 << T2_2; of2_2.close(); + + cout << " input from a file" << endl; + Cls T0_1_copy; ifstream if0_1("T01.triangulation"); + if0_1 >> T0_1_copy; + + Cls T0_2_copy; ifstream if0_2("T02.triangulation"); + if0_2 >> T0_2_copy; + + Cls T1_1_copy; ifstream if1_1("T11.triangulation"); + if1_1 >> T1_1_copy; + + Cls T1_2_copy; ifstream if1_2("T12.triangulation"); + if1_2 >> T1_2_copy; + + Cls T2_1_copy; ifstream if2_1("T21.triangulation"); + if2_1 >> T2_1_copy; + + Cls T2_2_copy; ifstream if2_2("T22.triangulation"); + if2_2 >> T2_2_copy; + + // Actually need overloading functions insert and remove. + // cout << " Insert and remove "<< endl; +// // Insert and remove vertex +// Point p1(0.5,0.5); +// T4.insert(p1); +// cout << "IV1"<vertex(li); +// T4.remove(v); +// cout << "IV2"<is_constrained(li)); + +// v=f->vertex(li); + +// T4.remove(v); +// cout << "IV4"<set_constraint(1,false); +// assert(f->is_constrained(1)==false); +// f->set_constraint(1,true); +// assert(f->is_constrained(1)); + + +} diff --git a/Packages/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_distance.C b/Packages/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_distance.C new file mode 100644 index 00000000000..3644935e2be --- /dev/null +++ b/Packages/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_distance.C @@ -0,0 +1,62 @@ +// ============================================================================ +// +// Copyright (c) 1998 The CGAL Consortium +// +// This software and related documentation is part of an INTERNAL +// release +// of the Computational Geometry Algorithms Library (CGAL). It is +// not +// intended for general use. +// +// ---------------------------------------------------------------------------- +// +// release : +// release_date : +// +// source : +// file : +// revision : +// revision_date : +// author(s) : Francois Rebufat +// (Francois.Rebufat@sophia.inria.fr) +// +// coordinator : INRIA Sophia-Antipolis +// ============================================================================ + +#include + +template +void +CGAL__test_cls_distance(Point p[34],const Traits &) +{ + // typedef CGAL_Distance_2 Distance; + typedef typename Traits::Distance Distance; + typedef typename Traits::Point Point; + //test for constructors + Distance d0; + Distance d1(p[0]); + Distance d2(p[0],p[1]); + Distance d3(p[0],p[1],p[2]); + // try to apply compare to a valid objects + assert(d3.compare()==CGAL_SMALLER); + // test accessors + assert(d1.get_point(0)==p[0]); + assert(d3.get_point(0)==p[0]); + assert(d3.get_point(1)==p[1]); + assert(d3.get_point(2)==p[2]); + // test modifiers + // Not possible to apply set_point to an empty Distance. + d0.set_point(0,p[0]); + d0.set_point(1,p[1]); + d0.set_point(2,p[2]); + assert(d0.compare()==CGAL_SMALLER); + d1.set_point(1,p[1]); + d1.set_point(2,p[2]); + assert(d1.compare()==CGAL_SMALLER); + // test a degenerate case p1=p2 + d3.set_point(2,p[1]); + assert(d3.compare()==CGAL_EQUAL); + // test a degenerate case p0=p1=p2 + d3.set_point(0,p[1]); + assert(d3.compare()==CGAL_EQUAL); + } diff --git a/Packages/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_geom_traits.C b/Packages/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_geom_traits.C index 2ccd48f1eb4..7c6b65ae287 100644 --- a/Packages/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_geom_traits.C +++ b/Packages/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_geom_traits.C @@ -22,7 +22,7 @@ #include -// #include +#include // In order to test the class properly, we need some points whose // geometry is defined accordingly. The following must be true: @@ -35,6 +35,7 @@ // p[15],p[16],p[17] COLLINEAR template + void CGAL__test_cls_geom_traits( Point p[34], const Traits & ) { @@ -97,7 +98,7 @@ CGAL__test_cls_delaunay_geom_traits( Point p[34], const Traits & ) Traits gt; // Distance - // CGAL__test_cls_distance(Traits); + CGAL__test_cls_distance(p, Traits()); // Test side_of_oriented_circle() assert( gt.side_of_oriented_circle(p[18],p[19],p[20],p[21]) == CGAL_ON_NEGATIVE_SIDE ); diff --git a/Packages/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_tds_vertex.C b/Packages/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_tds_vertex.C index 7319a8ded74..228ce13b822 100644 --- a/Packages/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_tds_vertex.C +++ b/Packages/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_tds_vertex.C @@ -38,6 +38,8 @@ CGAL__test_cls_tds_vertex( const Vertex &, const Gt & ) typedef typename Vertex::Face_circulator Face_circulator; typedef typename Vertex::Edge_circulator Edge_circulator; + + // Build a few objects // Build a few objects Point p2(1,2); Point p3(2,3); diff --git a/Packages/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_triangulation_2.C b/Packages/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_triangulation_2.C index 8f8527711cf..b24659d1282 100644 --- a/Packages/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_triangulation_2.C +++ b/Packages/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_triangulation_2.C @@ -15,8 +15,9 @@ // file : include/CGAL/_test_cls_triangulation_2.C // revision : // revision_date : + // author(s) : Herve Bronnimann (Herve.Bronnimann@sophia.inria.fr) -// + // coordinator : INRIA Sophia-Antipolis // ============================================================================ @@ -34,6 +35,8 @@ #include #include + + template < class VIt > class V2p_adaptor : public VIt { public: @@ -325,6 +328,30 @@ CGAL__test_cls_triangulation_2( const Triangulation & ) assert( T2_7.number_of_vertices() == m*p ); assert( T2_7.is_valid() ); + // test flip + cout << " test flip " << endl; + Cls T2_8=T2_7; + assert( T2_8.is_valid() ); + Face_handle ff = T2_8.locate(Point(5*px+5*qx,5*py+5*qy)); + assert(!T2_8.is_infinite(ff)); + Face_handle f2 = ff->neighbor(0); + assert(!T2_8.is_infinite(f2)); + // T2_8.flip(ff,0); + // Ok precondition violation (non convex quadrilater) + assert( T2_8.is_valid() ); + // try with a valid face (and neighbor) + T2_8.clear(); + T2_8.insert(Point(0,0,1)); + T2_8.insert(Point(1,0,1)); + T2_8.insert(Point(2,2,1)); + T2_8.insert(Point(1,1,1)); + ff = T2_8.locate(Point(0.5,0.5)); + assert(!T2_8.is_infinite(ff)); + f2 = ff->neighbor(1); + assert(!T2_8.is_infinite(f2)); + assert( T2_8.is_valid() ); + + /****************************/ /***** CONSTRUCTORS (2) *****/ cout << " constructors (2)" << endl; @@ -449,15 +476,20 @@ CGAL__test_cls_triangulation_2( const Triangulation & ) f = T1_3_2.locate(p8,lt,li); assert( lt == Cls::COLLINEAR_OUTSIDE ); assert( T1_3_2.geom_traits().compare(f->vertex(li)->point(), p9) ); f = T1_3_2.locate(p0,lt,li); assert( lt == Cls::OUTSIDE ); - assert( CGAL__test_is_to_the_left(T2_1,p13,f,li) ); + li = f->index(T1_3_2.infinite_vertex()); + assert( CGAL__test_is_to_the_left(T1_3_2,p0,f,li) ); f = T1_3_2.locate(p7,lt,li); assert( lt == Cls::OUTSIDE ); - assert( CGAL__test_is_to_the_left(T2_1,p13,f,li) ); + li = f->index(T1_3_2.infinite_vertex()); + assert( CGAL__test_is_to_the_left(T1_3_2,p7,f,li) ); f = T1_3_2.locate(p5,lt,li); assert( lt == Cls::OUTSIDE ); - assert( CGAL__test_is_to_the_left(T2_1,p13,f,li) ); + li = f->index(T1_3_2.infinite_vertex()); + assert( CGAL__test_is_to_the_left(T1_3_2,p5,f,li) ); f = T1_3_2.locate(p4,lt,li); assert( lt == Cls::OUTSIDE ); - assert( CGAL__test_is_to_the_left(T2_1,p13,f,li) ); + li = f->index(T1_3_2.infinite_vertex()); + assert( CGAL__test_is_to_the_left(T1_3_2,p4,f,li) ); f = T1_3_2.locate(p6,lt,li); assert( lt == Cls::OUTSIDE ); - assert( CGAL__test_is_to_the_left(T2_1,p13,f,li) ); + li = f->index(T1_3_2.infinite_vertex()); + assert( CGAL__test_is_to_the_left(T1_3_2,p6,f,li) ); // Check point location in 2-dimensional triangulations cout << " point locations 2-dim" << endl; @@ -491,10 +523,13 @@ CGAL__test_cls_triangulation_2( const Triangulation & ) f = T2_1.locate(p12,lt,li); assert( lt == Cls::FACE ); assert( T2_1.oriented_side(f,p12) == CGAL_ON_POSITIVE_SIDE ); f = T2_1.locate(p13,lt,li,f); assert( lt == Cls::OUTSIDE ); + li = f->index(T2_1.infinite_vertex()); assert( CGAL__test_is_to_the_left(T2_1,p13,f,li) ); f = T2_1.locate(p14,lt,li); assert( lt == Cls::OUTSIDE ); + li = f->index(T2_1.infinite_vertex()); assert( CGAL__test_is_to_the_left(T2_1,p14,f,li) ); f = T2_1.locate(p15,lt,li); assert( lt == Cls::OUTSIDE ); + li = f->index(T2_1.infinite_vertex()); assert( CGAL__test_is_to_the_left(T2_1,p15,f,li) ); // test grid locate @@ -554,10 +589,60 @@ CGAL__test_cls_triangulation_2( const Triangulation & ) CGAL__test_circulators(T1_6); CGAL__test_circulators(T2_1); CGAL__test_circulators(T2_3); - CGAL__test_circulators(T2_5); + CGAL__test_circulators (T2_5); CGAL__test_circulators(T2_6); CGAL__test_circulators(T2_7); + // Line_face_circulator + cout << " line face circulator " << endl; + typedef typename Cls::Line_face_circulator LFC; + // here == operator needed for Point! + // testing with the grid triangulation + LFC fc= T2_7.line_walk(p1,p10); + assert(fc.ptr()!=NULL); + assert(!fc.is_empty()); + LFC fc2=fc; + assert(fc==fc2); + fc++; + fc--; + ++fc; + --fc; + Point pp(0,0.5); + f = T2_7.locate(pp,lt,li); + assert(lt==Cls::FACE); + fc= T2_7.line_walk(pp,p10,f); + fc2=fc; + assert(fc==fc2); + fc++; + fc--; + ++fc; + --fc; + // testing with dummy triangulations + int n=0; + do {fc2++ ; n = n+1;} while (fc2 != fc); + assert(T2_8.number_of_vertices()>=2); + assert(T2_8.is_valid()); + fc= T2_8.line_walk(Point(0.5,0.4),Point(5,5)); + fc2=fc; + n=0; + assert(fc==fc2); + do {fc2++ ; n = n+1;} while (fc2 != fc); + assert(n==4); + // the two point are vertices of the triangulation. + Cls TT; + TT.insert(Point(0,0)); TT.insert(Point(1,0));TT.insert(Point(1,1)); + TT.insert(Point(0,1)); + assert(TT.dimension()==2); + assert(TT.is_valid()); + assert(TT.number_of_vertices()==4); + f = TT.locate(Point(0,0)); + fc = TT.line_walk(Point(0,0),Point(1,1)); + fc2 = TT.line_walk(Point(0,0),Point(1,1),f); + assert(fc==fc2); + n=0; + do {fc2++ ; n = n+1;} while (fc2 != fc); + assert(n==3); + /*****************************/ /******** Miscellaneaous *****/ cout << " misc." << endl; diff --git a/Packages/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_triangulation_vertex.C b/Packages/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_triangulation_vertex.C index ee3b668c9c9..c8dfa10ec63 100644 --- a/Packages/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_triangulation_vertex.C +++ b/Packages/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_triangulation_vertex.C @@ -55,6 +55,11 @@ CGAL__test_cls_triangulation_vertex( const Vertex & ) Vertex v2(p2); Vertex v3(p3,f3.handle()); + // test is_valid + assert( v3.face() == f3.handle() ); + f3.set_vertex(1,v3.handle()); + assert(v3.is_valid()); + // Test point() assert( Gt().compare( v2.point(), p2) ); assert( Gt().compare( v3.point(), p3) ); diff --git a/Packages/Triangulation_2/test/Triangulation_2/include/CGAL/_test_short_names_2.h b/Packages/Triangulation_2/test/Triangulation_2/include/CGAL/_test_short_names_2.h new file mode 100644 index 00000000000..be7e7001892 --- /dev/null +++ b/Packages/Triangulation_2/test/Triangulation_2/include/CGAL/_test_short_names_2.h @@ -0,0 +1,14 @@ +#ifndef CGAL_TRIANGULATION_TEST_SHORT_NAMES_2_H +#define CGAL_TRIANGULATION_TEST_SHORT_NAMES_2_ + + +// Define shorter names to please linker (g++/egcs) + #define CGAL_Triangulation_test_point CFAL_Ttp + #define CGAL_Triangulation_test_segment CGAL_Tts + #define CGAL_Triangulation_test_line CGAL_Ttl + #define CGAL_Triangulation_test_direction CGAL_Ttd + #define CGAL_Triangulation_test_ray CGAL_Ttr + #define CGAL_Triangulation_test_distance CGAL_Ttdst + #define CGAL__Triangulation_test_traits CGAL__Tttr + +#endif CGAL_TRIANGULATION_TEST_SHORT_NAMES_2_H diff --git a/Packages/Triangulation_2/test/Triangulation_2/include/CGAL/_test_triangulation_circulators.C b/Packages/Triangulation_2/test/Triangulation_2/include/CGAL/_test_triangulation_circulators.C index 82d67fa23f2..e423e48b272 100644 --- a/Packages/Triangulation_2/test/Triangulation_2/include/CGAL/_test_triangulation_circulators.C +++ b/Packages/Triangulation_2/test/Triangulation_2/include/CGAL/_test_triangulation_circulators.C @@ -93,3 +93,5 @@ CGAL__test_circulators( const Triangulation &T ) //Check Euler formula assert( n+m == 2*(T.number_of_vertices() +1) -4); } + + diff --git a/Packages/Triangulation_2/test/Triangulation_2/include/CGAL/_test_types.C b/Packages/Triangulation_2/test/Triangulation_2/include/CGAL/_test_types.C index f680f58326b..35c8df8422e 100644 --- a/Packages/Triangulation_2/test/Triangulation_2/include/CGAL/_test_types.C +++ b/Packages/Triangulation_2/test/Triangulation_2/include/CGAL/_test_types.C @@ -43,6 +43,7 @@ class CGAL_Triangulation_test_point { bool uncompare(const Point &p) const { return !compare(p); } Point &operator=(const Point &p) { _x=p.test_x(); _y=p.test_y(); return *this; } void test_set(TESTFT x, TESTFT y) { _x=x; _y=y; } + bool operator==(const Point &p) const {return this->compare(p);} }; class CGAL_Triangulation_test_segment { @@ -56,6 +57,7 @@ class CGAL_Triangulation_test_segment { : _p(p), _q(q) {} void test_set(const Point &p, const Point &q) { _p=p; _q=q; } + }; class CGAL_Triangulation_test_direction { @@ -289,13 +291,20 @@ istream &operator>>(istream &is, CGAL_Triangulation_test_triangle &t) } + + ostream &operator<<(ostream &os, const CGAL_Triangulation_test_point &p) { return os << p.test_x() << ' ' << p.test_y(); } -ostream &operator<<(ostream &os, const CGAL_Triangulation_test_triangle &t) -{ - return os << t.p() <<' '<< t.q() <<' '<< t.r() ; -} +//ostream &operator<<(ostream &os, const CGAL_Triangulation_test_segment &s) +//{ +// return os << s.test_source() << ' ' << s.test_target(); +//} + +//ostream &operator<<(ostream &os, const CGAL_Triangulation_test_triangle &t) +//{ +// return os << t.p() <<' '<< t.q() <<' '<< t.r() ; +//} diff --git a/Packages/Triangulation_2/test/Triangulation_2/include/CGAL/_test_types.h b/Packages/Triangulation_2/test/Triangulation_2/include/CGAL/_test_types.h index 6eabcf1ff03..81b4f81e709 100644 --- a/Packages/Triangulation_2/test/Triangulation_2/include/CGAL/_test_types.h +++ b/Packages/Triangulation_2/test/Triangulation_2/include/CGAL/_test_types.h @@ -16,6 +16,8 @@ #include #endif // CGAL_HOMOGENEOUS_H +#include + typedef CGAL_Cartesian Test_rep_cartesian; typedef CGAL_Homogeneous Test_rep_homogeneous; diff --git a/Packages/Triangulation_2/test/Triangulation_2/makefile b/Packages/Triangulation_2/test/Triangulation_2/makefile index 161b88b0273..a06abc3e97b 100644 --- a/Packages/Triangulation_2/test/Triangulation_2/makefile +++ b/Packages/Triangulation_2/test/Triangulation_2/makefile @@ -4,7 +4,7 @@ #---------------------------------------------------------------------# # Choose the right include file from the /make directory. -# CGAL_MAKEFILE = ENTER_YOUR_INCLUDE_MAKEFILE_HERE +CGAL_MAKEFILE = /u/alcor/0/prisme_util/CGAL/CGAL-1.2-I-4/make/makefile_sparc_SunOS-5.6_g++-2.8.1_LEDA include $(CGAL_MAKEFILE) #---------------------------------------------------------------------# @@ -18,12 +18,12 @@ CXXFLAGS = \ $(TESTSUITE_CXXFLAGS) \ -g + #---------------------------------------------------------------------# # linker flags #---------------------------------------------------------------------# -LDFLAGS = \ - $(TESTSUITE_LDFLAGS) \ +LDFLAGS = $(TESTSUITE_LDFLAGS) \ $(CGAL_LDFLAGS) #---------------------------------------------------------------------# @@ -45,10 +45,13 @@ test_triangulation_2: test_triangulation_2.o test_delaunay_triangulation_2: test_delaunay_triangulation_2.o $(CGAL_CXX) -o test_delaunay_triangulation_2 test_delaunay_triangulation_2.o $(LDFLAGS) +test_constrained_triangulation_2: test_constrained_triangulation_2.o + $(CGAL_CXX) -o test_constrained_triangulation_2 test_constrained_triangulation_2.o $(LDFLAGS) + clean: - rm -f *.o test_triangulation_geom_traits test_triangulation_2 \ test_triangulation_tds test_delaunay_triangulation_2 core \ - T??.triangulation + T??.triangulation test_constrained_triangulation_2 realclean: clean - rm -f Program* Error* Compiler* error* diff --git a/Packages/Triangulation_2/test/Triangulation_2/test_constrained_triangulation_2.C b/Packages/Triangulation_2/test/Triangulation_2/test_constrained_triangulation_2.C new file mode 100644 index 00000000000..c7943d57e56 --- /dev/null +++ b/Packages/Triangulation_2/test/Triangulation_2/test_constrained_triangulation_2.C @@ -0,0 +1,48 @@ +// ============================================================================ +// +// Copyright (c) 1998 The CGAL Consortium +// +// This software and related documentation is part of an INTERNAL release +// of the Computational Geometry Algorithms Library (CGAL). It is not +// intended for general use. +// +// ---------------------------------------------------------------------------- +// +// release : +// release_date : +// +// source : test_constrained_triangulation.C +// file : test_constrained_triangulation.C +// revision : +// revision_date : +// author(s) : Francois Rebufat (Francois.Rebufat@sophia.inria.fr) +// +// coordinator : INRIA Sophia-Antipolis +// ============================================================================ + + + +#include + +#include +#include + +#include +#include + +#include +#include + +int main() +{ + cout << "Testing constrained_triangulation with Gmpz "<< endl; + + typedef CGAL__Triangulation_test_traits Gt; + typedef CGAL_Triangulation_vertex_base_2 Vb; + typedef CGAL_Constrained_triangulation_face_base_2 Fb; + typedef CGAL_Triangulation_default_data_structure_2 Tds; + typedef CGAL_Constrained_triangulation_2 CCls; + + CGAL__test_cls_constrained_triangulation(CCls()); + return 0; +} diff --git a/Packages/Triangulation_2/test/Triangulation_2/test_delaunay_triangulation_2.C b/Packages/Triangulation_2/test/Triangulation_2/test_delaunay_triangulation_2.C index 41a9b35a4f5..c1ba2cbdaae 100644 --- a/Packages/Triangulation_2/test/Triangulation_2/test_delaunay_triangulation_2.C +++ b/Packages/Triangulation_2/test/Triangulation_2/test_delaunay_triangulation_2.C @@ -37,7 +37,7 @@ int main() { - cout << "Testing Triangulation_2 with Gmpz coordinates"; + cout << "Testing Delaunay Triangulation_2 with Gmpz coordinates"; // cout << " with Euclidean_traits_2 : " << endl; // typedef CGAL_Triangulation_euclidean_traits_2 Gt; cout << " with Triangulation_test_traits : " << endl;