mirror of https://github.com/CGAL/cgal
- all interfaces of tds.insertxxx() changed
This commit is contained in:
parent
899790fc95
commit
825fc80a33
|
|
@ -1,4 +1,8 @@
|
|||
Version 1.51 (?? May 01)
|
||||
Version 1.51 (18 May 01)
|
||||
- remove
|
||||
- bug fix in is_edge of tds
|
||||
- all interfaces of tds.insertxxx() changed
|
||||
- tds.clear modified
|
||||
- even more for() scope VC++ bug workarounds.
|
||||
- fix BCC/KCC warning.
|
||||
|
||||
|
|
|
|||
|
|
@ -132,7 +132,9 @@ public:
|
|||
return number_of_vertices() - n;
|
||||
}
|
||||
|
||||
Vertex_handle insert(const Point & p, Cell_handle start = Cell_handle());
|
||||
Vertex_handle insert(const Point & p,
|
||||
Cell_handle start = Cell_handle(),
|
||||
Vertex_handle v = NULL);
|
||||
|
||||
Vertex_handle push_back(const Point & p)
|
||||
{
|
||||
|
|
@ -178,8 +180,6 @@ private:
|
|||
int max2(int i0, int i1, int i2, int i3, int i4, int m) const;
|
||||
int maxless(int i0, int i1, int i2, int i3, int i4, int m) const;
|
||||
|
||||
bool remove_3D_ear(Vertex_handle v );
|
||||
|
||||
void delete_cells(std::list<Cell_handle> & cells, int dummy_for_windows=0);
|
||||
void delete_cells(std::list<Facet> & cells);
|
||||
|
||||
|
|
@ -235,7 +235,7 @@ private:
|
|||
template < class Gt, class Tds >
|
||||
Delaunay_triangulation_3<Gt,Tds>::Vertex_handle
|
||||
Delaunay_triangulation_3<Gt,Tds>::
|
||||
insert(const Point & p, Cell_handle start)
|
||||
insert(const Point & p, Cell_handle start, Vertex_handle v)
|
||||
{
|
||||
switch (dimension()) {
|
||||
case 3:
|
||||
|
|
@ -249,10 +249,10 @@ insert(const Point & p, Cell_handle start)
|
|||
// case CELL:
|
||||
// case FACET:
|
||||
// case EDGE:
|
||||
Vertex_handle v = new Vertex(p);
|
||||
set_number_of_vertices(number_of_vertices()+1);
|
||||
Conflict_tester_3 tester(p, this);
|
||||
_tds.insert_conflict((*v), &(*c), tester);
|
||||
v = (Vertex *) _tds.insert_conflict(&(*v), &(*c), tester);
|
||||
v->set_point(p);
|
||||
return v;
|
||||
}// dim 3
|
||||
case 2:
|
||||
|
|
@ -266,10 +266,10 @@ insert(const Point & p, Cell_handle start)
|
|||
case FACET:
|
||||
case EDGE:
|
||||
{
|
||||
Vertex_handle v = new Vertex(p);
|
||||
set_number_of_vertices(number_of_vertices()+1);
|
||||
Conflict_tester_2 tester(p, this);
|
||||
_tds.insert_conflict((*v), &(*c), tester);
|
||||
v = (Vertex *) _tds.insert_conflict(&(*v), &(*c), tester);
|
||||
v->set_point(p);
|
||||
return v;
|
||||
}
|
||||
case VERTEX:
|
||||
|
|
@ -277,12 +277,12 @@ insert(const Point & p, Cell_handle start)
|
|||
case OUTSIDE_AFFINE_HULL:
|
||||
// if the 2d triangulation is Delaunay, the 3d
|
||||
// triangulation will be Delaunay
|
||||
return Triangulation_3<Gt,Tds>::insert_outside_affine_hull(p);
|
||||
return Triangulation_3<Gt,Tds>::insert_outside_affine_hull(p,v);
|
||||
}
|
||||
}//dim 2
|
||||
default :
|
||||
// dimension <= 1
|
||||
return Triangulation_3<Gt,Tds>::insert(p,start);
|
||||
return Triangulation_3<Gt,Tds>::insert(p,start,v);
|
||||
}
|
||||
}// insert(p)
|
||||
|
||||
|
|
@ -295,26 +295,47 @@ remove(Vertex_handle v)
|
|||
CGAL_triangulation_precondition( !is_infinite(v));
|
||||
CGAL_triangulation_expensive_precondition( _tds.is_vertex(&(*v)) );
|
||||
|
||||
if ( dimension() <3 ) {
|
||||
// to be implemented : removal in degenerate dimensions
|
||||
// the triangulation is now rebuilt...
|
||||
if ( dimension() <3 || test_dim_down(v) ) {
|
||||
// the triangulation is rebuilt...
|
||||
|
||||
Vertex_iterator vit, vdone = vertices_end();
|
||||
std::list<Point> points;
|
||||
for ( vit = finite_vertices_begin(); vit != vdone ; ++vit)
|
||||
if ( v != (*vit).handle() )
|
||||
points.push_front( vit->point() );
|
||||
Vertex_handle inf = infinite_vertex();
|
||||
|
||||
typename std::list<Point>::iterator pit, pdone = points.end();
|
||||
|
||||
clear();
|
||||
for ( pit = points.begin(); pit != pdone; ++pit)
|
||||
insert( *pit );
|
||||
std::vector< typename Tds::Vertex * > Vertices =
|
||||
_tds.clear_cells_only();
|
||||
|
||||
_tds.set_number_of_vertices(0);
|
||||
_tds.set_dimension(-2);
|
||||
_tds.insert_increase_dimension( &(*inf) );
|
||||
CGAL_triangulation_assertion( inf == infinite_vertex() );
|
||||
|
||||
typename std::vector< typename Tds::Vertex * >::iterator vit;
|
||||
|
||||
for ( vit = Vertices.begin(); vit != Vertices.end(); ++vit )
|
||||
if ( *vit != &(*inf) && *vit != &(*v) )
|
||||
insert( (*vit)->point(), NULL, (Vertex *) *vit );
|
||||
|
||||
delete(&(*v));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return remove_3D_ear(v);
|
||||
CGAL_triangulation_assertion( dimension() == 3 );
|
||||
|
||||
std::list<Facet> boundary; // facets on the boundary of the hole
|
||||
|
||||
std::list<Cell_handle> hole;
|
||||
make_hole_3D_ear(v, boundary,hole);
|
||||
|
||||
bool filled = fill_hole_3D_ear(boundary);
|
||||
if(filled){
|
||||
delete( &(*v) );
|
||||
delete_cells(hole);
|
||||
set_number_of_vertices(number_of_vertices()-1);
|
||||
} else {
|
||||
undo_make_hole_3D_ear(boundary, hole);
|
||||
}
|
||||
|
||||
return filled;
|
||||
}
|
||||
|
||||
template < class Gt, class Tds >
|
||||
|
|
@ -810,59 +831,6 @@ is_valid(Cell_handle c, bool verbose, int level) const
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
template < class Gt, class Tds >
|
||||
bool
|
||||
Delaunay_triangulation_3<Gt,Tds>::
|
||||
remove_3D_ear(Vertex_handle v)
|
||||
{
|
||||
CGAL_triangulation_precondition( dimension() == 3 );
|
||||
|
||||
std::list<Facet> boundary; // facets on the boundary of the hole
|
||||
|
||||
if ( test_dim_down(v) ) {
|
||||
|
||||
// _tds.remove_dim_down(&(*v)); return;
|
||||
// !!!!!!!!!!!! TO BE DONE !!!!!!!!!!!!!
|
||||
// the triangulation is rebuilt...
|
||||
|
||||
Vertex_iterator vit;
|
||||
Vertex_iterator vdone = vertices_end();
|
||||
std::list<Point> points;
|
||||
for ( vit = finite_vertices_begin(); vit != vdone ; ++vit) {
|
||||
if ( v != (*vit).handle() ) { points.push_front( vit->point() ); }
|
||||
}
|
||||
typename std::list<Point>::iterator pit;
|
||||
typename std::list<Point>::iterator pdone = points.end();
|
||||
|
||||
clear();
|
||||
for ( pit = points.begin(); pit != pdone; ++pit) {
|
||||
insert( *pit );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
std::list<Cell_handle> hole;
|
||||
make_hole_3D_ear(v, boundary,
|
||||
hole);
|
||||
|
||||
|
||||
// std::cout << "fill" << std::endl;
|
||||
bool filled = fill_hole_3D_ear(boundary);
|
||||
if(filled){
|
||||
delete( &(*v) );
|
||||
delete_cells(hole);
|
||||
set_number_of_vertices(number_of_vertices()-1);
|
||||
} else {
|
||||
undo_make_hole_3D_ear(boundary, hole);
|
||||
}
|
||||
|
||||
return filled;
|
||||
|
||||
}// remove_3D_ear(v)
|
||||
|
||||
|
||||
|
||||
template < class Gt, class Tds >
|
||||
void
|
||||
Delaunay_triangulation_3<Gt,Tds>::
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ protected:
|
|||
|
||||
void init_tds()
|
||||
{
|
||||
infinite = (Vertex*) _tds.insert_increase_dimension(Vertex());
|
||||
infinite = (Vertex*) _tds.insert_increase_dimension(NULL);
|
||||
// this causes a problem of accessing non initialized data
|
||||
// (seen by purify) in _tds.insert_increase_dimension
|
||||
// when doing Vertex* w = new Vertex(v)
|
||||
|
|
@ -177,21 +177,6 @@ protected:
|
|||
construct_tetrahedron_3 = geom_traits().construct_tetrahedron_3_object();
|
||||
}
|
||||
|
||||
// debug
|
||||
Triangulation_3(const Point & p0,
|
||||
const Point & p1,
|
||||
const Point & p2,
|
||||
const Point & p3)
|
||||
: _tds(), _gt()
|
||||
{
|
||||
init_tds();
|
||||
init_function_objects();
|
||||
insert_increase_dimension(p0);
|
||||
insert_increase_dimension(p1);
|
||||
insert_increase_dimension(p2);
|
||||
insert_increase_dimension(p3);
|
||||
}
|
||||
|
||||
bool test_dim_down(Vertex_handle v);
|
||||
|
||||
public:
|
||||
|
|
@ -551,7 +536,9 @@ public:
|
|||
|
||||
//INSERTION
|
||||
|
||||
Vertex_handle insert(const Point & p, Cell_handle start = Cell_handle() );
|
||||
Vertex_handle insert(const Point & p,
|
||||
Cell_handle start = Cell_handle(),
|
||||
Vertex_handle v = NULL);
|
||||
|
||||
Vertex_handle push_back(const Point & p)
|
||||
{
|
||||
|
|
@ -570,28 +557,33 @@ public:
|
|||
}
|
||||
|
||||
Vertex_handle
|
||||
insert_in_cell(const Point & p, Cell_handle c);
|
||||
insert_in_cell(const Point & p, Cell_handle c, Vertex_handle v = NULL);
|
||||
|
||||
Vertex_handle
|
||||
insert_in_facet(const Point & p, Cell_handle c, int i);
|
||||
insert_in_facet(const Point & p, Cell_handle c, int i,
|
||||
Vertex_handle v = NULL);
|
||||
|
||||
Vertex_handle
|
||||
insert_in_facet(const Point & p, const Facet & f)
|
||||
insert_in_facet(const Point & p, const Facet & f,
|
||||
Vertex_handle v = NULL)
|
||||
{
|
||||
return insert_in_facet(p, f.first,f.second);
|
||||
return insert_in_facet(p, f.first,f.second, v);
|
||||
}
|
||||
|
||||
Vertex_handle
|
||||
insert_in_edge(const Point & p, Cell_handle c, int i, int j);
|
||||
insert_in_edge(const Point & p, Cell_handle c, int i, int j,
|
||||
Vertex_handle v = NULL);
|
||||
|
||||
Vertex_handle
|
||||
insert_in_edge(const Point & p, const Edge & e)
|
||||
insert_in_edge(const Point & p, const Edge & e,
|
||||
Vertex_handle v = NULL)
|
||||
{
|
||||
return insert_in_edge(p, e.first,e.second,e.third);
|
||||
return insert_in_edge(p, e.first,e.second,e.third, v);
|
||||
}
|
||||
|
||||
Vertex_handle
|
||||
insert_outside_convex_hull(const Point & p, Cell_handle c);
|
||||
insert_outside_convex_hull(const Point & p, Cell_handle c,
|
||||
Vertex_handle v = NULL);
|
||||
// int li, int lj=0)
|
||||
// c is an infinite cell containing p
|
||||
// whose facet li lies on the convex hull boundary
|
||||
|
|
@ -601,6 +593,9 @@ public:
|
|||
// in dimension 1, vertex li separates p from the triangulation
|
||||
// dimension 0 not allowed, use outside-affine-hull
|
||||
|
||||
Vertex_handle
|
||||
insert_outside_affine_hull(const Point & p, Vertex_handle v = NULL );
|
||||
|
||||
private:
|
||||
// Here are the conflit tester function object passed to
|
||||
// _tds.insert_conflict() by insert_outside_convex_hull().
|
||||
|
|
@ -644,9 +639,6 @@ private:
|
|||
|
||||
public:
|
||||
|
||||
Vertex_handle
|
||||
insert_outside_affine_hull(const Point & p);
|
||||
|
||||
//TRAVERSING : ITERATORS AND CIRCULATORS
|
||||
Cell_iterator finite_cells_begin() const
|
||||
{
|
||||
|
|
@ -2576,7 +2568,7 @@ flip_flippable( Cell_handle c, int i, int j )
|
|||
template < class GT, class Tds >
|
||||
Triangulation_3<GT,Tds>::Vertex_handle
|
||||
Triangulation_3<GT,Tds>::
|
||||
insert(const Point & p, Cell_handle start)
|
||||
insert(const Point & p, Cell_handle start, Vertex_handle v)
|
||||
{
|
||||
Locate_type lt;
|
||||
int li, lj;
|
||||
|
|
@ -2585,24 +2577,23 @@ insert(const Point & p, Cell_handle start)
|
|||
case VERTEX:
|
||||
return c->vertex(li);
|
||||
case EDGE:
|
||||
return insert_in_edge(p, c, li, lj);
|
||||
return insert_in_edge(p, c, li, lj, v);
|
||||
case FACET:
|
||||
return insert_in_facet(p, c, li);
|
||||
return insert_in_facet(p, c, li, v);
|
||||
case CELL:
|
||||
return insert_in_cell(p, c);
|
||||
return insert_in_cell(p, c, v);
|
||||
case OUTSIDE_CONVEX_HULL:
|
||||
return insert_outside_convex_hull(p, c);
|
||||
return insert_outside_convex_hull(p, c, v);
|
||||
case OUTSIDE_AFFINE_HULL:
|
||||
return insert_outside_affine_hull(p);
|
||||
default:
|
||||
return insert_outside_affine_hull(p, v);
|
||||
}
|
||||
// cannot happen, only to avoid warning with eg++
|
||||
return insert_in_edge(p, c, li, lj);
|
||||
}
|
||||
|
||||
template < class GT, class Tds >
|
||||
Triangulation_3<GT,Tds>::Vertex_handle
|
||||
Triangulation_3<GT,Tds>::
|
||||
insert_in_cell(const Point & p, Cell_handle c)
|
||||
insert_in_cell(const Point & p, Cell_handle c, Vertex_handle v)
|
||||
{
|
||||
CGAL_triangulation_precondition( dimension() == 3 );
|
||||
CGAL_triangulation_precondition_code
|
||||
|
|
@ -2616,14 +2607,16 @@ insert_in_cell(const Point & p, Cell_handle c)
|
|||
c->vertex(3)->point(),
|
||||
lt,i,j ) == ON_BOUNDED_SIDE );
|
||||
|
||||
return (Vertex*)_tds.insert_in_cell( Vertex(p), &(*c) );
|
||||
v = (Vertex*)_tds.insert_in_cell( &(*v), &(*c) );
|
||||
v->set_point(p);
|
||||
return v;
|
||||
}
|
||||
|
||||
template < class GT, class Tds >
|
||||
inline
|
||||
Triangulation_3<GT,Tds>::Vertex_handle
|
||||
Triangulation_3<GT,Tds>::
|
||||
insert_in_facet(const Point & p, Cell_handle c, int i)
|
||||
insert_in_facet(const Point & p, Cell_handle c, int i, Vertex_handle v)
|
||||
{
|
||||
CGAL_triangulation_precondition( dimension() == 2 || dimension() == 3);
|
||||
CGAL_triangulation_precondition( (dimension() == 2 && i == 3)
|
||||
|
|
@ -2643,13 +2636,15 @@ insert_in_facet(const Point & p, Cell_handle c, int i)
|
|||
c->vertex((i+3)&3)->point(),
|
||||
lt, li, lj) == ON_BOUNDED_SIDE );
|
||||
|
||||
return (Vertex*) _tds.insert_in_facet( Vertex(p), &(*c), i);
|
||||
v = (Vertex*) _tds.insert_in_facet( &(*v), &(*c), i);
|
||||
v->set_point(p);
|
||||
return v;
|
||||
}
|
||||
|
||||
template < class GT, class Tds >
|
||||
Triangulation_3<GT,Tds>::Vertex_handle
|
||||
Triangulation_3<GT,Tds>::
|
||||
insert_in_edge(const Point & p, Cell_handle c, int i, int j)
|
||||
insert_in_edge(const Point & p, Cell_handle c, int i, int j, Vertex_handle v)
|
||||
{
|
||||
CGAL_triangulation_precondition( i != j );
|
||||
CGAL_triangulation_precondition( dimension() >= 1 && dimension() <= 3 );
|
||||
|
|
@ -2682,13 +2677,15 @@ insert_in_edge(const Point & p, Cell_handle c, int i, int j)
|
|||
}
|
||||
}
|
||||
|
||||
return (Vertex*) _tds.insert_in_edge( Vertex(p), &(*c), i, j);
|
||||
v = (Vertex*) _tds.insert_in_edge( &(*v), &(*c), i, j);
|
||||
v->set_point(p);
|
||||
return v;
|
||||
}
|
||||
|
||||
template < class GT, class Tds >
|
||||
Triangulation_3<GT,Tds>::Vertex_handle
|
||||
Triangulation_3<GT,Tds>::
|
||||
insert_outside_convex_hull(const Point & p, Cell_handle c)
|
||||
insert_outside_convex_hull(const Point & p, Cell_handle c, Vertex_handle v)
|
||||
// int li, int lj=0)
|
||||
// c is an infinite cell containing p
|
||||
// whose facet li lies on the convex hull boundary
|
||||
|
|
@ -2708,39 +2705,35 @@ insert_outside_convex_hull(const Point & p, Cell_handle c)
|
|||
// // p lies in the infinite edge neighboring c
|
||||
// // on the other side of li
|
||||
// return insert_in_edge(p,c->neighbor(1-li),0,1);
|
||||
return insert_in_edge(p,c,0,1);
|
||||
return insert_in_edge(p,c,0,1,v);
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
Vertex_handle v = new Vertex(p);
|
||||
v->set_cell( c );
|
||||
set_number_of_vertices(number_of_vertices()+1);
|
||||
|
||||
Conflict_tester_outside_convex_hull_2 tester(p, this);
|
||||
_tds.insert_conflict(*v, &(*c), tester);
|
||||
|
||||
Vertex_handle v = (Vertex *) _tds.insert_conflict(NULL, &(*c), tester);
|
||||
v->set_point(p);
|
||||
|
||||
return v;
|
||||
}
|
||||
case 3:
|
||||
default:
|
||||
{
|
||||
Vertex_handle v = new Vertex(p);
|
||||
v->set_cell( c );
|
||||
set_number_of_vertices(number_of_vertices()+1);
|
||||
|
||||
Conflict_tester_outside_convex_hull_3 tester(p, this);
|
||||
_tds.insert_conflict(*v, &(*c), tester);
|
||||
|
||||
Vertex_handle v = (Vertex *) _tds.insert_conflict(NULL, &(*c), tester);
|
||||
v->set_point(p);
|
||||
return v;
|
||||
}
|
||||
}
|
||||
// to avoid warning with eg++
|
||||
return NULL;
|
||||
}
|
||||
|
||||
template < class GT, class Tds >
|
||||
Triangulation_3<GT,Tds>::Vertex_handle
|
||||
Triangulation_3<GT,Tds>::
|
||||
insert_outside_affine_hull(const Point & p)
|
||||
insert_outside_affine_hull(const Point & p, Vertex_handle v)
|
||||
{
|
||||
CGAL_triangulation_precondition( dimension() < 3 );
|
||||
bool reorient;
|
||||
|
|
@ -2774,9 +2767,11 @@ insert_outside_affine_hull(const Point & p)
|
|||
reorient = false;
|
||||
}
|
||||
|
||||
return (Vertex*) _tds.insert_increase_dimension( Vertex(p),
|
||||
&(*infinite_vertex()),
|
||||
reorient);
|
||||
v = (Vertex*) _tds.insert_increase_dimension( &(*v),
|
||||
&(*infinite_vertex()),
|
||||
reorient);
|
||||
v->set_point(p);
|
||||
return v;
|
||||
}
|
||||
|
||||
template < class GT, class Tds >
|
||||
|
|
|
|||
|
|
@ -102,11 +102,11 @@ public:
|
|||
: _dimension(-2), _number_of_vertices(0)
|
||||
{}
|
||||
|
||||
Triangulation_data_structure_3(const Vertex & v)
|
||||
: _dimension(-2), _number_of_vertices(0)
|
||||
{
|
||||
insert_increase_dimension(v);
|
||||
}
|
||||
// Triangulation_data_structure_3(const Vertex & v)
|
||||
// : _dimension(-2), _number_of_vertices(0)
|
||||
// {
|
||||
// insert_increase_dimension(v);
|
||||
// }
|
||||
|
||||
Triangulation_data_structure_3(const Tds & tds)
|
||||
: _number_of_vertices(0)
|
||||
|
|
@ -346,21 +346,21 @@ public:
|
|||
|
||||
//INSERTION
|
||||
|
||||
Vertex * insert_in_cell(const Vertex & w, Cell* c);
|
||||
Vertex * insert_in_cell(Vertex * v, Cell* c);
|
||||
|
||||
Vertex * insert_in_facet(const Vertex & w, const Facet & f)
|
||||
Vertex * insert_in_facet(Vertex * v, const Facet & f)
|
||||
{ return insert_in_facet(w,f.first,f.second); }
|
||||
|
||||
Vertex * insert_in_facet(const Vertex & w, Cell* c, int i);
|
||||
Vertex * insert_in_facet(Vertex * v, Cell* c, int i);
|
||||
// inserts v in the facet opposite to vertex i of cell c
|
||||
|
||||
Vertex * insert_in_edge(const Vertex & w, const Edge & e)
|
||||
Vertex * insert_in_edge(Vertex * v, const Edge & e)
|
||||
{ return insert_in_edge(w, e.first, e.second, e.third); }
|
||||
|
||||
Vertex * insert_in_edge(const Vertex & w, Cell* c, int i, int j);
|
||||
Vertex * insert_in_edge(Vertex * v, Cell* c, int i, int j);
|
||||
// inserts v in the edge of cell c with vertices i and j
|
||||
|
||||
Vertex * insert_increase_dimension(const Vertex & w, // new vertex
|
||||
Vertex * insert_increase_dimension(Vertex * v, // new vertex
|
||||
Vertex* star = NULL,
|
||||
bool reorient = false);
|
||||
// star = vertex from which we triangulate the facet of the
|
||||
|
|
@ -374,10 +374,13 @@ public:
|
|||
// conflict, then inserts by starring.
|
||||
// Maybe we need _2 and _3 versions ?
|
||||
template < class Conflict_test >
|
||||
void insert_conflict(Vertex & w, Cell *c, const Conflict_test &tester)
|
||||
Vertex * insert_conflict( Vertex * w, Cell *c, const Conflict_test &tester)
|
||||
{
|
||||
CGAL_triangulation_precondition( tester(c) );
|
||||
|
||||
if ( w == NULL )
|
||||
w = new Vertex();
|
||||
|
||||
if (dimension() == 3)
|
||||
{
|
||||
// Find the cells in conflict.
|
||||
|
|
@ -386,8 +389,8 @@ public:
|
|||
find_conflicts_3(c, ccc, i, tester);
|
||||
|
||||
// Create the new cells, and returns one of them.
|
||||
Cell * nouv = create_star2_3( &w, ccc, i );
|
||||
w.set_cell( nouv );
|
||||
Cell * nouv = create_star2_3( w, ccc, i );
|
||||
w->set_cell( nouv );
|
||||
|
||||
move_temporary_free_cells_to_free_list();
|
||||
}
|
||||
|
|
@ -399,11 +402,13 @@ public:
|
|||
find_conflicts_2(c, ccc, i, tester);
|
||||
|
||||
// Create the new cells, and returns one of them.
|
||||
Cell * nouv = create_star2_2( &w, ccc, i );
|
||||
w.set_cell( nouv );
|
||||
Cell * nouv = create_star2_2( w, ccc, i );
|
||||
w->set_cell( nouv );
|
||||
|
||||
move_temporary_free_cells_to_free_list();
|
||||
}
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
@ -597,6 +602,8 @@ public:
|
|||
|
||||
void clear();
|
||||
|
||||
std::vector<Vertex *> clear_cells_only();
|
||||
|
||||
private:
|
||||
// in dimension i, number of vertices >= i+2
|
||||
// ( the boundary of a simplex in dimension i+1 has i+2 vertices )
|
||||
|
|
@ -1570,13 +1577,14 @@ print_cells(std::ostream& os,
|
|||
template <class Vb, class Cb >
|
||||
Triangulation_data_structure_3<Vb,Cb>::Vertex*
|
||||
Triangulation_data_structure_3<Vb,Cb>::
|
||||
insert_in_cell(const Vertex & w, Cell* c)
|
||||
insert_in_cell( Vertex * v, Cell* c )
|
||||
{ //insert in cell
|
||||
CGAL_triangulation_precondition( dimension() == 3 );
|
||||
CGAL_triangulation_precondition( (c != NULL) );
|
||||
CGAL_triangulation_expensive_precondition( is_cell(c) );
|
||||
|
||||
Vertex * v = new Vertex(w);
|
||||
if ( v == NULL )
|
||||
v = new Vertex();
|
||||
|
||||
// c->insert_in_cell(v);
|
||||
|
||||
|
|
@ -1618,13 +1626,14 @@ insert_in_cell(const Vertex & w, Cell* c)
|
|||
template <class Vb, class Cb >
|
||||
Triangulation_data_structure_3<Vb,Cb>::Vertex*
|
||||
Triangulation_data_structure_3<Vb,Cb>::
|
||||
insert_in_facet(const Vertex & w, Cell* c, int i)
|
||||
insert_in_facet(Vertex * v, Cell* c, int i)
|
||||
{ // inserts v in the facet opposite to vertex i of cell c
|
||||
|
||||
CGAL_triangulation_precondition( (c != NULL));
|
||||
CGAL_triangulation_precondition( dimension() >= 2 );
|
||||
|
||||
Vertex * v = new Vertex(w);
|
||||
if ( v == NULL )
|
||||
v = new Vertex();
|
||||
|
||||
switch ( dimension() ) {
|
||||
|
||||
|
|
@ -1734,13 +1743,14 @@ insert_in_facet(const Vertex & w, Cell* c, int i)
|
|||
template <class Vb, class Cb >
|
||||
Triangulation_data_structure_3<Vb,Cb>::Vertex*
|
||||
Triangulation_data_structure_3<Vb,Cb>::
|
||||
insert_in_edge(const Vertex & w, Cell* c, int i, int j)
|
||||
insert_in_edge(Vertex * v, Cell* c, int i, int j)
|
||||
{ // inserts v in the edge of cell c with vertices i and j
|
||||
CGAL_triangulation_precondition( c != NULL );
|
||||
CGAL_triangulation_precondition( i != j );
|
||||
CGAL_triangulation_precondition( dimension() >= 1 );
|
||||
|
||||
Vertex * v = new Vertex(w);
|
||||
if ( v == NULL )
|
||||
v = new Vertex();
|
||||
|
||||
Cell* cnew;
|
||||
Cell* dnew;
|
||||
|
|
@ -1875,7 +1885,7 @@ insert_in_edge(const Vertex & w, Cell* c, int i, int j)
|
|||
template <class Vb, class Cb >
|
||||
Triangulation_data_structure_3<Vb,Cb>::Vertex*
|
||||
Triangulation_data_structure_3<Vb,Cb>::
|
||||
insert_increase_dimension(const Vertex & w, // new vertex
|
||||
insert_increase_dimension(Vertex * v, // new vertex
|
||||
Vertex* star,
|
||||
bool reorient)
|
||||
// star = vertex from which we triangulate the facet of the
|
||||
|
|
@ -1885,7 +1895,8 @@ insert_increase_dimension(const Vertex & w, // new vertex
|
|||
// changes the dimension
|
||||
// if (reorient) the orientation of the cells is modified
|
||||
{ // insert()
|
||||
Vertex * v = new Vertex(w);
|
||||
if ( v == NULL )
|
||||
v = new Vertex();
|
||||
|
||||
Cell* c;
|
||||
Cell* d;
|
||||
|
|
@ -2593,9 +2604,9 @@ swap(Tds & tds)
|
|||
}
|
||||
|
||||
template <class Vb, class Cb >
|
||||
void
|
||||
std::vector< Triangulation_data_structure_3<Vb,Cb>::Vertex * >
|
||||
Triangulation_data_structure_3<Vb,Cb>::
|
||||
clear()
|
||||
clear_cells_only()
|
||||
{
|
||||
CGAL_triangulation_assertion(_list_of_temporary_free_cells._next_cell
|
||||
== &_list_of_temporary_free_cells);
|
||||
|
|
@ -2617,7 +2628,7 @@ clear()
|
|||
|
||||
// then _list_of_cells points on itself, nothing more to do
|
||||
set_dimension(-2);
|
||||
return;
|
||||
return std::vector<Vertex *>();
|
||||
}
|
||||
|
||||
// We must save all vertices because we're going to delete the cells.
|
||||
|
|
@ -2631,7 +2642,7 @@ clear()
|
|||
{
|
||||
// We save the vertices to delete them after.
|
||||
// We use the same trick as the Vertex_iterator.
|
||||
for (int i=0; i<=dimension(); i++)
|
||||
for (int i=0; i<=std::max(0,dimension()); i++)
|
||||
if (it->vertex(i)->cell() == it)
|
||||
Vertices.push_back(&(*it->vertex(i)));
|
||||
delete it; // The ds_cell destructor removes it from the list.
|
||||
|
|
@ -2641,6 +2652,16 @@ clear()
|
|||
CGAL_triangulation_assertion(_list_of_cells._next_cell == &_list_of_cells);
|
||||
CGAL_triangulation_assertion(_list_of_cells._previous_cell==&_list_of_cells);
|
||||
|
||||
return Vertices;
|
||||
}
|
||||
|
||||
template <class Vb, class Cb >
|
||||
void
|
||||
Triangulation_data_structure_3<Vb,Cb>::
|
||||
clear()
|
||||
{
|
||||
std::vector<Vertex*> Vertices = clear_cells_only();
|
||||
|
||||
// deletion of the vertices
|
||||
for (typename std::vector<Vertex*>::iterator vit = Vertices.begin();
|
||||
vit != Vertices.end(); ++vit)
|
||||
|
|
@ -2648,6 +2669,7 @@ clear()
|
|||
|
||||
set_number_of_vertices(0);
|
||||
set_dimension(-2);
|
||||
|
||||
}
|
||||
|
||||
template <class Vb, class Cb >
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ include $(CGAL_MAKEFILE)
|
|||
#---------------------------------------------------------------------#
|
||||
|
||||
# pour purify :
|
||||
#CGAL_CXX=purify /usr/local/egcs/bin/g++
|
||||
#CGAL_CXX=purify -best-effort /usr/local/gcc/bin/g++
|
||||
|
||||
CXXFLAGS = \
|
||||
-I../../include \
|
||||
|
|
@ -39,7 +39,7 @@ CXXFLAGS = \
|
|||
|
||||
# pour purify :
|
||||
#CGAL_LDFLAGS= $(CGAL_LIB_DIR)/$(CGAL_OS_COMPILER)/libCGAL.a \
|
||||
# -L$(GMP_LIB_DIR) -lgmp -lm
|
||||
# -L$(GMP_LIB_DIR) -lgmp -lm
|
||||
|
||||
LDFLAGS = $(TESTSUITE_LDFLAGS) \
|
||||
$(CGAL_LDFLAGS)
|
||||
|
|
|
|||
|
|
@ -433,12 +433,9 @@ _test_cls_delaunay_3(const Triangulation &)
|
|||
}
|
||||
int n = Tdel.number_of_vertices();
|
||||
for(int i = 0; i < n; i++) {
|
||||
if ( Tdel.dimension() == 3) {
|
||||
assert(Tdel.remove(Vertex_handle(vertices[i])));
|
||||
}
|
||||
assert(Tdel.remove(Vertex_handle(vertices[i])));
|
||||
}
|
||||
assert(Tdel.is_valid(false));
|
||||
assert(Tdel.dimension()<3);
|
||||
std::cout << " successfull" << std::endl;
|
||||
}
|
||||
|
||||
|
|
@ -524,7 +521,7 @@ _test_cls_delaunay_3(const Triangulation &)
|
|||
|
||||
// %%%%%%%%%% deletion in Delaunay
|
||||
if (del) {
|
||||
std::cout << " deletion in a 10points Delaunay triangulation";
|
||||
std::cout << " deletion in a 10 points Delaunay triangulation";
|
||||
Vertex_handle v;
|
||||
while ( T3_5.number_of_vertices() >= 1 ) {
|
||||
if ( T3_5.dimension() > 1 )
|
||||
|
|
|
|||
|
|
@ -74,30 +74,30 @@ std::ifstream iFileT("Test_tds_IO_3",std::ios::in);
|
|||
|
||||
|
||||
Vertex_iterator vit;
|
||||
Vertex v1;
|
||||
Vertex * v1 = new Vertex();
|
||||
tds2.insert_increase_dimension(v1, NULL);
|
||||
Tds tds3(tds2);
|
||||
Vertex v2;
|
||||
Vertex * v2 = new Vertex();
|
||||
|
||||
vit=tds3.vertices_begin();
|
||||
tds3.insert_increase_dimension(v2,&*vit);
|
||||
std::cout << "ok" << std::endl;
|
||||
Tds tds4 = tds3;
|
||||
Vertex v3;
|
||||
Vertex * v3 = new Vertex();
|
||||
vit=tds4.vertices_begin();
|
||||
tds4.insert_increase_dimension(v3,&*vit);
|
||||
std::cout << "ok" << std::endl;
|
||||
Tds tds5;
|
||||
tds5.swap(tds4);
|
||||
tds4=tds5;
|
||||
Vertex v4;
|
||||
Vertex * v4 = new Vertex();
|
||||
vit=tds5.vertices_begin();
|
||||
tds5.insert_increase_dimension(v4,&*vit);
|
||||
std::cout << "ok" << std::endl;
|
||||
Tds tds6;
|
||||
tds6.swap(tds5);
|
||||
tds5=tds6;
|
||||
Vertex v5;
|
||||
Vertex * v5 = new Vertex();
|
||||
vit=tds6.vertices_begin();
|
||||
tds6.insert_increase_dimension(v5,&*vit);
|
||||
std::cout << "ok" << std::endl;
|
||||
|
|
@ -105,8 +105,6 @@ std::ifstream iFileT("Test_tds_IO_3",std::ios::in);
|
|||
// Setting functions
|
||||
std::cout << " setting functions" << std::endl;
|
||||
tds1.set_number_of_vertices(1);
|
||||
tds2.set_number_of_vertices(5);
|
||||
|
||||
|
||||
std::cout << " Insert are tested in test_triangulation_3 " << std::endl;
|
||||
|
||||
|
|
@ -122,7 +120,6 @@ std::ifstream iFileT("Test_tds_IO_3",std::ios::in);
|
|||
assert(tds6.dimension()==3);
|
||||
|
||||
assert(tds3.number_of_vertices()==2);
|
||||
assert(tds2.number_of_vertices()==5);
|
||||
assert(tds1.number_of_vertices()==1);
|
||||
|
||||
std::cout << " Test flip " << std::endl;
|
||||
|
|
@ -130,13 +127,13 @@ std::ifstream iFileT("Test_tds_IO_3",std::ios::in);
|
|||
Cell_iterator cit, cdone;
|
||||
int nbflips=0;
|
||||
int i;
|
||||
Vertex v6;
|
||||
Vertex * v6 = new Vertex();
|
||||
cit = tds6.cells_begin();
|
||||
tds6.insert_in_cell(v6, &(*cit));
|
||||
Vertex v7;
|
||||
Vertex * v7 = new Vertex();
|
||||
cit = tds6.cells_begin();
|
||||
tds6.insert_in_cell(v7, &(*cit));
|
||||
Vertex v8;
|
||||
Vertex * v8 = new Vertex();
|
||||
cit = tds6.cells_begin();
|
||||
tds6.insert_in_cell(v8, &(*cit));
|
||||
assert(tds6.number_of_vertices()==8);
|
||||
|
|
@ -200,7 +197,17 @@ std::ifstream iFileT("Test_tds_IO_3",std::ios::in);
|
|||
|
||||
// test destructor and return
|
||||
std::cout << " test destructors and return" << std::endl;
|
||||
tds1.clear();
|
||||
tds2.clear();
|
||||
tds3.clear();
|
||||
|
||||
assert(tds1.is_valid());
|
||||
assert(tds2.is_valid());
|
||||
assert(tdsfromfile.is_valid());
|
||||
assert(tds3.is_valid());
|
||||
assert(tds4.is_valid());
|
||||
assert(tds5.is_valid());
|
||||
assert(tds6.is_valid());
|
||||
|
||||
// tds1.clear();
|
||||
// tds2.clear();
|
||||
// tds3.clear();
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue