mirror of https://github.com/CGAL/cgal
*** empty log message ***
This commit is contained in:
parent
d9d87849fe
commit
3f2af65ef3
|
|
@ -0,0 +1,11 @@
|
|||
demo.C
|
||||
------------
|
||||
Construction of a Delaunay triangulation.
|
||||
|
||||
Needs an input file "data" containing points (given by x y z)
|
||||
|
||||
Opens a geomview window
|
||||
Draws the triangulation in geomview
|
||||
Writes the triangulation into a file "output"
|
||||
------------
|
||||
|
||||
|
|
@ -0,0 +1,205 @@
|
|||
#include <CGAL/basic.h>
|
||||
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <strstream.h>
|
||||
|
||||
#include <list>
|
||||
|
||||
#include <CGAL/Cartesian.h>
|
||||
#include <CGAL/Point_3.h>
|
||||
|
||||
#include <CGAL/Triangulation_iterators_3.h>
|
||||
#include <CGAL/Triangulation_circulators_3.h>
|
||||
#include <CGAL/Triangulation_cell_base_3.h>
|
||||
#include <CGAL/Triangulation_vertex_base_3.h>
|
||||
#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/IO/Geomview_stream.h>
|
||||
|
||||
typedef CGAL::Cartesian<double> Rep;
|
||||
|
||||
typedef CGAL::Triangulation_geom_traits_3<Rep> Gt;
|
||||
typedef CGAL::Triangulation_vertex_base_3<Gt> Vb;
|
||||
typedef CGAL::Triangulation_cell_base_3<Gt> Cb;
|
||||
|
||||
typedef CGAL::Triangulation_data_structure_3<Vb,Cb> TDS;
|
||||
typedef CGAL::Triangulation_3<Gt,TDS> Triangulation;
|
||||
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 typename Triangulation::Cell Cell;
|
||||
typedef typename Triangulation::Vertex Vertex;
|
||||
typedef typename Triangulation::Cell_handle Cell_handle;
|
||||
typedef typename Triangulation::Vertex_handle Vertex_handle;
|
||||
typedef typename Triangulation::Locate_type Locate_type;
|
||||
|
||||
typedef Gt::Point Point;
|
||||
//typedef CGAL::Point_3<Rep> Point;
|
||||
|
||||
//////////////////////
|
||||
// VISU GEOMVIEW
|
||||
//////////////////////
|
||||
template<class TRIANGULATION>
|
||||
void visu_cells(CGAL::Geomview_stream & os, const TRIANGULATION & T)
|
||||
{
|
||||
Cell_iterator cit = T.finite_cells_begin();
|
||||
Cell_iterator cdone = T.cells_end();
|
||||
|
||||
if ( cit == cdone ) { cout << "debut=fin" << endl ;}
|
||||
else {
|
||||
while(cit != cdone) {
|
||||
os << T.tetrahedron(&(*cit));
|
||||
++cit;
|
||||
}
|
||||
}
|
||||
}
|
||||
void visu_cell(CGAL::Geomview_stream & os, Cell_handle c)
|
||||
{
|
||||
os << Gt::Tetrahedron(c->vertex(0)->point(),
|
||||
c->vertex(1)->point(),
|
||||
c->vertex(2)->point(),
|
||||
c->vertex(3)->point());
|
||||
}
|
||||
template<class TRIANGULATION>
|
||||
void visu_facets(CGAL::Geomview_stream & os, const TRIANGULATION & T)
|
||||
{
|
||||
Facet_iterator fit = T.finite_facets_begin();
|
||||
Facet_iterator fdone = T.facets_end();
|
||||
|
||||
if ( fit == fdone ) { cout << "debut=fin" << endl ;}
|
||||
else {
|
||||
while(fit != fdone) {
|
||||
os << T.triangle(*fit);
|
||||
++fit;
|
||||
}
|
||||
}
|
||||
}
|
||||
template<class TRIANGULATION>
|
||||
void visu_edges(CGAL::Geomview_stream & os, const TRIANGULATION & T)
|
||||
{
|
||||
Edge_iterator eit = T.finite_edges_begin();
|
||||
Edge_iterator edone = T.edges_end();
|
||||
|
||||
if ( eit == edone ) { cout << "debut=fin" << endl ;}
|
||||
else {
|
||||
while(eit != edone) {
|
||||
os << T.segment(*eit);
|
||||
++eit;
|
||||
}
|
||||
}
|
||||
}
|
||||
template<class TRIANGULATION>
|
||||
void visu_vertices(CGAL::Geomview_stream & os, const TRIANGULATION & T)
|
||||
{
|
||||
Vertex_iterator vit = T.finite_vertices_begin();
|
||||
Vertex_iterator vdone = T.vertices_end();
|
||||
|
||||
if ( vit == vdone ) { cout << "debut=fin" << endl ;}
|
||||
else {
|
||||
while(vit != vdone) {
|
||||
os << vit->point();
|
||||
++vit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////
|
||||
// INSERTION
|
||||
//////////////////////
|
||||
|
||||
template<class TRIANGULATION>
|
||||
void insere(CGAL::Geomview_stream & os, TRIANGULATION & T, Point p)
|
||||
{
|
||||
cout << p << endl;
|
||||
os << p;
|
||||
cout << "localisation" << endl;
|
||||
Triangulation::Locate_type lt;
|
||||
int li, lj;
|
||||
Cell_handle c = T.locate( p, lt, li, lj ) ;
|
||||
switch ( T.dimension() ) {
|
||||
case 0:
|
||||
{
|
||||
pp_vertex(c->vertex(0));
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
pp_edge(CGAL::make_triple(c,0,1));
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
pp_facet(make_pair(c,3));
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
pp_cell(c);
|
||||
break;
|
||||
}
|
||||
}
|
||||
cout << (int) lt << " " << li << " " << lj << endl;
|
||||
cout << "insertion " << endl;
|
||||
T.insert( p );
|
||||
affiche_sommets(T);
|
||||
cout << "validite " << T.is_valid(true) << endl;
|
||||
}
|
||||
|
||||
|
||||
CGAL::Geomview_stream gv(CGAL::Bbox_3(0,0,0, 2, 2, 2));
|
||||
Delaunay T;
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
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);
|
||||
Point px(1,0,0);
|
||||
Point py(0,1,0);
|
||||
Point pz(0,0,1);
|
||||
|
||||
ifstream iFile("points",ios::in);
|
||||
if (iFile) cout <<" reading file "
|
||||
<< "points" << endl ;
|
||||
Point nouv;
|
||||
if (iFile) {
|
||||
while ( iFile >> nouv ) {
|
||||
T.insert(nouv);
|
||||
}
|
||||
}
|
||||
|
||||
visu_cells(gv,T);
|
||||
visu_vertices(gv,T);
|
||||
visu_edges(gv,T);
|
||||
|
||||
cout << T.is_valid(true);
|
||||
|
||||
ofstream oFileT("output",ios::out);
|
||||
cout <<" writing file "
|
||||
<< "output" << endl << flush;
|
||||
oFileT << T;
|
||||
|
||||
char ch;
|
||||
cout << "donner caractere de fin" << endl;
|
||||
cin >> ch;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
# This is the makefile for compiling a CGAL application.
|
||||
|
||||
#---------------------------------------------------------------------#
|
||||
# include platform specific settings
|
||||
#---------------------------------------------------------------------#
|
||||
# Choose the right include file from the <cgalroot>/make directory.
|
||||
|
||||
# CGAL_MAKEFILE = ENTER_YOUR_INCLUDE_MAKEFILE_HERE
|
||||
|
||||
#CGAL_MAKEFILE = /0/prisme_util/CGAL/CGAL-last/make/makefile_sparc_SunOS-5.6_g++-2.8.1_LEDA
|
||||
#CGAL_MAKEFILE = /0/prisme_util/CGAL/CGAL-last/make/makefile_sparc_SunOS-5.6_CC-4.2_LEDA
|
||||
#CGAL_MAKEFILE = makefile_cgal_leda361
|
||||
|
||||
include $(CGAL_MAKEFILE)
|
||||
|
||||
# ---------------------------------------------------------------------#
|
||||
# compiler flags
|
||||
#---------------------------------------------------------------------#
|
||||
# rajouter CGAL_LOCAL_CXXFLAGS si on veut les packages de Local
|
||||
CXXFLAGS = -I../../include \
|
||||
-Wall \
|
||||
-DCGAL_TRIANGULATION_SHORT_NAMES_3_H \
|
||||
$(CGAL_CXXFLAGS) \
|
||||
-g #\
|
||||
# -B $(UTIL)/Binutils/SunOS/bin/ #$(GCC_EXEC_PREFIX) #pour eg++
|
||||
#$(CGAL_LOCAL_CXXFLAGS) \
|
||||
#mt -I. -I${OIVHOME}/include #a rajouter pour inventor avec CC
|
||||
|
||||
#libraries used by Inventor
|
||||
xfc_LIBS=-L${OIVHOME}/lib -L${OGLHOME}/lib -lpthread -lInventorXt -lInventor -limage -lGLU -lGL -lXm -lXt -lXext -lX11 -lXi -ldga -lgen -lnsl -lsocket -lm -ldl
|
||||
#---------------------------------------------------------------------#
|
||||
# linker flags
|
||||
#---------------------------------------------------------------------#
|
||||
|
||||
#LDFLAGS = \
|
||||
# $(CGAL_WINDOW_LDFLAGS) -lGeomview -B /u/rigel/0/prisme/spion/BINUTILS/solaris/bin/
|
||||
LDFLAGS = \
|
||||
$(CGAL_LDFLAGS)# -gstabs \
|
||||
#-B $(UTIL)/Binutils/SunOS/bin/
|
||||
|
||||
#---------------------------------------------------------------------#
|
||||
# target entries
|
||||
#---------------------------------------------------------------------#
|
||||
|
||||
all: \
|
||||
essai
|
||||
|
||||
demo: demo.o
|
||||
$(CGAL_CXX) -o demo demo.o $(LDFLAGS)
|
||||
|
||||
essai: essai.o pretty_print.o
|
||||
$(CGAL_CXX) -o essai essai.o pretty_print.o $(LDFLAGS)
|
||||
|
||||
essaiIv: essaiIv.o
|
||||
$(CGAL_CXX) -o essaiIv essaiIv.o $(LDFLAGS) ${xfc_LIBS}
|
||||
|
||||
essai_tds: essai_tds.o pretty_print.o
|
||||
$(CGAL_CXX) -o essai_tds essai_tds.o pretty_print.o $(LDFLAGS)
|
||||
|
||||
clean:
|
||||
/bin/rm -f *.o \
|
||||
essai \
|
||||
essai_tds \
|
||||
core
|
||||
|
||||
essai.o: ../include/CGAL/*.h pretty_print.h
|
||||
|
||||
essai_tds.o: ../include/CGAL/*.h pretty_print.h
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------#
|
||||
# suffix rules
|
||||
#---------------------------------------------------------------------#
|
||||
|
||||
.C.o:
|
||||
$(CGAL_CXX) $(CXXFLAGS) -c $<
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue