*** empty log message ***

This commit is contained in:
Monique Teillaud 1998-12-04 09:09:26 +00:00
parent 480694a413
commit 745d397f9c
1 changed files with 321 additions and 54 deletions

View File

@ -16,6 +16,7 @@
#include <CGAL/Triangulation_data_structure_3.h>
#include <CGAL/Triangulation_geom_traits_3.h>
#include <CGAL/Triangulation_3.h>
#include <CGAL/Delaunay_triangulation_3.h>
#include <CGAL/Triangulation_short_names_3.h>
@ -42,12 +43,13 @@ typedef CGAL_Triangulation_ds_facet_iterator_3<TDS> TDSFacet_iterator;
typedef CGAL_Triangulation_ds_cell_circulator_3<TDS> TDSCell_circulator;
typedef CGAL_Triangulation_3<Gt,TDS> Triangulation_3;
typedef CGAL_Delaunay_triangulation_3<Gt,TDS> Delaunay;
typedef CGAL_Triangulation_vertex_iterator_3<Gt,TDS> Vertex_iterator;
typedef CGAL_Triangulation_edge_iterator_3<Gt,TDS> Edge_iterator;
typedef CGAL_Triangulation_cell_iterator_3<Gt,TDS> Cell_iterator;
typedef CGAL_Triangulation_facet_iterator_3<Gt,TDS> Facet_iterator;
// typedef CGAL_Triangulation_cell_circulator_3<Gt,TDS> Cell_circulator;
typedef CGAL_Triangulation_cell_circulator_3<Gt,TDS> Cell_circulator;
typedef typename Triangulation_3::Cell Cell;
typedef typename Triangulation_3::Vertex Vertex;
@ -57,6 +59,10 @@ typedef typename Triangulation_3::Locate_type Locate_type;
typedef Gt::Point Point;
//////////////////////
// TDS
//////////////////////
void affiche_sommets(TDS& T)
{
cout << "sommets TDS : " << endl ;
@ -71,13 +77,41 @@ void affiche_sommets(TDS& T)
}
cout << endl;
}
void affiche_cellules(TDS & T)
{
cout << "cellules TDS : " << endl ;
TDSCell_iterator it = T.cells_begin();
TDSCell_iterator done = T.cells_end();
void affiche_validite(Triangulation_3& T)
if ( it == done ) { cout << "debut=fin" << endl ;}
else {
while(it != done) {
cout << it->vertex(0)->point() << ", "
<< it->vertex(1)->point() << ", "
<< it->vertex(2)->point() << ", "
<< it->vertex(3)->point() << endl;
++it;
}
}
cout << endl;
}
void affiche_validite(TDS& T)
{
bool b = T.is_valid(true,0);
cout << "validite " << b << endl << endl;
}
void affiche_sommets(Triangulation_3& T)
//////////////////////
// Triangulation
//////////////////////
template<class TRIANGULATION>
void affiche_validite(TRIANGULATION& T)
{
bool b = T.is_valid(true,0);
cout << "validite " << b << endl << endl;
}
template<class TRIANGULATION>
void affiche_sommets(TRIANGULATION& T)
{
cout << "sommets : " << endl ;
Vertex_iterator vit = T.all_vertices_begin(), vdone = T.vertices_end();
@ -91,9 +125,10 @@ void affiche_sommets(Triangulation_3& T)
}
cout << endl;
}
void affiche_aretes(Triangulation_3& T)
template<class TRIANGULATION>
void affiche_aretes_plus(TRIANGULATION& T)
{
cout << "aretes : " << endl ;
cout << "aretes plus : " << endl ;
Edge_iterator eit = T.all_edges_begin(), edone = T.edges_end();
if ( eit == edone ) { cout << "debut=fin" << endl ;}
else {
@ -105,9 +140,25 @@ void affiche_aretes(Triangulation_3& T)
}
cout << endl;
}
void affiche_faces(Triangulation_3& T)
template<class TRIANGULATION>
void affiche_aretes_minus(TRIANGULATION& T)
{
cout << "faces : " << endl ;
cout << "aretes minus : " << endl ;
Edge_iterator edone = T.all_edges_begin(), eit = T.edges_end();
if ( eit == edone ) { cout << "debut=fin" << endl ;}
else {
while(eit != edone) {
--eit;
cout << (*eit).first->vertex((*eit).second)->point() << ", "
<< (*eit).first->vertex((*eit).third)->point() << endl;
}
}
cout << endl;
}
template<class TRIANGULATION>
void affiche_faces_plus(TRIANGULATION& T)
{
cout << "faces plus : " << endl ;
Facet_iterator fit = T.all_facets_begin(), fdone = T.facets_end();
int i;
if ( fit == fdone ) { cout << "debut=fin" << endl ;}
@ -123,7 +174,27 @@ void affiche_faces(Triangulation_3& T)
}
cout << endl;
}
void affiche_faces_voisins(Triangulation_3& T)
template<class TRIANGULATION>
void affiche_faces_minus(TRIANGULATION& T)
{
cout << "faces minus : " << endl ;
Facet_iterator fdone = T.all_facets_begin(), fit = T.facets_end();
int i;
if ( fit == fdone ) { cout << "debut=fin" << endl ;}
else {
while(fit != fdone) {
--fit;
for ( i=0; i<4 ; i++ ) {
if ( (*fit).second != i )
{ cout << (*fit).first->vertex(i)->point() << ", "; }
}
cout << endl;
}
}
cout << endl;
}
template<class TRIANGULATION>
void affiche_faces_voisins(TRIANGULATION& T)
{
cout << "faces (dim 2 seulement) : " << endl ;
Facet_iterator fit = T.all_facets_begin(), fdone = T.facets_end();
@ -147,7 +218,8 @@ void affiche_faces_voisins(Triangulation_3& T)
}
cout << endl;
}
void affiche_cellules(Triangulation_3 & T)
template<class TRIANGULATION>
void affiche_cellules( TRIANGULATION& T)
{
cout << "cellules : " << endl ;
Cell_iterator it = T.all_cells_begin();
@ -259,7 +331,8 @@ void insere_dehors(Triangulation_3& T, Point p)
<< T.dimension() << endl;
}
void insere(CGAL_Geomview_stream & os, Triangulation_3& T, Point p)
template<class TRIANGULATION>
void insere(CGAL_Geomview_stream & os, TRIANGULATION & T, Point p)
{
cout << p << endl;
os << p;
@ -296,21 +369,21 @@ void insere(CGAL_Geomview_stream & os, Triangulation_3& T, Point p)
cout << "validite " << T.is_valid(true) << endl;
}
CGAL_Geomview_stream gv(CGAL_Bbox_3(0,0,0, 2, 2, 2));
Triangulation_3 T;
// CGAL_Geomview_stream gv(CGAL_Bbox_3(0,0,0, 2, 2, 2));
// Delaunay* D;
int main(int argc, char* argv[])
{
// Cell essaicell;
// CGAL_Geomview_stream gv(CGAL_Bbox_3(0,0,0, 2, 2, 2));
gv.set_line_width(4);
gv.set_trace(false);
gv.set_bg_color(CGAL_Color(200, 200, 200));
gv.set_face_color(CGAL_RED);
gv.set_edge_color(CGAL_GREEN);
gv.set_vertex_color(CGAL_BLUE);
// // CGAL_Geomview_stream gv(CGAL_Bbox_3(0,0,0, 2, 2, 2));
// gv.set_line_width(4);
// gv.set_trace(false);
// gv.set_bg_color(CGAL_Color(200, 200, 200));
// gv.set_face_color(CGAL_RED);
// gv.set_edge_color(CGAL_GREEN);
// gv.set_vertex_color(CGAL_BLUE);
Point p0(0,0,0);
// pp_point(p0);
@ -321,8 +394,16 @@ int main(int argc, char* argv[])
Point pz(0,0,1);
// pp_point(p0);
// Delaunay T;
// D = &T;
Triangulation_3 T;
// test dim 3
// Triangulation_3 T(p0,px,py,pz);
// Triangulation_3 T(p0,px,py,pz);
// T.insert_outside_affine_hull(p0);
// T.insert_outside_affine_hull(px);
// T.insert_outside_affine_hull(py);
// T.insert_outside_affine_hull(pz);
//Point q(0.2,0.2,0.2); // ok repond CELL
// Point q(.5,.5,0); // ok repond edge
@ -353,7 +434,7 @@ int main(int argc, char* argv[])
// Point q(2,0,0); // ok outside_convex_hull
// test dim 0
Triangulation_3 T;
//Triangulation_3 T;
// T.insert_outside_affine_hull(p0);
// Point q(0,1,0);// ok outside_affine_hull
@ -373,7 +454,7 @@ int main(int argc, char* argv[])
// visu_aretes(gv,T);
// visu_sommets(gv,T);
cout << "validite " << T.is_valid(true) << endl;
// cout << "validite " << T.is_valid(true) << endl;
// test locate
// gv << q;
@ -442,11 +523,6 @@ int main(int argc, char* argv[])
// }
// }
Point nouv;
cout << "point ? " << endl;
cin >> nouv ;
// char entree;
// ifstream is(entree, os::in, filebuf::openprot);
@ -458,34 +534,225 @@ int main(int argc, char* argv[])
// CGAL_set_ascii_mode(is);
// is >> nouv;
Triangulation_3 T2;
int x,y,z=0;
for (z=0 ; z<2 ; z++)
for (y=0 ; y<5 ; y++)
for (x=0 ; x<5 ; x++) {
T2.insert(Point(x,y,z));
assert(T2.is_valid(true));
}
// assert(T2.number_of_vertices()==125);
// assert(T2.dimension()==3);
affiche_aretes_plus(T2);
affiche_aretes_minus(T2);
affiche_faces_plus(T2);
affiche_faces_minus(T2);
// Point nouv;
while ( nouv.x() != 3000 ) {
insere(gv,T,nouv);
switch (T.dimension()) {
case 0:
{
visu_sommets(gv,T);
break;
}
case 1:
{
visu_aretes(gv,T);
break;
}
case 2:
{
visu_faces(gv,T);
break;
}
case 3:
{
visu_cellules(gv,T);
break;
}
}
cout << "point ? " << endl;
cin >> nouv ;
}
// cout << "point ? " << endl;
// cin >> nouv ;
// while ( nouv.x() != 3000 ) {
// insere(gv,T,nouv);
// gv.clear();
// switch (T.dimension()) {
// case 0:
// {
// visu_sommets(gv,T);
// break;
// }
// case 1:
// {
// visu_aretes(gv,T);
// break;
// }
// case 2:
// {
// visu_faces(gv,T);
// break;
// }
// case 3:
// {
// visu_cellules(gv,T);
// break;
// }
// }
// cout << "point ? " << endl;
// cin >> nouv ;
// }
// cout << "copy constructeur" << endl;
// cout << "validite T " << T.is_valid(true) << endl;
// Delaunay T1(T);
// cout << "validite copie " << T1.is_valid(true) << endl;
// cout << "assert T valid" << endl;
// assert(T.is_valid(true));
// cout << "assert T1 valid" << endl;
// assert(T1.is_valid(true));
// Cell_handle c = T2.infinite_cell();
// Edge e = CGAL_make_triple(c,0,1);
// Cell_circulator ccir = T2.incident_cells(e,c);
// // TDS tds1(T2.tds());
// // TDS tds2;
// // tds1.clear();
// // tds2.clear();
// TDSVertex* v1 = new TDSVertex(Point(1,0,0));
// TDSVertex* v2 = new TDSVertex(Point(2,0,0));
// TDSVertex* v3 = new TDSVertex(Point(3,0,0));
// TDSVertex* v4 = new TDSVertex(Point(4,0,0));
// TDSVertex* v5 = new TDSVertex(Point(5,0,0));
// cout << " insertions" << endl;
// TDS tds0;
// tds0.insert_outside_affine_hull(v1, NULL);
// cout << "avec v1" << endl;
// affiche_sommets(tds0);
// affiche_validite(tds0);
// tds0.insert_outside_affine_hull(v2,v1);
// cout << "avec v2" << endl;
// affiche_sommets(tds0);
// affiche_validite(tds0);
// tds0.insert_outside_affine_hull(v3,v2);
// cout << "avec v3" << endl;
// affiche_sommets(tds0);
// affiche_validite(tds0);
// tds0.insert_outside_affine_hull(v4,v3);
// cout << "avec v4" << endl;
// affiche_sommets(tds0);
// affiche_validite(tds0);
// tds0.insert_outside_affine_hull(v5,v4);
// cout << "avec v5" << endl;
// affiche_sommets(tds0);
// affiche_validite(tds0);
// v1 = new TDSVertex(Point(10,0,0));
// v2 = new TDSVertex(Point(20,0,0));
// v3 = new TDSVertex(Point(30,0,0));
// v4 = new TDSVertex(Point(40,0,0));
// v5 = new TDSVertex(Point(50,0,0));
// cout << " constructors" << endl;
// TDS tds1;
// TDS tds2;
// // cout << "tds1" << endl;
// // affiche_sommets(tds1);
// cout << "tds1" << endl;
// affiche_validite(tds1);
// tds2.insert_outside_affine_hull(v1, NULL);
// cout << "tds2" << endl;
// affiche_validite(tds2);
// affiche_sommets(tds2);
// TDS tds3(tds2);
// cout << "tds3 avant" << endl;
// affiche_validite(tds3);
// affiche_sommets(tds3);
// tds3.insert_outside_affine_hull(v2,v1);
// cout << "tds3 apres" << endl;
// affiche_validite(tds3);
// affiche_sommets(tds3);
// tds3.insert_outside_affine_hull(v3,v2);
// cout << "tds3 + v3"<< endl;
// affiche_validite(tds3);
// affiche_sommets(tds3);
// TDS tds4 = tds3;
// cout << "tds4 avant" << endl;
// affiche_validite(tds4);
// affiche_sommets(tds4);
// tds4.insert_outside_affine_hull(v3,v2);
// cout << "tds4 apres" << endl;
// affiche_validite(tds4);
// affiche_sommets(tds4);
// TDS tds5;
// tds5.swap(tds4);
// cout << "tds5 avant" << endl;
// affiche_validite(tds5);
// affiche_sommets(tds5);
// tds5.insert_outside_affine_hull(v4,v3);
// cout << "tds5 apres" << endl;
// affiche_validite(tds5);
// affiche_sommets(tds5);
// TDS tds6;
// tds6.swap(tds5);
// cout << "tds6 avant" << endl;
// affiche_validite(tds6);
// affiche_sommets(tds6);
// tds6.insert_outside_affine_hull(v5,v4);
// cout << "tds6 apres" << endl;
// affiche_validite(tds6);
// affiche_sommets(tds6);
// // Test constructors
// cout << " constructors" << endl;
// TDS tds1;
// TDS tds2;
// TDSVertex_iterator vit;
// tds2.insert_outside_affine_hull(v1, NULL);
// cout << "tds2" << endl;
// affiche_validite(tds2);
// affiche_sommets(tds2);
// TDS tds3(tds2);
// cout << "tds3 avant" << endl;
// affiche_validite(tds3);
// affiche_sommets(tds3);
// vit=tds3.vertices_begin();
// tds3.insert_outside_affine_hull(v2,&*vit);
// cout << "tds3 apres" << endl;
// affiche_validite(tds3);
// affiche_sommets(tds3);
// TDS tds4 = tds3;
// cout << "tds4 avant" << endl;
// affiche_validite(tds4);
// affiche_sommets(tds4);
// vit=tds4.vertices_begin();
// tds4.insert_outside_affine_hull(v3,&*vit);
// cout << "tds4 apres" << endl;
// affiche_validite(tds4);
// affiche_sommets(tds4);
// TDS tds5;
// tds5.swap(tds4);
// cout << "tds5 avant" << endl;
// affiche_validite(tds5);
// affiche_sommets(tds5);
// vit=tds5.vertices_begin();
// tds5.insert_outside_affine_hull(v4,&*vit);
// cout << "tds5 apres" << endl;
// affiche_validite(tds5);
// affiche_sommets(tds5);
// TDS tds6;
// tds6.swap(tds5);
// cout << "tds6 avant" << endl;
// affiche_validite(tds6);
// affiche_sommets(tds6);
// vit=tds6.vertices_begin();
// tds6.insert_outside_affine_hull(v5,&*vit);
// cout << "tds6 apres" << endl;
// affiche_validite(tds6);
// affiche_sommets(tds6);
char ch;
cin >> ch;