mirror of https://github.com/CGAL/cgal
merged midification for new design into main trunc
This commit is contained in:
parent
243a0371c1
commit
92f9eed65e
|
|
@ -1,8 +1,9 @@
|
|||
- check the behavior of regular triangulations on
|
||||
degenerate cases
|
||||
- change the return of get_conflicts and find_conflict to
|
||||
an output iterator ?
|
||||
- doc de le triangulation reguliere a mettre a jour
|
||||
Julia a signale un bug sur le return des fonctions insert et remove
|
||||
- test de la regular hierarchy
|
||||
- input output of regular triangulation
|
||||
(may be outputing for each face the hidden points
|
||||
in the output operator for faces)
|
||||
|
|
|
|||
|
|
@ -4,22 +4,42 @@
|
|||
#include <CGAL/Triangulation_2.h>
|
||||
|
||||
/* A facet with a color member variable. */
|
||||
template < class Gt >
|
||||
class My_face_base : public CGAL::Triangulation_face_base_2<Gt>
|
||||
template < class Fb = CGAL::Triangulation_ds_face_base_2<> >
|
||||
class My_face_base
|
||||
: public Fb
|
||||
{
|
||||
typedef Fb Base;
|
||||
typedef typename Fb::Triangulation_data_structure TDS;
|
||||
public:
|
||||
typedef TDS Triangulation_data_structure;
|
||||
typedef typename TDS::Vertex_handle Vertex_handle;
|
||||
typedef typename TDS::Face_handle Face_handle;
|
||||
|
||||
template < typename TDS2 >
|
||||
struct Rebind_TDS {
|
||||
typedef typename Fb::template Rebind_TDS<TDS2>::Other Fb2;
|
||||
typedef My_face_base<Fb2> Other;
|
||||
};
|
||||
|
||||
CGAL::Color color;
|
||||
My_face_base() :
|
||||
CGAL::Triangulation_face_base_2<Gt>() {}
|
||||
My_face_base(void* v0, void* v1, void* v2) :
|
||||
CGAL::Triangulation_face_base_2<Gt>(v0,v1,v2) {}
|
||||
My_face_base(void* v0, void* v1, void* v2, void* n0, void* n1, void* n2) :
|
||||
CGAL::Triangulation_face_base_2<Gt>(v0,v1,v2,n0,n1,n2) {}
|
||||
|
||||
My_face_base() : Base() {}
|
||||
|
||||
My_face_base(Vertex_handle v0,
|
||||
Vertex_handle v1,
|
||||
Vertex_handle v2) : Base(v0,v1,v2) {}
|
||||
|
||||
My_face_base(Vertex_handle v0,
|
||||
Vertex_handle v1,
|
||||
Vertex_handle v2,
|
||||
Face_handle n0,
|
||||
Face_handle n1,
|
||||
Face_handle n2) : Base(v0,v1,v2,n0,n1,n2) {}
|
||||
};
|
||||
|
||||
typedef CGAL::Cartesian<double> Gt;
|
||||
typedef CGAL::Triangulation_vertex_base_2<Gt> Vb;
|
||||
typedef My_face_base<Gt> Fb;
|
||||
typedef My_face_base<> Fb;
|
||||
typedef CGAL::Triangulation_data_structure_2<Vb,Fb > Tds;
|
||||
typedef CGAL::Triangulation_2<Gt,Tds> Triangulation;
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ typedef CGAL::Filtered_kernel<K1> K2;
|
|||
struct K : public K2 {};
|
||||
|
||||
typedef CGAL::Triangulation_vertex_base_2<K> Vb;
|
||||
typedef CGAL::Constrained_triangulation_face_base_2<K> Fb;
|
||||
typedef CGAL::Constrained_triangulation_face_base_2<> Fb;
|
||||
typedef CGAL::Triangulation_data_structure_2<Vb,Fb> TDS;
|
||||
typedef CGAL::Exact_predicates_tag Itag;
|
||||
typedef CGAL::Constrained_Delaunay_triangulation_2<K,TDS,Itag> CDT;
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
typedef Euclidean_2 Gt;
|
||||
typedef CGAL::Triangulation_vertex_base_2<Gt> Vb;
|
||||
typedef CGAL::Triangulation_face_base_2<Gt> Fb;
|
||||
typedef CGAL::Triangulation_ds_face_base_2<> Fb;
|
||||
typedef CGAL::Triangulation_data_structure_2<Vb,Fb> Tds;
|
||||
typedef CGAL::Triangulation_2<Gt,Tds> Triangulation;
|
||||
typedef CGAL::Delaunay_triangulation_2<Gt,Tds> Delaunay_triangulation;
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ CGAL_BEGIN_NAMESPACE
|
|||
template <class Gt,
|
||||
class Tds = Triangulation_data_structure_2 <
|
||||
Triangulation_vertex_base_2<Gt>,
|
||||
Constrained_triangulation_face_base_2<Gt> >,
|
||||
Constrained_triangulation_face_base_2<> >,
|
||||
class Itag = No_intersection_tag >
|
||||
class Constrained_Delaunay_triangulation_2
|
||||
: public Constrained_triangulation_2<Gt, Tds, Itag>
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ struct Exact_predicates_tag{}; // to be used with filtered exact number
|
|||
template < class Gt,
|
||||
class Tds = Triangulation_data_structure_2 <
|
||||
Triangulation_vertex_base_2<Gt>,
|
||||
Constrained_triangulation_face_base_2<Gt> >,
|
||||
Constrained_triangulation_face_base_2<> >,
|
||||
class Itag = No_intersection_tag >
|
||||
class Constrained_triangulation_2 : public Triangulation_2<Gt,Tds>
|
||||
{
|
||||
|
|
@ -140,6 +140,7 @@ public:
|
|||
// QUERY
|
||||
bool is_constrained(Edge e) const;
|
||||
bool are_there_incident_constraints(Vertex_handle v) const;
|
||||
bool is_valid(bool verbose = false, int level = 0) const;
|
||||
// template<class OutputIterator>
|
||||
// bool are_there_incident_constraints(Vertex_handle v,
|
||||
// OutputIterator out) const;
|
||||
|
|
@ -916,6 +917,23 @@ are_there_incident_constraints(Vertex_handle v) const
|
|||
return are_there_incident_constraints(v, Emptyset_iterator());
|
||||
}
|
||||
|
||||
template < class Gt, class Tds, class Itag >
|
||||
inline bool
|
||||
Constrained_triangulation_2<Gt,Tds,Itag>::
|
||||
is_valid(bool verbose = false, int level = 0) const
|
||||
{
|
||||
bool result = Triangulation::is_valid(verbose,level);
|
||||
for( All_faces_iterator it = all_faces_begin();
|
||||
it != all_faces_end() ; it++) {
|
||||
for(int i=0; i<3; i++) {
|
||||
Face_handle n = it->neighbor(i);
|
||||
result = result &&
|
||||
it->is_constrained(i) == n->is_constrained(n->index(it));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
template < class Gt, class Tds, class Itag >
|
||||
inline bool
|
||||
Constrained_triangulation_2<Gt,Tds,Itag>::
|
||||
|
|
@ -1030,8 +1048,8 @@ file_output(std::ostream& os) const
|
|||
Triangulation_2<Gt, Tds>::file_output(os);
|
||||
|
||||
// write constrained status
|
||||
typename Tds::Iterator_base ib = this->_tds.iterator_base_begin();
|
||||
for( ; ib != this->_tds.iterator_base_end(); ++ib) {
|
||||
typename Tds::Face_iterator_base ib = this->_tds.face_iterator_base_begin();
|
||||
for( ; ib != this->_tds.face_iterator_base_end(); ++ib) {
|
||||
for(int j = 0; j < 3; ++j){
|
||||
if (ib->is_constrained(j)) { os << "C";}
|
||||
else { os << "N";}
|
||||
|
|
|
|||
|
|
@ -30,44 +30,64 @@
|
|||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
template <class Gt>
|
||||
template <class Fb = Triangulation_ds_face_base_2<> >
|
||||
class Constrained_triangulation_face_base_2
|
||||
: public Triangulation_face_base_2<Gt>
|
||||
: public Fb
|
||||
{
|
||||
typedef Fb Base;
|
||||
typedef typename Fb::Triangulation_data_structure TDS;
|
||||
public:
|
||||
typedef Gt Geom_traits;
|
||||
typedef Triangulation_face_base_2<Gt> Fab;
|
||||
typedef Constrained_triangulation_face_base_2<Gt> Constrained_face_base;
|
||||
typedef typename Gt::Point_2 Point;
|
||||
typedef TDS Triangulation_data_structure;
|
||||
typedef typename TDS::Vertex_handle Vertex_handle;
|
||||
typedef typename TDS::Face_handle Face_handle;
|
||||
|
||||
template < typename TDS2 >
|
||||
struct Rebind_TDS {
|
||||
typedef typename Fb::template Rebind_TDS<TDS2>::Other Fb2;
|
||||
typedef Constrained_triangulation_face_base_2<Fb2> Other;
|
||||
};
|
||||
|
||||
|
||||
protected:
|
||||
bool C[3];
|
||||
|
||||
public:
|
||||
Constrained_triangulation_face_base_2()
|
||||
: Fab()
|
||||
: Base()
|
||||
{
|
||||
set_constraints(false,false,false);
|
||||
}
|
||||
|
||||
Constrained_triangulation_face_base_2(void* v0, void* v1, void* v2)
|
||||
: Fab(v0,v1,v2)
|
||||
Constrained_triangulation_face_base_2(Vertex_handle v0,
|
||||
Vertex_handle v1,
|
||||
Vertex_handle v2)
|
||||
: Base(v0,v1,v2)
|
||||
{
|
||||
set_constraints(false,false,false);
|
||||
}
|
||||
|
||||
Constrained_triangulation_face_base_2(void* v0, void* v1, void* v2,
|
||||
void* n0, void* n1, void* n2)
|
||||
: Fab(v0,v1,v2,n0,n1,n2)
|
||||
Constrained_triangulation_face_base_2(Vertex_handle v0,
|
||||
Vertex_handle v1,
|
||||
Vertex_handle v2,
|
||||
Face_handle n0,
|
||||
Face_handle n1,
|
||||
Face_handle n2)
|
||||
: Base(v0,v1,v2,n0,n1,n2)
|
||||
{
|
||||
set_constraints(false,false,false);
|
||||
}
|
||||
|
||||
|
||||
Constrained_triangulation_face_base_2(void* v0, void* v1, void* v2,
|
||||
void* n0, void* n1, void* n2,
|
||||
bool c0, bool c1, bool c2 )
|
||||
: Fab(v0,v1,v2,n0,n1,n2)
|
||||
Constrained_triangulation_face_base_2(Vertex_handle v0,
|
||||
Vertex_handle v1,
|
||||
Vertex_handle v2,
|
||||
Face_handle n0,
|
||||
Face_handle n1,
|
||||
Face_handle n2,
|
||||
bool c0,
|
||||
bool c1,
|
||||
bool c2 )
|
||||
: Base(v0,v1,v2,n0,n1,n2)
|
||||
{
|
||||
set_constraints(c0,c1,c2);
|
||||
}
|
||||
|
|
@ -79,7 +99,6 @@ public:
|
|||
void reorient();
|
||||
void ccw_permute();
|
||||
void cw_permute();
|
||||
bool is_valid(bool verbose = false, int level = 0) const;
|
||||
|
||||
};
|
||||
|
||||
|
|
@ -115,7 +134,7 @@ inline void
|
|||
Constrained_triangulation_face_base_2<Gt>::
|
||||
reorient()
|
||||
{
|
||||
Fab::reorient();
|
||||
Base::reorient();
|
||||
set_constraints(C[1],C[0],C[2]);
|
||||
}
|
||||
|
||||
|
|
@ -124,7 +143,7 @@ inline void
|
|||
Constrained_triangulation_face_base_2<Gt>::
|
||||
ccw_permute()
|
||||
{
|
||||
Fab::ccw_permute();
|
||||
Base::ccw_permute();
|
||||
set_constraints(C[2],C[0],C[1]);
|
||||
}
|
||||
|
||||
|
|
@ -133,30 +152,10 @@ inline void
|
|||
Constrained_triangulation_face_base_2<Gt>::
|
||||
cw_permute()
|
||||
{
|
||||
Fab::cw_permute();
|
||||
Base::cw_permute();
|
||||
set_constraints(C[1],C[2],C[0]);
|
||||
}
|
||||
|
||||
template <class Gt>
|
||||
inline bool
|
||||
Constrained_triangulation_face_base_2<Gt>::
|
||||
is_valid(bool verbose, int level) const
|
||||
{
|
||||
bool result = Fab::is_valid(verbose, level);
|
||||
CGAL_triangulation_assertion(result);
|
||||
if (dimension() == 2) {
|
||||
for(int i = 0; i < 3; i++) {
|
||||
Constrained_face_base* n =
|
||||
static_cast<Constrained_face_base*>(neighbor(i));
|
||||
if(n != NULL){
|
||||
int ni = n->face_index(this);
|
||||
result = result && ( is_constrained(i) == n->is_constrained(ni));
|
||||
}
|
||||
}
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
|
||||
CGAL_END_NAMESPACE
|
||||
|
||||
#endif //CGAL_CONSTRAINED_TRIANGULATION_FACE_BASE_2_H
|
||||
|
|
|
|||
|
|
@ -33,8 +33,7 @@ CGAL_BEGIN_NAMESPACE
|
|||
|
||||
template < class Gt,
|
||||
class Tds = Triangulation_data_structure_2 <
|
||||
Triangulation_vertex_base_2<Gt>,
|
||||
Triangulation_face_base_2<Gt> > >
|
||||
Triangulation_vertex_base_2<Gt> > >
|
||||
class Delaunay_triangulation_2 : public Triangulation_2<Gt,Tds>
|
||||
{
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -0,0 +1,51 @@
|
|||
// ============================================================================
|
||||
//
|
||||
// Copyright (c) 2003 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 :
|
||||
//
|
||||
// file : include/CGAL/Dummy_tds_2.h
|
||||
// revision : $Revision$
|
||||
// revision_date : $Date$
|
||||
// author(s) : Mariette Yvinec
|
||||
//
|
||||
// coordinator : INRIA Sophia Antipolis
|
||||
//
|
||||
// ============================================================================
|
||||
|
||||
#ifndef CGAL_TRIANGULATION_DUMMY_TDS_2_H
|
||||
#define CGAL_TRIANGULATION_DUMMY_TDS_2_H
|
||||
|
||||
#include <CGAL/basic.h>
|
||||
#include <CGAL/Triangulation_short_names_2.h>
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
// Dummy TDS which provides all types that a vertex_base or cell_base can use.
|
||||
struct Dummy_tds_2 {
|
||||
struct Vertex {};
|
||||
struct Face {};
|
||||
struct Edge {};
|
||||
|
||||
struct Vertex_handle {};
|
||||
struct Face_handle {};
|
||||
|
||||
struct Vertex_iterator {};
|
||||
struct Face_iterator {};
|
||||
struct Edge_iterator {};
|
||||
|
||||
struct Edge_circulator {};
|
||||
struct Facet_circulator {};
|
||||
struct Vertex_circulator {};
|
||||
};
|
||||
|
||||
CGAL_END_NAMESPACE
|
||||
|
||||
#endif // CGAL_TRIANGULATION_DUMMY_TDS_2_H
|
||||
|
|
@ -33,27 +33,27 @@ CGAL_BEGIN_NAMESPACE
|
|||
template < class Gt,
|
||||
class Tds = Triangulation_data_structure_2 <
|
||||
Regular_triangulation_vertex_base_2<Gt>,
|
||||
Regular_triangulation_face_base_2<Gt> > >
|
||||
Regular_triangulation_face_base_2<> > >
|
||||
class Regular_triangulation_2 : public Triangulation_2<Gt,Tds>
|
||||
{
|
||||
|
||||
typedef Regular_triangulation_2<Gt, Tds> Self;
|
||||
typedef Triangulation_2<Gt,Tds> Base;
|
||||
public:
|
||||
typedef Regular_triangulation_2<Gt, Tds> Self;
|
||||
typedef Triangulation_2<Gt,Tds> Base;
|
||||
typedef Gt Geom_traits;
|
||||
typedef typename Gt::Bare_point Bare_point;
|
||||
typedef typename Gt::Weighted_point Weighted_point;
|
||||
typedef typename Gt::Weighted_point Point;
|
||||
typedef typename Gt::Weight Weight;
|
||||
typedef Tds Triangulation_data_structure;
|
||||
typedef Gt Geom_traits;
|
||||
typedef typename Gt::Bare_point Bare_point;
|
||||
typedef typename Gt::Weighted_point Weighted_point;
|
||||
typedef typename Gt::Weighted_point Point;
|
||||
typedef typename Gt::Weight Weight;
|
||||
|
||||
typedef typename Base::Face_handle Face_handle;
|
||||
typedef typename Base::Vertex_handle Vertex_handle;
|
||||
typedef typename Base::Vertex Vertex;
|
||||
typedef typename Base::Edge Edge;
|
||||
typedef typename Base::Locate_type Locate_type;
|
||||
typedef typename Base::Vertex_circulator Vertex_circulator;
|
||||
typedef typename Base::Face_handle Face_handle;
|
||||
typedef typename Base::Vertex_handle Vertex_handle;
|
||||
typedef typename Base::Vertex Vertex;
|
||||
typedef typename Base::Edge Edge;
|
||||
typedef typename Base::Locate_type Locate_type;
|
||||
typedef typename Base::Face_circulator Face_circulator;
|
||||
typedef typename Base::Edge_circulator Edge_circulator;
|
||||
typedef typename Base::Vertex_circulator Vertex_circulator;
|
||||
typedef typename Base::Finite_edges_iterator Finite_edges_iterator;
|
||||
typedef typename Base::All_edges_iterator All_edges_iterator;
|
||||
typedef typename Base::Finite_faces_iterator Finite_faces_iterator;
|
||||
|
|
@ -68,7 +68,7 @@ private:
|
|||
public:
|
||||
bool operator()(const typename Base::All_vertices_iterator& it){
|
||||
return it->is_hidden();
|
||||
}
|
||||
}
|
||||
bool operator()(const typename Base::Finite_vertices_iterator& it){
|
||||
return it->is_hidden();
|
||||
}
|
||||
|
|
@ -185,7 +185,7 @@ private:
|
|||
Vertex_handle hide_new_vertex(Face_handle f, const Weighted_point& p);
|
||||
void hide_remove_degree_3(Face_handle fh, Vertex_handle vh);
|
||||
void hide_vertex(Face_handle f, Vertex_handle v);
|
||||
void hide_vertex(Face_handle f, void* ptr);
|
||||
//void hide_vertex(Face_handle f, void* ptr);
|
||||
void exchange_incidences(Vertex_handle va, Vertex_handle vb);
|
||||
void exchange_hidden(Vertex_handle va, Vertex_handle vb);
|
||||
|
||||
|
|
@ -255,8 +255,13 @@ copy_triangulation(const Self &tr )
|
|||
// not good
|
||||
// clear them and next
|
||||
// scan the hidden vertices to retablish the list in faces
|
||||
<<<<<<< Regular_triangulation_2.h
|
||||
typename Tds::Iterator_base baseit = this->_tds.iterator_base_begin();
|
||||
for( ; baseit != this->_tds.iterator_base_end(); ++baseit){
|
||||
=======
|
||||
typename Tds::Face_iterator_base baseit=_tds.face_iterator_base_begin();
|
||||
for( ; baseit != _tds.face_iterator_base_end(); baseit++){
|
||||
>>>>>>> 1.55.2.3
|
||||
baseit->vertex_list().clear();
|
||||
}
|
||||
Hidden_vertices_iterator hvit = hidden_vertices_begin();
|
||||
|
|
@ -375,9 +380,8 @@ is_valid_face(Face_handle fh) const
|
|||
typename Vertex_list::iterator vlit = fh->vertex_list().begin(),
|
||||
vldone = fh->vertex_list().end();
|
||||
for (; vlit != vldone; vlit++) {
|
||||
Vertex_handle v(static_cast<Vertex*>(*vlit));
|
||||
result = result && power_test(fh, v->point()) == ON_NEGATIVE_SIDE;
|
||||
result = result && (v->face() == fh);
|
||||
result = result && power_test(fh, (*vlit)->point()) == ON_NEGATIVE_SIDE;
|
||||
result = result && ((*vlit)->face() == fh);
|
||||
if (!result) show_face(fh);
|
||||
CGAL_triangulation_assertion(result);
|
||||
}
|
||||
|
|
@ -402,9 +406,14 @@ is_valid_vertex(Vertex_handle vh) const
|
|||
loc->neighbor(li)) );
|
||||
if ( !result) {
|
||||
std::cerr << vh->point() << " " << std::endl;
|
||||
<<<<<<< Regular_triangulation_2.h
|
||||
std::cerr << "vh_>face " << static_cast<void*>(&(*vh->face()))
|
||||
<< " " << std::endl;
|
||||
std::cerr << "loc " << static_cast<void*>(&(*loc))
|
||||
=======
|
||||
std::cerr << "vh_>face " << &*(vh->face()) << " " << std::endl;
|
||||
std::cerr << "loc " << &*(loc )
|
||||
>>>>>>> 1.55.2.3
|
||||
<< " lt " << lt << " li " << li << std::endl;
|
||||
show_face(vh->face());
|
||||
show_face(loc);
|
||||
|
|
@ -530,8 +539,7 @@ show_face(Face_handle fh) const
|
|||
std::cerr << " +++++>>> ";
|
||||
for (current= fh->vertex_list().begin();
|
||||
current!= fh->vertex_list().end() ; current++ ) {
|
||||
Vertex_handle v(static_cast<Vertex*>(*current));
|
||||
std::cerr <<"[ "<< (v->point()) << " ] , ";
|
||||
std::cerr <<"[ "<< ((*current)->point()) << " ] , ";
|
||||
}
|
||||
std::cerr <<std::endl;
|
||||
}
|
||||
|
|
@ -795,8 +803,7 @@ Regular_triangulation_2<Gt,Tds>::
|
|||
exchange_hidden(Vertex_handle va, Vertex_handle vb)
|
||||
{
|
||||
CGAL_triangulation_assertion (vb->is_hidden());
|
||||
CGAL_triangulation_assertion (vb ==
|
||||
static_cast<Vertex*>(*(vb->face()->vertex_list().rbegin())));
|
||||
CGAL_triangulation_assertion (vb == vb->face()->vertex_list().back());
|
||||
vb->face()->vertex_list().pop_back();
|
||||
_hidden_vertices--;
|
||||
hide_vertex(vb->face(), va);
|
||||
|
|
@ -990,7 +997,7 @@ remove(Vertex_handle v )
|
|||
|
||||
while (! p_list.empty())
|
||||
{
|
||||
Vertex_handle v(static_cast<Vertex*>(p_list.front()));
|
||||
Vertex_handle v(p_list.front());
|
||||
p_list.pop_front();
|
||||
if (is_infinite(neighboring)) {
|
||||
neighboring=neighboring->neighbor(neighboring->index(infinite_vertex()));
|
||||
|
|
@ -1191,10 +1198,7 @@ Regular_triangulation_2<Gt,Tds>::
|
|||
set_face(Vertex_list& vl, const Face_handle& fh)
|
||||
{
|
||||
for(typename Vertex_list::iterator it = vl.begin(); it != vl.end(); it++)
|
||||
{
|
||||
Vertex_handle v(static_cast<Vertex*>(*it));
|
||||
v->set_face(fh);
|
||||
}
|
||||
(*it)->set_face(fh);
|
||||
}
|
||||
|
||||
// add the vertex_list of f2 and f3 to the point list of f1
|
||||
|
|
@ -1243,10 +1247,9 @@ update_hidden_points_2_2(const Face_handle& f1, const Face_handle& f2)
|
|||
const Weighted_point& a1 = f1->vertex(f1->index(f2))->point();
|
||||
const Weighted_point& a = f1->vertex(1-f1->index(f2))->point();
|
||||
while ( ! p_list.empty() ) {
|
||||
Vertex_handle v(static_cast<Vertex*>(p_list.front()));
|
||||
if ( compare_x(a, v->point()) ==
|
||||
if ( compare_x(a, p_list.front()->point()) ==
|
||||
compare_x(a, a1) &&
|
||||
compare_y(a, v->point()) ==
|
||||
compare_y(a, p_list.front()->point()) ==
|
||||
compare_y(a, a1))
|
||||
{
|
||||
hide_vertex(f1, p_list.front());
|
||||
|
|
@ -1266,8 +1269,7 @@ update_hidden_points_2_2(const Face_handle& f1, const Face_handle& f2)
|
|||
|
||||
while ( ! p_list.empty() )
|
||||
{
|
||||
Vertex_handle v(static_cast<Vertex*>(p_list.front()));
|
||||
if (orientation(v0->point(), v1->point(), v->point()) ==
|
||||
if (orientation(v0->point(), v1->point(), p_list.front()->point()) ==
|
||||
COUNTERCLOCKWISE)
|
||||
hide_vertex(f1, p_list.front());
|
||||
else
|
||||
|
|
@ -1332,7 +1334,7 @@ update_hidden_points_1_3(const Face_handle& f1, const Face_handle& f2,
|
|||
// if here, v1,v2,v3 and v0 are finite vertices
|
||||
while(! p_list.empty())
|
||||
{
|
||||
Vertex_handle v(static_cast<Vertex*>(p_list.front()));
|
||||
Vertex_handle v(p_list.front());
|
||||
// if(orientation(v2->point(),v0->point(), v->point()) !=
|
||||
// orientation(v2->point(),v0->point(),v3->point()) )
|
||||
// { // not in f1
|
||||
|
|
@ -1400,17 +1402,17 @@ hide_vertex(Face_handle f, Vertex_handle vh)
|
|||
_hidden_vertices++;
|
||||
}
|
||||
vh->set_face(f);
|
||||
f->vertex_list().push_back(&(*vh));
|
||||
f->vertex_list().push_back(vh);
|
||||
}
|
||||
|
||||
template < class Gt, class Tds >
|
||||
void
|
||||
Regular_triangulation_2<Gt,Tds>::
|
||||
hide_vertex(Face_handle f, void* ptr)
|
||||
{
|
||||
Vertex_handle v(static_cast<Vertex*>(ptr));
|
||||
hide_vertex(f, v);
|
||||
}
|
||||
// template < class Gt, class Tds >
|
||||
// void
|
||||
// Regular_triangulation_2<Gt,Tds>::
|
||||
// hide_vertex(Face_handle f, void* ptr)
|
||||
// {
|
||||
// Vertex_handle v(static_cast<Vertex*>(ptr));
|
||||
// hide_vertex(f, v);
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
// release_date : $CGAL_Date$
|
||||
//
|
||||
// file : include/CGAL/Regular_triangulation_face_base_2.h
|
||||
// package : Triangulation_2
|
||||
// source : $RCSfile$
|
||||
// revision : $Revision$
|
||||
// revision_date : $Date$
|
||||
|
|
@ -31,16 +32,25 @@
|
|||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
template <class Gt>
|
||||
template <class Fb = Triangulation_ds_face_base_2 <> >
|
||||
class Regular_triangulation_face_base_2
|
||||
: public Triangulation_face_base_2<Gt>
|
||||
: public Fb
|
||||
{
|
||||
typedef Fb Fbase;
|
||||
typedef typename Fbase::Triangulation_data_structure TDS;
|
||||
public:
|
||||
typedef Gt Geom_traits;
|
||||
typedef Triangulation_face_base_2<Gt> Fbase;
|
||||
typedef Regular_triangulation_face_base_2<Gt> Regular_face_base;
|
||||
typedef typename Gt::Weighted_point Weighted_point;
|
||||
typedef std::list<void*> Vertex_list;
|
||||
typedef TDS Triangulation_data_structure;
|
||||
typedef typename TDS::Vertex_handle Vertex_handle;
|
||||
typedef typename TDS::Face_handle Face_handle;
|
||||
|
||||
template < typename TDS2 >
|
||||
struct Rebind_TDS {
|
||||
typedef typename Fb::template Rebind_TDS<TDS2>::Other Fb2;
|
||||
typedef Regular_triangulation_face_base_2<Fb2> Other;
|
||||
};
|
||||
|
||||
typedef std::list<Vertex_handle> Vertex_list;
|
||||
|
||||
protected:
|
||||
Vertex_list vlist;
|
||||
|
||||
|
|
@ -49,12 +59,18 @@ public:
|
|||
: Fbase(), vlist()
|
||||
{}
|
||||
|
||||
Regular_triangulation_face_base_2(void* v0, void* v1, void* v2)
|
||||
Regular_triangulation_face_base_2(Vertex_handle v0,
|
||||
Vertex_handle v1,
|
||||
Vertex_handle v2)
|
||||
: Fbase(v0,v1,v2), vlist()
|
||||
{ }
|
||||
|
||||
Regular_triangulation_face_base_2(void* v0, void* v1, void* v2,
|
||||
void* n0, void* n1, void* n2)
|
||||
Regular_triangulation_face_base_2(Vertex_handle v0,
|
||||
Vertex_handle v1,
|
||||
Vertex_handle v2,
|
||||
Face_handle n0,
|
||||
Face_handle n1,
|
||||
Face_handle n2)
|
||||
: Fbase(v0,v1,v2,n0,n1,n2), vlist()
|
||||
{ }
|
||||
|
||||
|
|
|
|||
|
|
@ -8,10 +8,11 @@
|
|||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// release :
|
||||
// release_date :
|
||||
// release : $CGAL_Revision$
|
||||
// release_date : $CGAL_Date$
|
||||
//
|
||||
// file : Triangulation/include/CGAL/Regular_triangulation_vertex_base_2.h
|
||||
// file : include/CGAL/Regular_triangulation_vertex_base_2.h
|
||||
// package : Triangulation_2
|
||||
// source : $RCSfile$
|
||||
// revision : $Revision$
|
||||
// revision_date : $Date$
|
||||
|
|
@ -29,19 +30,30 @@
|
|||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
template < class GT >
|
||||
class Regular_triangulation_vertex_base_2 :
|
||||
public Triangulation_vertex_base_2<GT> {
|
||||
|
||||
template < class GT,
|
||||
class Vbb = Triangulation_vertex_base_2<GT> >
|
||||
class Regular_triangulation_vertex_base_2
|
||||
: public Vbb
|
||||
{
|
||||
typedef typename Vbb::Triangulation_data_structure TDS;
|
||||
typedef Vbb Base;
|
||||
public:
|
||||
typedef typename GT::Point_2 Point;
|
||||
typedef typename Base::Point Point;
|
||||
typedef TDS Triangulation_data_structure;
|
||||
typedef typename TDS::Face_handle Face_handle;
|
||||
typedef typename TDS::Vertex_handle Vertex_handle;
|
||||
|
||||
template < typename TDS2 >
|
||||
struct Rebind_TDS {
|
||||
typedef typename Vbb::template Rebind_TDS<TDS2>::Other Vb2;
|
||||
typedef Regular_triangulation_vertex_base_2<GT, Vb2> Other;
|
||||
};
|
||||
|
||||
Regular_triangulation_vertex_base_2 ()
|
||||
: Triangulation_vertex_base_2<GT>(), _hidden(false)
|
||||
{}
|
||||
: Base(), _hidden(false) {}
|
||||
|
||||
Regular_triangulation_vertex_base_2(const Point & p, void * f = NULL)
|
||||
: Triangulation_vertex_base_2<GT>(p, f), _hidden(false)
|
||||
Regular_triangulation_vertex_base_2(const Point & p, Face_handle f = NULL)
|
||||
: Base(p, f), _hidden(false)
|
||||
{}
|
||||
|
||||
void set_hidden(bool b) { _hidden = b; }
|
||||
|
|
|
|||
|
|
@ -43,9 +43,7 @@
|
|||
#include <CGAL/Triangulation_utils_2.h>
|
||||
|
||||
#include <CGAL/Triangulation_data_structure_2.h>
|
||||
#include <CGAL/Triangulation_face_base_2.h>
|
||||
#include <CGAL/Triangulation_vertex_base_2.h>
|
||||
#include <CGAL/Triangulation_iterators_2.h>
|
||||
#include <CGAL/Triangulation_line_face_circulator_2.h>
|
||||
|
||||
|
||||
|
|
@ -60,24 +58,20 @@ template < class Gt, class Tds > std::ostream& operator<<
|
|||
|
||||
template < class Gt,
|
||||
class Tds = Triangulation_data_structure_2 <
|
||||
Triangulation_vertex_base_2<Gt>,
|
||||
Triangulation_face_base_2<Gt> > >
|
||||
Triangulation_vertex_base_2<Gt> > >
|
||||
class Triangulation_2
|
||||
: public Triangulation_cw_ccw_2
|
||||
{
|
||||
public:
|
||||
class Infinite_tester;
|
||||
typedef Tds Triangulation_data_structure;
|
||||
typedef Triangulation_2<Gt,Tds> Self;
|
||||
|
||||
friend std::istream& operator>> CGAL_NULL_TMPL_ARGS
|
||||
(std::istream& is, Triangulation_2 &tr);
|
||||
friend class Triangulation_finite_faces_iterator_2<Self>;
|
||||
friend class Triangulation_finite_vertices_iterator_2<Self>;
|
||||
//friend class Triangulation_finite_faces_iterator_2<Self>;
|
||||
//friend class Triangulation_finite_vertices_iterator_2<Self>;
|
||||
class Infinite_tester;
|
||||
typedef Triangulation_2<Gt,Tds> Self;
|
||||
|
||||
|
||||
|
||||
typedef Gt Geom_traits;
|
||||
public:
|
||||
typedef Tds Triangulation_data_structure;
|
||||
typedef Gt Geom_traits;
|
||||
typedef typename Geom_traits::Point_2 Point;
|
||||
typedef typename Geom_traits::Segment_2 Segment;
|
||||
typedef typename Geom_traits::Triangle_2 Triangle;
|
||||
|
|
@ -99,12 +93,23 @@ public:
|
|||
typedef typename Tds::Edge_iterator All_edges_iterator;
|
||||
typedef typename Tds::Vertex_iterator All_vertices_iterator;
|
||||
|
||||
typedef Triangulation_finite_faces_iterator_2<Self>
|
||||
Finite_faces_iterator;
|
||||
typedef Filter_iterator<All_edges_iterator, Infinite_tester>
|
||||
typedef Filter_iterator<All_faces_iterator,
|
||||
Infinite_tester>
|
||||
Finite_faces_iterator_base;
|
||||
typedef Filter_iterator<All_vertices_iterator,
|
||||
Infinite_tester>
|
||||
Finite_vertices_iterator_base;
|
||||
typedef Filter_iterator<All_edges_iterator,
|
||||
Infinite_tester>
|
||||
Finite_edges_iterator;
|
||||
typedef Triangulation_finite_vertices_iterator_2<Self>
|
||||
typedef Triangulation_iterator_handle_adaptor
|
||||
<Finite_faces_iterator_base,
|
||||
Face_handle> Finite_faces_iterator;
|
||||
typedef Triangulation_iterator_handle_adaptor
|
||||
<Finite_vertices_iterator_base,
|
||||
Vertex_handle>
|
||||
Finite_vertices_iterator;
|
||||
|
||||
//for backward compatibility
|
||||
typedef Finite_faces_iterator Face_iterator;
|
||||
typedef Finite_edges_iterator Edge_iterator;
|
||||
|
|
@ -122,7 +127,7 @@ public:
|
|||
CGAL_CLIB_STD::ptrdiff_t,
|
||||
std::bidirectional_iterator_tag> Point_iterator;
|
||||
|
||||
typedef Point value_type; // to have a back_inserter
|
||||
typedef Point value_type; // to have a back_inserter
|
||||
typedef const value_type& const_reference;
|
||||
typedef value_type& reference;
|
||||
|
||||
|
|
@ -360,15 +365,14 @@ private:
|
|||
|
||||
|
||||
// This class is used to generate the Finite_*_iterators.
|
||||
public :
|
||||
private :
|
||||
friend class Infinite_tester;
|
||||
class Infinite_tester
|
||||
{
|
||||
const Triangulation_2 *t;
|
||||
public:
|
||||
Infinite_tester() {}
|
||||
Infinite_tester(const Triangulation_2 *tr)
|
||||
: t(tr) {}
|
||||
Infinite_tester(const Triangulation_2 *tr) : t(tr) {}
|
||||
|
||||
bool operator()(const All_vertices_iterator & vit) const {
|
||||
return t->is_infinite(vit->handle());
|
||||
|
|
@ -1723,7 +1727,9 @@ finite_faces_begin() const
|
|||
{
|
||||
if ( dimension() < 2 )
|
||||
return finite_faces_end();
|
||||
return Finite_faces_iterator(this);
|
||||
return filter_iterator( all_faces_begin(),
|
||||
all_faces_end(),
|
||||
Infinite_tester(this));
|
||||
}
|
||||
|
||||
template <class Gt, class Tds >
|
||||
|
|
@ -1731,7 +1737,10 @@ typename Triangulation_2<Gt, Tds>::Finite_faces_iterator
|
|||
Triangulation_2<Gt, Tds>::
|
||||
finite_faces_end() const
|
||||
{
|
||||
return Finite_faces_iterator(this, 1);
|
||||
return filter_iterator( all_faces_begin(),
|
||||
all_faces_end(),
|
||||
Infinite_tester(this),
|
||||
all_faces_end() );
|
||||
}
|
||||
|
||||
template <class Gt, class Tds >
|
||||
|
|
@ -1741,7 +1750,9 @@ finite_vertices_begin() const
|
|||
{
|
||||
if ( number_of_vertices() <= 0 )
|
||||
return finite_vertices_end();
|
||||
return Finite_vertices_iterator(this);
|
||||
return filter_iterator(all_vertices_begin(),
|
||||
all_vertices_end(),
|
||||
Infinite_tester(this));
|
||||
}
|
||||
|
||||
template <class Gt, class Tds >
|
||||
|
|
@ -1749,7 +1760,10 @@ typename Triangulation_2<Gt, Tds>::Finite_vertices_iterator
|
|||
Triangulation_2<Gt, Tds>::
|
||||
finite_vertices_end() const
|
||||
{
|
||||
return Finite_vertices_iterator(this,1);
|
||||
return filter_iterator(all_vertices_begin(),
|
||||
all_vertices_end(),
|
||||
Infinite_tester(this),
|
||||
all_vertices_end());
|
||||
}
|
||||
|
||||
template <class Gt, class Tds >
|
||||
|
|
|
|||
|
|
@ -38,11 +38,10 @@
|
|||
#include <CGAL/Triangulation_utils_2.h>
|
||||
#include <CGAL/Trivial_iterator.h>
|
||||
#include <CGAL/DS_Container.h>
|
||||
#include <CGAL/Triangulation_vertex_base_2.h>
|
||||
#include <CGAL/Triangulation_face_base_2.h>
|
||||
#include <CGAL/Triangulation_ds_face_base_2.h>
|
||||
#include <CGAL/Triangulation_ds_vertex_base_2.h>
|
||||
#include <CGAL/Triangulation_ds_face_2.h>
|
||||
#include <CGAL/Triangulation_ds_vertex_2.h>
|
||||
#include <CGAL/Triangulation_ds_handles_2.h>
|
||||
#include <CGAL/Triangulation_ds_iterators_2.h>
|
||||
#include <CGAL/Triangulation_ds_circulators_2.h>
|
||||
|
||||
|
|
@ -50,6 +49,22 @@
|
|||
#include <CGAL/IO/File_scanner_OFF.h>
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
// These two compilers seem to eat the concept checking code.
|
||||
#if defined __GNUG__ || defined __SUNPRO_CC
|
||||
template < typename T >
|
||||
struct vertex_and_cell_base_concept_checker {
|
||||
template < typename T2 > struct check_for_rebind {};
|
||||
};
|
||||
|
||||
template <>
|
||||
template < typename T >
|
||||
struct vertex_and_cell_base_concept_checker<T>::check_for_rebind<T>
|
||||
{ struct YOU_FORGOT_TO_ADD_A_Rebind_TO_YOUR_OWN_VERTEX_OR_CELL{}; };
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
template < class Vb, class Fb>
|
||||
class Triangulation_data_structure_2;
|
||||
|
||||
|
|
@ -97,32 +112,57 @@ public:
|
|||
|
||||
|
||||
|
||||
template <class Vb, class Fb>
|
||||
template < class Vb = Triangulation_ds_vertex_base_2<>,
|
||||
class Fb = Triangulation_ds_face_base_2<> >
|
||||
class Triangulation_data_structure_2
|
||||
:public Triangulation_cw_ccw_2
|
||||
{
|
||||
public:
|
||||
typedef Triangulation_data_structure_2<Vb,Fb> Tds;
|
||||
|
||||
friend class Triangulation_ds_face_iterator_2<Tds>;
|
||||
typedef typename Vb::template Rebind_TDS<Tds>::Other Vertex_base;
|
||||
typedef typename Fb::template Rebind_TDS<Tds>::Other Face_base;
|
||||
|
||||
#if defined __GNUG__ || defined __SUNPRO_CC
|
||||
// We verify that the user has not forgotten to add a Rebind_TDS in his own
|
||||
// Vertex/Cell derived class, by checking that rebinding it to void gives
|
||||
// the exact same type.
|
||||
typedef vertex_and_cell_base_concept_checker<Vb> checker_1;
|
||||
typedef typename Vb::template Rebind_TDS<void>::Other vb2;
|
||||
typename checker_1::template check_for_rebind<vb2>::
|
||||
YOU_FORGOT_TO_ADD_A_Rebind_TO_YOUR_OWN_VERTEX_OR_CELL o1;
|
||||
|
||||
typedef vertex_and_cell_base_concept_checker<Fb> checker_2;
|
||||
typedef typename Fb::template Rebind_TDS<void>::Other fb2;
|
||||
typename checker_2::template check_for_rebind<fb2>::
|
||||
YOU_FORGOT_TO_ADD_A_Rebind_TO_YOUR_OWN_VERTEX_OR_CELL o2;
|
||||
#endif
|
||||
|
||||
friend class Triangulation_ds_edge_iterator_2<Tds>;
|
||||
friend class Triangulation_ds_vertex_iterator_2<Tds>;
|
||||
|
||||
typedef Vb Vertex_base;
|
||||
typedef Fb Face_base;
|
||||
typedef Triangulation_ds_vertex_2<Tds> Vertex;
|
||||
typedef Triangulation_ds_face_2<Tds> Face;
|
||||
friend class Triangulation_ds_face_circulator_2<Tds>;
|
||||
friend class Triangulation_ds_edge_circulator_2<Tds>;
|
||||
friend class Triangulation_ds_vertex_circulator_2<Tds>;
|
||||
|
||||
public:
|
||||
typedef Triangulation_ds_vertex_2<Vertex_base> Vertex;
|
||||
typedef Triangulation_ds_face_2<Face_base> Face;
|
||||
typedef CGAL_TRIVIAL_COMPARABLE_ITERATOR_CHECKER_POINTER(Face) Face_handle;
|
||||
typedef CGAL_TRIVIAL_COMPARABLE_ITERATOR_CHECKER_POINTER(Vertex)
|
||||
Vertex_handle;
|
||||
typedef std::pair<Face_handle, int> Edge;
|
||||
|
||||
protected:
|
||||
typedef DS_Container<Face> Face_container;
|
||||
typedef DS_Container<Vertex> Vertex_container;
|
||||
typedef typename Face_container::iterator Iterator_base;
|
||||
typedef Triangulation_ds_face_iterator_2<Tds> Face_iterator;
|
||||
|
||||
public:
|
||||
typedef typename Face_container::iterator Face_iterator_base;
|
||||
typedef typename Vertex_container::iterator Vertex_iterator_base;
|
||||
|
||||
typedef Triangulation_iterator_handle_adaptor
|
||||
<Face_iterator_base, Face_handle> Face_iterator;
|
||||
typedef Triangulation_iterator_handle_adaptor
|
||||
<Vertex_iterator_base, Vertex_handle> Vertex_iterator;
|
||||
typedef Triangulation_ds_edge_iterator_2<Tds> Edge_iterator;
|
||||
typedef Triangulation_ds_vertex_iterator_2<Tds> Vertex_iterator;
|
||||
|
||||
typedef Triangulation_ds_face_circulator_2<Tds> Face_circulator;
|
||||
typedef Triangulation_ds_vertex_circulator_2<Tds> Vertex_circulator;
|
||||
|
|
@ -173,34 +213,34 @@ public:
|
|||
|
||||
// ITERATORS AND CIRCULATORS
|
||||
public:
|
||||
// The Iterator_base gives the possibility to iterate over all
|
||||
// in the container independently of the dimension.
|
||||
// The face_iterator_base_begin gives the possibility to iterate over all
|
||||
// faces in the container independently of the dimension.
|
||||
// public for the need of file_ouput() of Constrained triangulation
|
||||
// should be made public later
|
||||
// should be made private later
|
||||
|
||||
Iterator_base iterator_base_begin() const {
|
||||
Face_iterator face_iterator_base_begin() const {
|
||||
return face_container().begin();
|
||||
}
|
||||
Iterator_base iterator_base_end() const {
|
||||
Face_iterator face_iterator_base_end() const {
|
||||
return face_container().end();
|
||||
}
|
||||
|
||||
public:
|
||||
Face_iterator faces_begin() const {
|
||||
if (dimension() < 2) return faces_end();
|
||||
return Face_iterator(this);
|
||||
return face_container().begin();
|
||||
}
|
||||
|
||||
Face_iterator faces_end() const {
|
||||
return Face_iterator(this, 1);
|
||||
return face_container().end();
|
||||
}
|
||||
|
||||
Vertex_iterator vertices_begin() const {
|
||||
return Vertex_iterator(this);
|
||||
return vertex_container().begin();
|
||||
}
|
||||
|
||||
Vertex_iterator vertices_end() const {
|
||||
return Vertex_iterator(this,1);
|
||||
return vertex_container().end();
|
||||
}
|
||||
|
||||
Edge_iterator edges_begin() const {
|
||||
|
|
@ -760,7 +800,7 @@ insert_dim_up(Vertex_handle w, bool orient)
|
|||
v->set_face(f1);
|
||||
break;
|
||||
case 0 :
|
||||
f1 = &(*iterator_base_begin());
|
||||
f1 = &(*face_iterator_base_begin());
|
||||
f2 = create_face(v,Vertex_handle(NULL),Vertex_handle(NULL));
|
||||
f1->set_neighbor(0,f2);
|
||||
f2->set_neighbor(0,f1);
|
||||
|
|
@ -770,10 +810,10 @@ insert_dim_up(Vertex_handle w, bool orient)
|
|||
case 2 :
|
||||
{
|
||||
std::list<Face_handle> faces_list;
|
||||
Iterator_base ib= iterator_base_begin();
|
||||
Iterator_base ib_end = iterator_base_end();
|
||||
Face_iterator ib= face_iterator_base_begin();
|
||||
Face_iterator ib_end = face_iterator_base_end();
|
||||
for (; ib != ib_end ; ++ib){
|
||||
faces_list.push_back( & (*ib));
|
||||
faces_list.push_back( ib);
|
||||
}
|
||||
|
||||
std::list<Face_handle> to_delete;
|
||||
|
|
@ -914,10 +954,10 @@ remove_dim_down(Vertex_handle v)
|
|||
// the other faces are deleted
|
||||
std::list<Face_handle > to_delete;
|
||||
std::list<Face_handle > to_downgrade;
|
||||
Iterator_base ib = iterator_base_begin();
|
||||
for( ; ib != iterator_base_end(); ++ib ){
|
||||
if ( ! ib->has_vertex(v) ) { to_delete.push_back(&(*ib));}
|
||||
else { to_downgrade.push_back(&(*ib));}
|
||||
Face_iterator ib = face_iterator_base_begin();
|
||||
for( ; ib != face_iterator_base_end(); ++ib ){
|
||||
if ( ! ib->has_vertex(v) ) { to_delete.push_back(ib);}
|
||||
else { to_downgrade.push_back(ib);}
|
||||
}
|
||||
|
||||
typename std::list<Face_handle>::iterator lfit = to_downgrade.begin();
|
||||
|
|
@ -1228,8 +1268,8 @@ is_valid(bool verbose, int level) const
|
|||
CGAL_triangulation_assertion(result);
|
||||
|
||||
//count and test the validity of the faces (for positive dimensions)
|
||||
Iterator_base ib = iterator_base_begin();
|
||||
Iterator_base ib_end = iterator_base_end();
|
||||
Face_iterator ib = face_iterator_base_begin();
|
||||
Face_iterator ib_end = face_iterator_base_end();
|
||||
int count_stored_faces =0;
|
||||
for ( ; ib != ib_end ; ++ib){
|
||||
count_stored_faces += 1;
|
||||
|
|
@ -1314,9 +1354,9 @@ copy_tds(const Tds &tds, Vertex_handle vh)
|
|||
//initializes maps
|
||||
std::map<Vertex_handle,Vertex_handle> vmap;
|
||||
std::map<Face_handle,Face_handle> fmap;
|
||||
Iterator_base it1 = tds.iterator_base_begin();
|
||||
Iterator_base it2 = iterator_base_begin();
|
||||
for( ; it1 != tds.iterator_base_end(); ++it1,++it2) {
|
||||
Face_iterator it1 = tds.face_iterator_base_begin();
|
||||
Face_iterator it2 = face_iterator_base_begin();
|
||||
for( ; it1 != tds.face_iterator_base_end(); ++it1,++it2) {
|
||||
fmap[it1->handle()] = it2->handle();
|
||||
}
|
||||
Vertex_iterator vit1 = tds.vertices_begin();
|
||||
|
|
@ -1326,11 +1366,11 @@ copy_tds(const Tds &tds, Vertex_handle vh)
|
|||
}
|
||||
|
||||
//update pointers
|
||||
it2 = iterator_base_begin();
|
||||
it2 = face_iterator_base_begin();
|
||||
int j;
|
||||
if (dimension() == -1) it2->set_vertex(0, vmap[it2->vertex(0)]);
|
||||
else { // dimension() >= 0
|
||||
for ( ; it2 != iterator_base_end(); ++it2) {
|
||||
for ( ; it2 != face_iterator_base_end(); ++it2) {
|
||||
for (j = 0; j < dimension()+ 1; ++j) {
|
||||
it2->set_vertex(j, vmap[it2->vertex(j)]);
|
||||
it2->set_neighbor(j, fmap[it2->neighbor(j)]);
|
||||
|
|
@ -1371,7 +1411,8 @@ file_output( std::ostream& os, Vertex_handle v, bool skip_first) const
|
|||
if ( v != NULL) {
|
||||
V[v] = inum++;
|
||||
if( ! skip_first){
|
||||
os << v->point();
|
||||
// os << v->point();
|
||||
os << *v ;
|
||||
if(is_ascii(os)) os << std::endl;
|
||||
}
|
||||
}
|
||||
|
|
@ -1380,7 +1421,8 @@ file_output( std::ostream& os, Vertex_handle v, bool skip_first) const
|
|||
for( Vertex_iterator vit= vertices_begin(); vit != vertices_end() ; ++vit) {
|
||||
if ( vit->handle() != v) {
|
||||
V[vit->handle()] = inum++;
|
||||
os << vit->point();
|
||||
// os << vit->point();
|
||||
os << *vit;
|
||||
if(is_ascii(os)) os << std::endl;
|
||||
}
|
||||
}
|
||||
|
|
@ -1389,8 +1431,8 @@ file_output( std::ostream& os, Vertex_handle v, bool skip_first) const
|
|||
// vertices of the faces
|
||||
inum = 0;
|
||||
int dim = (dimension() == -1 ? 1 : dimension() + 1);
|
||||
for( Iterator_base ib = iterator_base_begin();
|
||||
ib != iterator_base_end(); ++ib) {
|
||||
for( Face_iterator ib = face_iterator_base_begin();
|
||||
ib != face_iterator_base_end(); ++ib) {
|
||||
F[&(*ib)] = inum++;
|
||||
for(int j = 0; j < dim ; ++j){
|
||||
os << V[ib->vertex(j)];
|
||||
|
|
@ -1402,8 +1444,8 @@ file_output( std::ostream& os, Vertex_handle v, bool skip_first) const
|
|||
}
|
||||
|
||||
// neighbor pointers of the faces
|
||||
for( Iterator_base it = iterator_base_begin();
|
||||
it != iterator_base_end(); ++it) {
|
||||
for( Face_iterator it = face_iterator_base_begin();
|
||||
it != face_iterator_base_end(); ++it) {
|
||||
for(int j = 0; j < dimension()+1; ++j){
|
||||
os << F[&(*(it->neighbor(j)))];
|
||||
if(is_ascii(os)){
|
||||
|
|
@ -1446,10 +1488,11 @@ file_input( std::istream& is, bool skip_first)
|
|||
++i;
|
||||
}
|
||||
for( ; i < n; ++i) {
|
||||
typename Vertex_base::Point p;
|
||||
is >> p;
|
||||
// typename Vertex_base::Point p;
|
||||
// is >> p;
|
||||
V[i] = create_vertex();
|
||||
V[i]->set_point(p);
|
||||
is >> *(V[i]);
|
||||
//V[i]->set_point(p);
|
||||
}
|
||||
|
||||
// Creation of the faces
|
||||
|
|
@ -1507,14 +1550,14 @@ vrml_output( std::ostream& os, Vertex_handle v, bool skip_infinite) const
|
|||
int inum = 0;
|
||||
if ( v != NULL) {
|
||||
vmap[v] = inum++;
|
||||
if( ! skip_infinite) os << "\t\t\t\t" << vit->point() << std::endl;
|
||||
if( ! skip_infinite) os << "\t\t\t\t" << *vit << std::endl;
|
||||
}
|
||||
|
||||
//other vertices
|
||||
for( vit= vertices_begin(); vit != vertices_end() ; ++vit) {
|
||||
if ( vit->handle() != v) {
|
||||
vmap[vit->handle()] = inum++;
|
||||
os << "\t\t\t\t" << vit->point() << std::endl;
|
||||
os << "\t\t\t\t" << *vit << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,13 +30,12 @@
|
|||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
template < class Tds >
|
||||
template < class Fb >
|
||||
class Triangulation_ds_face_2
|
||||
: public Tds::Face_base
|
||||
: public Fb
|
||||
{
|
||||
public:
|
||||
typedef typename Tds::Vertex_base Vb;
|
||||
typedef typename Tds::Face_base Fb;
|
||||
typedef typename Fb::Triangulation_data_structure Tds;
|
||||
typedef typename Tds::Vertex Vertex;
|
||||
typedef typename Tds::Face Face;
|
||||
typedef typename Tds::Vertex_handle Vertex_handle;
|
||||
|
|
@ -49,12 +48,12 @@ public :
|
|||
{}
|
||||
|
||||
Triangulation_ds_face_2(Vertex_handle v0, Vertex_handle v1, Vertex_handle v2)
|
||||
: Fb(&*v0,&*v1,&*v2)
|
||||
: Fb(v0,v1,v2)
|
||||
{}
|
||||
|
||||
Triangulation_ds_face_2(Vertex_handle v0, Vertex_handle v1, Vertex_handle v2,
|
||||
Face_handle n0, Face_handle n1, Face_handle n2)
|
||||
: Fb(&*v0,&*v1,&*v2,&*n0,&*n1,&*n2)
|
||||
: Fb(v0,v1,v2,n0,n1,n2)
|
||||
{}
|
||||
|
||||
Triangulation_ds_face_2( const Face& f)
|
||||
|
|
@ -64,67 +63,19 @@ public :
|
|||
static int ccw(int i) {return Triangulation_cw_ccw_2::ccw(i);}
|
||||
static int cw(int i) {return Triangulation_cw_ccw_2::cw(i);}
|
||||
|
||||
//setting
|
||||
void set_vertex(int i, Vertex_handle v) { Fb::set_vertex(i, &*v);}
|
||||
void set_neighbor(int i, Face_handle n) { Fb::set_neighbor(i, &*n);}
|
||||
void set_vertices() { Fb::set_vertices();}
|
||||
void set_neighbors() { Fb::set_neighbors();}
|
||||
void set_vertices(Vertex_handle v0, Vertex_handle v1, Vertex_handle v2);
|
||||
void set_neighbors(Face_handle n0, Face_handle n1, Face_handle n2);
|
||||
//void reorient(); inherited from Fb
|
||||
|
||||
//Vertex Access Member Functions
|
||||
Vertex_handle vertex(int i) const;
|
||||
Vertex_handle mirror_vertex(int i) const;
|
||||
bool has_vertex(Vertex_handle v) const;
|
||||
bool has_vertex(Vertex_handle v, int& i) const;
|
||||
int index(Vertex_handle v) const;
|
||||
|
||||
// Neighbors Access Functions
|
||||
Face_handle neighbor(int i) const;
|
||||
bool has_neighbor(Face_handle n) const;
|
||||
bool has_neighbor(Face_handle n, int& i) const;
|
||||
int index(Face_handle n) const;
|
||||
int mirror_index(int i) const;
|
||||
|
||||
//Miscelleanous
|
||||
Face_handle handle() const {return const_cast<Face*>(this);}
|
||||
Face_handle handle() {return const_cast<Face*>(this);}
|
||||
bool is_valid(bool verbose = false, int level = 0) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
template < class Tds >
|
||||
inline void
|
||||
Triangulation_ds_face_2<Tds>::
|
||||
set_vertices(Vertex_handle v0, Vertex_handle v1, Vertex_handle v2)
|
||||
{
|
||||
Fb::set_vertices(&*v0,&*v1,&*v2);
|
||||
}
|
||||
|
||||
template < class Tds >
|
||||
inline void
|
||||
Triangulation_ds_face_2<Tds>::
|
||||
set_neighbors(Face_handle n0, Face_handle n1, Face_handle n2)
|
||||
{
|
||||
Fb::set_neighbors(&*n0,&*n1,&*n2);
|
||||
}
|
||||
|
||||
template < class Tds >
|
||||
template < class Fb >
|
||||
inline
|
||||
typename Triangulation_ds_face_2<Tds>::Vertex_handle
|
||||
Triangulation_ds_face_2<Tds>::
|
||||
vertex(int i) const
|
||||
{
|
||||
return(Vertex_handle(static_cast<Vertex*>(Fb::vertex(i))));
|
||||
}
|
||||
|
||||
template < class Tds >
|
||||
inline
|
||||
typename Triangulation_ds_face_2<Tds>::Vertex_handle
|
||||
Triangulation_ds_face_2<Tds>::
|
||||
typename Triangulation_ds_face_2<Fb>::Vertex_handle
|
||||
Triangulation_ds_face_2<Fb>::
|
||||
mirror_vertex(int i) const
|
||||
{
|
||||
CGAL_triangulation_precondition ( neighbor(i) != NULL && dimension() >= 1);
|
||||
|
|
@ -132,9 +83,9 @@ mirror_vertex(int i) const
|
|||
return neighbor(i)->vertex(mirror_index(i));
|
||||
}
|
||||
|
||||
template < class Tds >
|
||||
template < class Fb >
|
||||
inline int
|
||||
Triangulation_ds_face_2<Tds>::
|
||||
Triangulation_ds_face_2<Fb>::
|
||||
mirror_index(int i) const
|
||||
{
|
||||
// return the index of opposite vertex in neighbor(i);
|
||||
|
|
@ -143,68 +94,10 @@ mirror_index(int i) const
|
|||
return ccw( neighbor(i)->index(vertex(ccw(i))));
|
||||
}
|
||||
|
||||
template < class Tds >
|
||||
inline bool
|
||||
Triangulation_ds_face_2<Tds>::
|
||||
has_vertex(Vertex_handle v) const
|
||||
{
|
||||
return (Fb::has_vertex(&*v));
|
||||
}
|
||||
|
||||
template < class Tds >
|
||||
inline bool
|
||||
Triangulation_ds_face_2<Tds>::
|
||||
has_vertex(Vertex_handle v, int& i) const
|
||||
{
|
||||
return (Fb::has_vertex(&*v,i));
|
||||
}
|
||||
|
||||
template < class Tds >
|
||||
inline int
|
||||
Triangulation_ds_face_2<Tds>::
|
||||
index(Vertex_handle v) const
|
||||
{
|
||||
return(Fb::vertex_index(&*v));
|
||||
}
|
||||
|
||||
// Neighbors Access Functions
|
||||
template < class Tds >
|
||||
inline
|
||||
typename Triangulation_ds_face_2<Tds>::Face_handle
|
||||
Triangulation_ds_face_2<Tds>::
|
||||
neighbor(int i) const
|
||||
{
|
||||
return (static_cast<Face*>(Fb::neighbor(i)));
|
||||
}
|
||||
|
||||
template < class Tds >
|
||||
inline bool
|
||||
Triangulation_ds_face_2<Tds>::
|
||||
has_neighbor(Face_handle n) const
|
||||
{
|
||||
return (Fb::has_neighbor(&*n));
|
||||
}
|
||||
|
||||
template < class Tds >
|
||||
inline bool
|
||||
Triangulation_ds_face_2<Tds>::
|
||||
has_neighbor(Face_handle n, int& i) const
|
||||
{
|
||||
return (Fb::has_neighbor(&*n,i));
|
||||
}
|
||||
|
||||
template < class Tds >
|
||||
inline int
|
||||
Triangulation_ds_face_2<Tds>::
|
||||
index(Face_handle n) const
|
||||
{
|
||||
return(Fb::face_index(&*n));
|
||||
}
|
||||
|
||||
//Miscelleanous
|
||||
template < class Tds >
|
||||
template < class Fb >
|
||||
bool
|
||||
Triangulation_ds_face_2<Tds>::
|
||||
Triangulation_ds_face_2<Fb>::
|
||||
is_valid(bool verbose, int level) const
|
||||
{
|
||||
bool result = Fb::is_valid(verbose, level);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,352 @@
|
|||
// ============================================================================
|
||||
//
|
||||
// Copyright (c) 1997 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 :
|
||||
//
|
||||
// file : Triangulation_ds_face_base_2.h
|
||||
// source : $RCSfile$
|
||||
// revision : $Revision$
|
||||
// revision_date : $Date$
|
||||
// author(s) : Mariette Yvinec
|
||||
//
|
||||
// coordinator : Mariette Yvinec <Mariette Yvinec@sophia.inria.fr>
|
||||
//
|
||||
// ============================================================================
|
||||
|
||||
#ifndef CGAL_TRIANGULATION_DS_FACE_BASE_2_H
|
||||
#define CGAL_TRIANGULATION_DS_FACE_BASE_2_H
|
||||
|
||||
#include <CGAL/basic.h>
|
||||
#include <CGAL/triangulation_assertions.h>
|
||||
#include <CGAL/Triangulation_short_names_2.h>
|
||||
#include <CGAL/Triangulation_utils_2.h>
|
||||
#include <CGAL/Dummy_tds_2.h>
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
template < typename TDS = void>
|
||||
class Triangulation_ds_face_base_2
|
||||
{
|
||||
public:
|
||||
typedef TDS Triangulation_data_structure;
|
||||
typedef typename TDS::Vertex_handle Vertex_handle;
|
||||
typedef typename TDS::Face_handle Face_handle;
|
||||
|
||||
// Borland requires this.
|
||||
template <typename TDS2>
|
||||
struct Rebind_TDS { typedef Triangulation_ds_face_base_2<TDS2> Other; };
|
||||
|
||||
private:
|
||||
Vertex_handle V[3];
|
||||
Face_handle N[3];
|
||||
|
||||
public:
|
||||
Triangulation_ds_face_base_2();
|
||||
Triangulation_ds_face_base_2(Vertex_handle v0,
|
||||
Vertex_handle v1,
|
||||
Vertex_handle v2);
|
||||
Triangulation_ds_face_base_2(Vertex_handle v0,
|
||||
Vertex_handle v1,
|
||||
Vertex_handle v2,
|
||||
Face_handle n0,
|
||||
Face_handle n1,
|
||||
Face_handle n2);
|
||||
|
||||
Vertex_handle vertex(int i) const;
|
||||
bool has_vertex(Vertex_handle v) const;
|
||||
bool has_vertex(Vertex_handle v, int& i) const ;
|
||||
int index(Vertex_handle v) const ;
|
||||
|
||||
Face_handle neighbor(int i) const ;
|
||||
bool has_neighbor(Face_handle n) const;
|
||||
bool has_neighbor(Face_handle n, int& i) const;
|
||||
int index(Face_handle n) const;
|
||||
|
||||
void set_vertex(int i, Vertex_handle v);
|
||||
void set_vertices();
|
||||
void set_vertices(Vertex_handle v0, Vertex_handle v1, Vertex_handle v2);
|
||||
void set_neighbor(int i, Face_handle n) ;
|
||||
void set_neighbors();
|
||||
void set_neighbors(Face_handle n0, Face_handle n1, Face_handle n2);
|
||||
void reorient();
|
||||
void ccw_permute();
|
||||
void cw_permute();
|
||||
|
||||
int dimension() const;
|
||||
//the following trivial is_valid to allow
|
||||
// the user of derived face base classes
|
||||
// to add their own purpose checking
|
||||
bool is_valid(bool /* verbose */ = false, int /* level */ = 0) const
|
||||
{return true;}
|
||||
|
||||
|
||||
};
|
||||
|
||||
template <class TDS>
|
||||
Triangulation_ds_face_base_2<TDS> ::
|
||||
Triangulation_ds_face_base_2()
|
||||
{
|
||||
set_vertices();
|
||||
set_neighbors();
|
||||
}
|
||||
|
||||
template <class TDS>
|
||||
Triangulation_ds_face_base_2<TDS> ::
|
||||
Triangulation_ds_face_base_2( Vertex_handle v0,
|
||||
Vertex_handle v1,
|
||||
Vertex_handle v2)
|
||||
{
|
||||
set_vertices(v0, v1, v2);
|
||||
set_neighbors();
|
||||
}
|
||||
|
||||
template <class TDS>
|
||||
Triangulation_ds_face_base_2<TDS> ::
|
||||
Triangulation_ds_face_base_2(Vertex_handle v0,
|
||||
Vertex_handle v1,
|
||||
Vertex_handle v2,
|
||||
Face_handle n0,
|
||||
Face_handle n1,
|
||||
Face_handle n2)
|
||||
{
|
||||
set_vertices(v0, v1, v2);
|
||||
set_neighbors(n0, n1, n2);
|
||||
}
|
||||
|
||||
|
||||
template <class TDS>
|
||||
inline
|
||||
typename Triangulation_ds_face_base_2<TDS>::Vertex_handle
|
||||
Triangulation_ds_face_base_2<TDS>::
|
||||
vertex(int i) const
|
||||
{
|
||||
CGAL_triangulation_precondition( i == 0 || i == 1 || i == 2);
|
||||
return V[i];
|
||||
}
|
||||
|
||||
|
||||
template <class TDS>
|
||||
inline bool
|
||||
Triangulation_ds_face_base_2<TDS> ::
|
||||
has_vertex(Vertex_handle v) const
|
||||
{
|
||||
return (V[0] == v) || (V[1] == v) || (V[2]== v);
|
||||
}
|
||||
|
||||
template <class TDS>
|
||||
inline bool
|
||||
Triangulation_ds_face_base_2<TDS> ::
|
||||
has_vertex(Vertex_handle v, int& i) const
|
||||
{
|
||||
if (v == V[0]) {
|
||||
i = 0;
|
||||
return true;
|
||||
}
|
||||
if (v == V[1]) {
|
||||
i = 1;
|
||||
return true;
|
||||
}
|
||||
if (v == V[2]) {
|
||||
i = 2;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
template <class TDS>
|
||||
inline int
|
||||
Triangulation_ds_face_base_2<TDS> ::
|
||||
index(Vertex_handle v) const
|
||||
{
|
||||
if (v == V[0]) return 0;
|
||||
if (v == V[1]) return 1;
|
||||
CGAL_triangulation_assertion( v == V[2] );
|
||||
return 2;
|
||||
}
|
||||
|
||||
template <class TDS>
|
||||
inline
|
||||
typename Triangulation_ds_face_base_2<TDS>::Face_handle
|
||||
Triangulation_ds_face_base_2<TDS>::
|
||||
neighbor(int i) const
|
||||
{
|
||||
CGAL_triangulation_precondition( i == 0 || i == 1 || i == 2);
|
||||
return N[i];
|
||||
}
|
||||
|
||||
template <class TDS>
|
||||
inline bool
|
||||
Triangulation_ds_face_base_2<TDS> ::
|
||||
has_neighbor(Face_handle n) const
|
||||
{
|
||||
return (N[0] == n) || (N[1] == n) || (N[2] == n);
|
||||
}
|
||||
|
||||
|
||||
template <class TDS>
|
||||
inline bool
|
||||
Triangulation_ds_face_base_2<TDS> ::
|
||||
has_neighbor(Face_handle n, int& i) const
|
||||
{
|
||||
if(n == N[0]){
|
||||
i = 0;
|
||||
return true;
|
||||
}
|
||||
if(n == N[1]){
|
||||
i = 1;
|
||||
return true;
|
||||
}
|
||||
if(n == N[2]){
|
||||
i = 2;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
template <class TDS>
|
||||
inline int
|
||||
Triangulation_ds_face_base_2<TDS> ::
|
||||
index(Face_handle n) const
|
||||
{
|
||||
if (n == N[0]) return 0;
|
||||
if (n == N[1]) return 1;
|
||||
CGAL_triangulation_assertion( n == N[2] );
|
||||
return 2;
|
||||
}
|
||||
|
||||
template <class TDS>
|
||||
inline void
|
||||
Triangulation_ds_face_base_2<TDS> ::
|
||||
set_vertex(int i, Vertex_handle v)
|
||||
{
|
||||
CGAL_triangulation_precondition( i == 0 || i == 1 || i == 2);
|
||||
V[i] = v;
|
||||
}
|
||||
|
||||
template <class TDS>
|
||||
inline void
|
||||
Triangulation_ds_face_base_2<TDS> ::
|
||||
set_neighbor(int i, Face_handle n)
|
||||
{
|
||||
CGAL_triangulation_precondition( i == 0 || i == 1 || i == 2);
|
||||
N[i] = n;
|
||||
}
|
||||
|
||||
template <class TDS>
|
||||
inline void
|
||||
Triangulation_ds_face_base_2<TDS> ::
|
||||
set_vertices()
|
||||
{
|
||||
V[0] = V[1] = V[2] = NULL;
|
||||
}
|
||||
|
||||
template <class TDS>
|
||||
inline void
|
||||
Triangulation_ds_face_base_2<TDS> ::
|
||||
set_vertices(Vertex_handle v0, Vertex_handle v1, Vertex_handle v2)
|
||||
{
|
||||
V[0] = v0;
|
||||
V[1] = v1;
|
||||
V[2] = v2;
|
||||
}
|
||||
|
||||
template <class TDS>
|
||||
inline void
|
||||
Triangulation_ds_face_base_2<TDS> ::
|
||||
set_neighbors()
|
||||
{
|
||||
N[0] = N[1] = N[2] = NULL;
|
||||
}
|
||||
|
||||
template <class TDS>
|
||||
inline void
|
||||
Triangulation_ds_face_base_2<TDS> ::
|
||||
set_neighbors(Face_handle n0,Face_handle n1, Face_handle n2)
|
||||
{
|
||||
N[0] = n0;
|
||||
N[1] = n1;
|
||||
N[2] = n2;
|
||||
}
|
||||
|
||||
template <class TDS>
|
||||
void
|
||||
Triangulation_ds_face_base_2<TDS> ::
|
||||
reorient()
|
||||
{
|
||||
//exchange the vertices 0 and 1
|
||||
set_vertices (V[1],V[0],V[2]);
|
||||
set_neighbors(N[1],N[0],N[2]);
|
||||
}
|
||||
|
||||
template <class TDS>
|
||||
inline void
|
||||
Triangulation_ds_face_base_2<TDS> ::
|
||||
ccw_permute()
|
||||
{
|
||||
set_vertices (V[2],V[0],V[1]);
|
||||
set_neighbors(N[2],N[0],N[1]);
|
||||
}
|
||||
|
||||
|
||||
template <class TDS>
|
||||
inline void
|
||||
Triangulation_ds_face_base_2<TDS> ::
|
||||
cw_permute()
|
||||
{
|
||||
set_vertices (V[1],V[2],V[0]);
|
||||
set_neighbors(N[1],N[2],N[0]);
|
||||
}
|
||||
|
||||
|
||||
template < class TDS>
|
||||
inline int
|
||||
Triangulation_ds_face_base_2<TDS> ::
|
||||
dimension() const
|
||||
{
|
||||
if (V[2] != NULL) {return 2;}
|
||||
else return( V[1] != NULL ? 1 : 0);
|
||||
}
|
||||
|
||||
template < class TDS >
|
||||
inline
|
||||
std::istream&
|
||||
operator>>(std::istream &is, Triangulation_ds_face_base_2<TDS> &)
|
||||
// non combinatorial information. Default = nothing
|
||||
{
|
||||
return is;
|
||||
}
|
||||
|
||||
template < class TDS >
|
||||
inline
|
||||
std::ostream&
|
||||
operator<<(std::ostream &os, const Triangulation_ds_face_base_2<TDS> &)
|
||||
// non combinatorial information. Default = nothing
|
||||
{
|
||||
return os;
|
||||
}
|
||||
|
||||
// Specialisation for void.
|
||||
template <>
|
||||
class Triangulation_ds_face_base_2<void>
|
||||
{
|
||||
public:
|
||||
typedef Dummy_tds_2 Triangulation_data_structure;
|
||||
template <typename TDS2>
|
||||
struct Rebind_TDS { typedef Triangulation_ds_face_base_2<TDS2> Other; };
|
||||
};
|
||||
|
||||
|
||||
|
||||
CGAL_END_NAMESPACE
|
||||
|
||||
#endif //CGAL_DS_TRIANGULATION_FACE_BASE_2_H
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
// release_date :
|
||||
//
|
||||
// file : include/CGAL/Triangulation_ds_iterators_2.h
|
||||
// package : Triangulation
|
||||
// package : Triangulation_2
|
||||
// source : $RCSfile$
|
||||
// revision : $Revision$
|
||||
// revision_date : $Date$
|
||||
|
|
@ -28,65 +28,16 @@
|
|||
#include <iterator>
|
||||
#include <CGAL/triangulation_assertions.h>
|
||||
#include <CGAL/Triangulation_short_names_2.h>
|
||||
|
||||
#include <CGAL/Triangulation_iterator_adaptator.h>
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
// The iterator_base visits all the full dimensional faces
|
||||
// of the Tds
|
||||
// whatever may be the dimension of the Tds
|
||||
// The following iterator visit the 2-faces
|
||||
|
||||
template<class Tds>
|
||||
class Triangulation_ds_face_iterator_2
|
||||
: public Tds::Iterator_base
|
||||
{
|
||||
public:
|
||||
typedef typename Tds::Iterator_base Base;
|
||||
typedef typename Tds::Face_handle Face_handle;
|
||||
typedef Triangulation_ds_face_iterator_2<Tds> Face_iterator;
|
||||
|
||||
Triangulation_ds_face_iterator_2() : Base() {}
|
||||
|
||||
Triangulation_ds_face_iterator_2(const Tds * tds)
|
||||
: Base(tds->face_container().begin())
|
||||
{}
|
||||
|
||||
Triangulation_ds_face_iterator_2(const Tds* tds, int)
|
||||
: Base(tds->face_container().end())
|
||||
{}
|
||||
|
||||
operator Face_handle() const {return (*this)->handle();}
|
||||
};
|
||||
|
||||
|
||||
template < class Tds>
|
||||
class Triangulation_ds_vertex_iterator_2
|
||||
: public Tds::Vertex_container::iterator
|
||||
{
|
||||
public:
|
||||
typedef typename Tds::Vertex_container::iterator Vertex_iterator_base;
|
||||
typedef typename Tds::Vertex_handle Vertex_handle;
|
||||
typedef Triangulation_ds_vertex_iterator_2<Tds> Vertex_iterator;
|
||||
|
||||
Triangulation_ds_vertex_iterator_2() : Vertex_iterator_base() {}
|
||||
|
||||
Triangulation_ds_vertex_iterator_2(const Tds* tds)
|
||||
: Vertex_iterator_base(tds->vertex_container().begin()) {}
|
||||
|
||||
Triangulation_ds_vertex_iterator_2(const Tds* tds, int )
|
||||
: Vertex_iterator_base(tds->vertex_container().end()) {}
|
||||
|
||||
operator Vertex_handle() const {return (*this)->handle();}
|
||||
};
|
||||
|
||||
|
||||
template <class Tds>
|
||||
class Triangulation_ds_edge_iterator_2
|
||||
{
|
||||
public:
|
||||
typedef typename Tds::Edge Edge;
|
||||
typedef typename Tds::Iterator_base Iterator_base;
|
||||
typedef typename Tds::Face_iterator Face_iterator;
|
||||
typedef typename Tds::Face_handle Face_handle;
|
||||
|
||||
typedef Edge value_type;
|
||||
|
|
@ -100,7 +51,7 @@ public:
|
|||
|
||||
private:
|
||||
const Tds* _tds;
|
||||
Iterator_base pos;
|
||||
Face_iterator pos;
|
||||
mutable Edge edge;
|
||||
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -24,37 +24,29 @@
|
|||
#ifndef CGAL_TRIANGULATION_DS_VERTEX_2_H
|
||||
#define CGAL_TRIANGULATION_DS_VERTEX_2_H
|
||||
|
||||
#include <CGAL/basic.h>
|
||||
#include <CGAL/Triangulation_short_names_2.h>
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
template <class Tds>
|
||||
template <class Vb>
|
||||
class Triangulation_ds_vertex_2
|
||||
: public Tds::Vertex_base,
|
||||
public Triangulation_cw_ccw_2
|
||||
: public Vb
|
||||
{
|
||||
typedef typename Vb::Triangulation_data_structure Tds;
|
||||
public:
|
||||
typedef typename Tds::Vertex_base Vb;
|
||||
typedef typename Tds::Vertex Vertex;
|
||||
typedef typename Tds::Face Face;
|
||||
typedef typename Tds::Edge Edge;
|
||||
typedef typename Tds::Vertex_handle Vertex_handle;
|
||||
typedef typename Tds::Face_handle Face_handle;
|
||||
typedef typename Tds::Vertex_circulator Vertex_circulator;
|
||||
typedef typename Tds::Face_circulator Face_circulator;
|
||||
typedef typename Tds::Edge_circulator Edge_circulator;
|
||||
//typedef typename Vb::Point Point;
|
||||
|
||||
//CREATORS
|
||||
Triangulation_ds_vertex_2() : Vb() {}
|
||||
|
||||
//SETTING
|
||||
void set_face(Face_handle f) { Vb::set_face(&*f);}
|
||||
|
||||
//ACCESS
|
||||
//Vertex_handle handle() const {return &*this;}
|
||||
Vertex_handle handle() {return const_cast<Vertex*>(this); }
|
||||
Face_handle face() const {return static_cast<Face*>(Vb::face()) ;}
|
||||
int degree(); //should be const
|
||||
|
||||
// the following should be const
|
||||
|
|
@ -100,9 +92,9 @@ degree() //const
|
|||
|
||||
|
||||
|
||||
template <class Tds>
|
||||
template <class Vb>
|
||||
bool
|
||||
Triangulation_ds_vertex_2<Tds> ::
|
||||
Triangulation_ds_vertex_2<Vb> ::
|
||||
is_valid(bool verbose, int level)
|
||||
{
|
||||
bool result = Vb::is_valid(verbose, level);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,93 @@
|
|||
// ============================================================================
|
||||
//
|
||||
// Copyright (c) 1999,2000,2001,2002,2003 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 :
|
||||
//
|
||||
// file : Triangulation/include/CGAL/Triangulation_ds_vertex_base_2.h
|
||||
// source : $RCSfile$
|
||||
// revision : $Revision$
|
||||
// revision_date : $Date$
|
||||
// author(s) : Mariette Yvinec
|
||||
//
|
||||
// coordinator : Mariette Yvinec <Mariette Yvinec@sophia.inria.fr>
|
||||
//
|
||||
// ============================================================================
|
||||
|
||||
|
||||
#ifndef CGAL_TRIANGULATION_DS_VERTEX_BASE_2_H
|
||||
#define CGAL_TRIANGULATION_DS_VERTEX_BASE_2_H
|
||||
|
||||
#include <CGAL/basic.h>
|
||||
#include <CGAL/Triangulation_short_names_2.h>
|
||||
#include <CGAL/Dummy_tds_2.h>
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
template < class TDS = void >
|
||||
class Triangulation_ds_vertex_base_2
|
||||
{
|
||||
typedef typename TDS::Face_handle Face_handle;
|
||||
public:
|
||||
typedef TDS Triangulation_data_structure;
|
||||
|
||||
// Borland seems to require it.
|
||||
template <typename TDS2>
|
||||
struct Rebind_TDS { typedef Triangulation_ds_vertex_base_2<TDS2> Other; };
|
||||
|
||||
Triangulation_ds_vertex_base_2 () : _f(NULL) {}
|
||||
Triangulation_ds_vertex_base_2(Face_handle f) : _f(f) {}
|
||||
|
||||
Face_handle face() const { return _f;}
|
||||
void set_face(Face_handle f) { _f = f ;}
|
||||
|
||||
//the following trivial is_valid to allow
|
||||
// the user of derived face base classes
|
||||
// to add their own purpose checking
|
||||
bool is_valid(bool /*verbose*/=false, int /*level*/= 0) const
|
||||
{return face() != NULL;}
|
||||
|
||||
private:
|
||||
Face_handle _f;
|
||||
// FIXME : temporary cruft needed for DS_Container (sizeof() too small) :
|
||||
int i;
|
||||
};
|
||||
|
||||
// Specialization for void.
|
||||
template <>
|
||||
class Triangulation_ds_vertex_base_2<void>
|
||||
{
|
||||
public:
|
||||
typedef Dummy_tds_2 Triangulation_data_structure;
|
||||
template <typename TDS2>
|
||||
struct Rebind_TDS { typedef Triangulation_ds_vertex_base_2<TDS2> Other; };
|
||||
};
|
||||
|
||||
|
||||
template < class TDS >
|
||||
inline
|
||||
std::istream&
|
||||
operator>>(std::istream &is, Triangulation_ds_vertex_base_2<TDS> &)
|
||||
// no combinatorial information.
|
||||
{
|
||||
return is;
|
||||
}
|
||||
|
||||
template < class TDS >
|
||||
inline
|
||||
std::ostream&
|
||||
operator<<(std::ostream &os, const Triangulation_ds_vertex_base_2<TDS> &)
|
||||
// no combinatorial information.
|
||||
{
|
||||
return os;
|
||||
}
|
||||
CGAL_END_NAMESPACE
|
||||
|
||||
#endif //CGAL_TRIANGULATION_DS_VERTEX_BASE_2_H
|
||||
|
|
@ -1,304 +0,0 @@
|
|||
// ============================================================================
|
||||
//
|
||||
// Copyright (c) 1997 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 :
|
||||
//
|
||||
// file : Triangulation_face_base_2.h
|
||||
// source : $RCSfile$
|
||||
// revision : $Revision$
|
||||
// revision_date : $Date$
|
||||
// author(s) : Mariette Yvinec
|
||||
//
|
||||
// coordinator : Mariette Yvinec <Mariette Yvinec@sophia.inria.fr>
|
||||
//
|
||||
// ============================================================================
|
||||
|
||||
#ifndef CGAL_TRIANGULATION_FACE_BASE_2_H
|
||||
#define CGAL_TRIANGULATION_FACE_BASE_2_H
|
||||
|
||||
|
||||
#include <CGAL/triangulation_assertions.h>
|
||||
#include <CGAL/Triangulation_short_names_2.h>
|
||||
#include <CGAL/Triangulation_utils_2.h>
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
template < class Gt >
|
||||
class Triangulation_face_base_2
|
||||
{
|
||||
public:
|
||||
typedef Triangulation_face_base_2 Face_base;
|
||||
|
||||
private:
|
||||
void* V[3];
|
||||
void* N[3];
|
||||
|
||||
public:
|
||||
Triangulation_face_base_2();
|
||||
Triangulation_face_base_2(void* v0, void* v1, void* v2);
|
||||
Triangulation_face_base_2(void* v0, void* v1, void* v2,
|
||||
void* n0, void* n1, void* n2);
|
||||
|
||||
void* vertex(int i) const;
|
||||
bool has_vertex(const void* v) const;
|
||||
bool has_vertex(const void* v, int& i) const ;
|
||||
int vertex_index(const void* v) const ;
|
||||
|
||||
void* neighbor(int i) const ;
|
||||
bool has_neighbor(const void* n) const;
|
||||
bool has_neighbor(const void* n, int& i) const;
|
||||
int face_index(const void* n) const;
|
||||
|
||||
void set_vertex(int i, void* v);
|
||||
void set_vertices();
|
||||
void set_vertices(void* v0, void* v1, void* v2);
|
||||
void set_neighbor(int i, void* n) ;
|
||||
void set_neighbors();
|
||||
void set_neighbors(void* n0, void* n1, void* n2);
|
||||
void reorient();
|
||||
void ccw_permute();
|
||||
void cw_permute();
|
||||
|
||||
int dimension() const;
|
||||
//the following trivial is_valid to allow
|
||||
// the user of derived face base classes
|
||||
// to add their own purpose checking
|
||||
bool is_valid(bool /* verbose */ = false, int /* level */ = 0) const
|
||||
{return true;}
|
||||
|
||||
|
||||
};
|
||||
|
||||
template <class Gt>
|
||||
Triangulation_face_base_2<Gt> ::
|
||||
Triangulation_face_base_2()
|
||||
{
|
||||
set_vertices();
|
||||
set_neighbors();
|
||||
}
|
||||
|
||||
template <class Gt>
|
||||
Triangulation_face_base_2<Gt> ::
|
||||
Triangulation_face_base_2( void* v0, void* v1, void* v2)
|
||||
{
|
||||
set_vertices(v0, v1, v2);
|
||||
set_neighbors();
|
||||
}
|
||||
|
||||
template <class Gt>
|
||||
Triangulation_face_base_2<Gt> ::
|
||||
Triangulation_face_base_2(void* v0, void* v1, void* v2,
|
||||
void* n0, void* n1, void* n2)
|
||||
{
|
||||
set_vertices(v0, v1, v2);
|
||||
set_neighbors(n0, n1, n2);
|
||||
}
|
||||
|
||||
|
||||
template <class Gt>
|
||||
inline void*
|
||||
Triangulation_face_base_2<Gt> ::
|
||||
vertex(int i) const
|
||||
{
|
||||
CGAL_triangulation_precondition( i == 0 || i == 1 || i == 2);
|
||||
return V[i];
|
||||
}
|
||||
|
||||
|
||||
template <class Gt>
|
||||
inline bool
|
||||
Triangulation_face_base_2<Gt> ::
|
||||
has_vertex(const void* v) const
|
||||
{
|
||||
return (V[0] == v) || (V[1] == v) || (V[2]== v);
|
||||
}
|
||||
|
||||
template <class Gt>
|
||||
inline bool
|
||||
Triangulation_face_base_2<Gt> ::
|
||||
has_vertex(const void* v, int& i) const
|
||||
{
|
||||
if (v == V[0]) {
|
||||
i = 0;
|
||||
return true;
|
||||
}
|
||||
if (v == V[1]) {
|
||||
i = 1;
|
||||
return true;
|
||||
}
|
||||
if (v == V[2]) {
|
||||
i = 2;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
template <class Gt>
|
||||
inline int
|
||||
Triangulation_face_base_2<Gt> ::
|
||||
vertex_index(const void* v) const
|
||||
{
|
||||
if (v == V[0]) return 0;
|
||||
if (v == V[1]) return 1;
|
||||
CGAL_triangulation_assertion( v == V[2] );
|
||||
return 2;
|
||||
}
|
||||
|
||||
template <class Gt>
|
||||
inline void*
|
||||
Triangulation_face_base_2<Gt> ::
|
||||
neighbor(int i) const
|
||||
{
|
||||
CGAL_triangulation_precondition( i == 0 || i == 1 || i == 2);
|
||||
return N[i];
|
||||
}
|
||||
|
||||
template <class Gt>
|
||||
inline bool
|
||||
Triangulation_face_base_2<Gt> ::
|
||||
has_neighbor(const void* n) const
|
||||
{
|
||||
return (N[0] == n) || (N[1] == n) || (N[2] == n);
|
||||
}
|
||||
|
||||
|
||||
template <class Gt>
|
||||
inline bool
|
||||
Triangulation_face_base_2<Gt> ::
|
||||
has_neighbor(const void* n, int& i) const
|
||||
{
|
||||
if(n == N[0]){
|
||||
i = 0;
|
||||
return true;
|
||||
}
|
||||
if(n == N[1]){
|
||||
i = 1;
|
||||
return true;
|
||||
}
|
||||
if(n == N[2]){
|
||||
i = 2;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
template <class Gt>
|
||||
inline int
|
||||
Triangulation_face_base_2<Gt> ::
|
||||
face_index(const void* n) const
|
||||
{
|
||||
if (n == N[0]) return 0;
|
||||
if (n == N[1]) return 1;
|
||||
CGAL_triangulation_assertion( n == N[2] );
|
||||
return 2;
|
||||
}
|
||||
|
||||
template <class Gt>
|
||||
inline void
|
||||
Triangulation_face_base_2<Gt> ::
|
||||
set_vertex(int i, void* v)
|
||||
{
|
||||
CGAL_triangulation_precondition( i == 0 || i == 1 || i == 2);
|
||||
V[i] = v;
|
||||
}
|
||||
|
||||
template <class Gt>
|
||||
inline void
|
||||
Triangulation_face_base_2<Gt> ::
|
||||
set_neighbor(int i, void* n)
|
||||
{
|
||||
CGAL_triangulation_precondition( i == 0 || i == 1 || i == 2);
|
||||
N[i] = n;
|
||||
}
|
||||
|
||||
template <class Gt>
|
||||
inline void
|
||||
Triangulation_face_base_2<Gt> ::
|
||||
set_vertices()
|
||||
{
|
||||
V[0] = V[1] = V[2] = NULL;
|
||||
}
|
||||
|
||||
template <class Gt>
|
||||
inline void
|
||||
Triangulation_face_base_2<Gt> ::
|
||||
set_vertices(void* v0, void* v1, void* v2)
|
||||
{
|
||||
V[0] = v0;
|
||||
V[1] = v1;
|
||||
V[2] = v2;
|
||||
}
|
||||
|
||||
template <class Gt>
|
||||
inline void
|
||||
Triangulation_face_base_2<Gt> ::
|
||||
set_neighbors()
|
||||
{
|
||||
N[0] = N[1] = N[2] = NULL;
|
||||
}
|
||||
|
||||
template <class Gt>
|
||||
inline void
|
||||
Triangulation_face_base_2<Gt> ::
|
||||
set_neighbors(void* n0,void* n1, void* n2)
|
||||
{
|
||||
N[0] = n0;
|
||||
N[1] = n1;
|
||||
N[2] = n2;
|
||||
}
|
||||
|
||||
template <class Gt>
|
||||
void
|
||||
Triangulation_face_base_2<Gt> ::
|
||||
reorient()
|
||||
{
|
||||
//exchange the vertices 0 and 1
|
||||
set_vertices (V[1],V[0],V[2]);
|
||||
set_neighbors(N[1],N[0],N[2]);
|
||||
}
|
||||
|
||||
template <class Gt>
|
||||
inline void
|
||||
Triangulation_face_base_2<Gt> ::
|
||||
ccw_permute()
|
||||
{
|
||||
set_vertices (V[2],V[0],V[1]);
|
||||
set_neighbors(N[2],N[0],N[1]);
|
||||
}
|
||||
|
||||
|
||||
template <class Gt>
|
||||
inline void
|
||||
Triangulation_face_base_2<Gt> ::
|
||||
cw_permute()
|
||||
{
|
||||
set_vertices (V[1],V[2],V[0]);
|
||||
set_neighbors(N[1],N[2],N[0]);
|
||||
}
|
||||
|
||||
|
||||
template < class Gt>
|
||||
inline int
|
||||
Triangulation_face_base_2<Gt> ::
|
||||
dimension() const
|
||||
{
|
||||
if (V[2] != NULL) {return 2;}
|
||||
else return( V[1] != NULL ? 1 : 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
CGAL_END_NAMESPACE
|
||||
|
||||
#endif //CGAL_TRIANGULATION_FACE_BASE_2_H
|
||||
|
|
@ -12,10 +12,11 @@
|
|||
// release_date :
|
||||
//
|
||||
// file : include/CGAL/Triangulation_hierarchy_2.h
|
||||
// revision :
|
||||
// revision_date :
|
||||
// package : Triangulation
|
||||
// revision : $Revision$
|
||||
// revision_date : $Date$
|
||||
// package : Triangulation_2
|
||||
// author(s) : Olivier Devillers <Olivivier.Devillers@sophia.inria.fr>
|
||||
// Mariette Yvinec <Mariette.Yvinec@sophia.inria.fr>
|
||||
//
|
||||
// coordinator : INRIA Sophia-Antipolis (<Mariette.Yvinec@sophia.inria.fr>)
|
||||
//
|
||||
|
|
@ -24,46 +25,17 @@
|
|||
#ifndef CGAL_TRIANGULATION_HIERARCHY_2_H
|
||||
#define CGAL_TRIANGULATION_HIERARCHY_2_H
|
||||
|
||||
#include <CGAL/basic.h>
|
||||
#include <CGAL/Triangulation_short_names_3.h>
|
||||
#include <CGAL/Random.h>
|
||||
#include <CGAL/Triangulation_hierarchy_vertex_base_2.h>
|
||||
#include <map>
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
template < class Vbb>
|
||||
class Triangulation_hierarchy_vertex_base_2
|
||||
: public Vbb
|
||||
{
|
||||
public:
|
||||
typedef Vbb V_Base;
|
||||
typedef typename V_Base::Point Point;
|
||||
|
||||
|
||||
Triangulation_hierarchy_vertex_base_2()
|
||||
: V_Base(), _up(0), _down(0)
|
||||
{}
|
||||
Triangulation_hierarchy_vertex_base_2(const Point & p, void* f)
|
||||
: V_Base(p,f), _up(0), _down(0)
|
||||
{}
|
||||
Triangulation_hierarchy_vertex_base_2(const Point & p)
|
||||
: V_Base(p), _up(0), _down(0)
|
||||
{}
|
||||
|
||||
public: // for use in Triangulation_hierarchy only
|
||||
// friend class Triangulation_hierarchy_2;
|
||||
void* up() {return _up;}
|
||||
void* down() {return _down;}
|
||||
void set_up(void *u) {_up=u;}
|
||||
void set_down(void *d) {if (this) _down=d;}
|
||||
|
||||
|
||||
private:
|
||||
void* _up; // same vertex one level above
|
||||
void* _down; // same vertex one level below
|
||||
};
|
||||
|
||||
// parameterization of the hierarchy
|
||||
//const float Triangulation_hierarchy_2__ratio = 30.0;
|
||||
const int Triangulation_hierarchy_2__ratio = 30;
|
||||
const int Triangulation_hierarchy_2__ratio = 30;
|
||||
const int Triangulation_hierarchy_2__minsize = 20;
|
||||
const int Triangulation_hierarchy_2__maxlevel = 5;
|
||||
// maximal number of points is 30^5 = 24 millions !
|
||||
|
|
@ -78,9 +50,10 @@ class Triangulation_hierarchy_2
|
|||
typedef typename Tr_Base::Point Point;
|
||||
typedef typename Tr_Base::Vertex_handle Vertex_handle;
|
||||
typedef typename Tr_Base::Face_handle Face_handle;
|
||||
typedef typename Tr_Base::Vertex_iterator Vertex_iterator;
|
||||
typedef typename Tr_Base::Vertex Vertex;
|
||||
typedef typename Tr_Base::Locate_type Locate_type;
|
||||
typedef typename Tr_Base::Finite_vertices_iterator Finite_vertices_iterator;
|
||||
//typedef typename Tr_Base::Finite_faces_iterator Finite_faces_iterator;
|
||||
|
||||
private:
|
||||
// here is the stack of triangulations which form the hierarchy
|
||||
|
|
@ -138,9 +111,10 @@ public:
|
|||
|
||||
private:
|
||||
void locate_in_all(const Point& p,
|
||||
Locate_type& lt,
|
||||
int& li,
|
||||
Face_handle pos[Triangulation_hierarchy_2__maxlevel]) const;
|
||||
Locate_type& lt,
|
||||
int& li,
|
||||
Face_handle
|
||||
pos[Triangulation_hierarchy_2__maxlevel]) const;
|
||||
int random_level();
|
||||
};
|
||||
|
||||
|
|
@ -187,7 +161,7 @@ void
|
|||
Triangulation_hierarchy_2<Tr>::
|
||||
copy_triangulation(const Triangulation_hierarchy_2<Tr> &tr)
|
||||
{
|
||||
std::map< const void*, void*, std::less<const void*> > V;
|
||||
std::map<Vertex_handle, Vertex_handle > V;
|
||||
{
|
||||
for(int i=0;i<Triangulation_hierarchy_2__maxlevel;++i)
|
||||
hierarchy[i]->copy_triangulation(*tr.hierarchy[i]);
|
||||
|
|
@ -195,21 +169,21 @@ copy_triangulation(const Triangulation_hierarchy_2<Tr> &tr)
|
|||
//up and down have been copied in straightforward way
|
||||
// compute a map at lower level
|
||||
{
|
||||
for( Vertex_iterator it=hierarchy[0]->vertices_begin();
|
||||
it != hierarchy[0]->vertices_end(); ++it) {
|
||||
if (it->up()) V[ ((Vertex*)(it->up()))->down() ] = &(*it);
|
||||
for( Finite_vertices_iterator it=hierarchy[0]->finite_vertices_begin();
|
||||
it != hierarchy[0]->finite_vertices_end(); ++it) {
|
||||
if (it->up() != NULL) V[ it->up()->down() ] = it;
|
||||
}
|
||||
}
|
||||
{
|
||||
for(int i=1;i<Triangulation_hierarchy_2__maxlevel;++i) {
|
||||
for( Vertex_iterator it=hierarchy[i]->vertices_begin();
|
||||
it != hierarchy[i]->vertices_end(); ++it) {
|
||||
for( Finite_vertices_iterator it=hierarchy[i]->finite_vertices_begin();
|
||||
it != hierarchy[i]->finite_vertices_end(); ++it) {
|
||||
// down pointer goes in original instead in copied triangulation
|
||||
it->set_down(V[it->down()]);
|
||||
// make reverse link
|
||||
((Vertex*)(it->down()))->set_up( &(*it) );
|
||||
it->down()->set_up(it);
|
||||
// make map for next level
|
||||
if (it->up()) V[ ((Vertex*)(it->up()))->down() ] = &(*it);
|
||||
if (it->up()!= NULL ) V[ it->up()->down() ] = it;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -220,9 +194,6 @@ void
|
|||
Triangulation_hierarchy_2<Tr>::
|
||||
swap(Triangulation_hierarchy_2<Tr> &tr)
|
||||
{
|
||||
// Tr_Base** h= hierarchy;
|
||||
// hierarchy = tr.hierarchy;
|
||||
// tr.hierarchy = h;
|
||||
Tr_Base* temp;
|
||||
Tr_Base::swap(tr);
|
||||
for(int i= 1; i<Triangulation_hierarchy_2__maxlevel; ++i){
|
||||
|
|
@ -259,20 +230,26 @@ is_valid(bool verbose, int level) const
|
|||
{
|
||||
bool result = true;
|
||||
int i;
|
||||
Vertex_iterator it;
|
||||
Finite_vertices_iterator it;
|
||||
//verify correctness of triangulation at all levels
|
||||
for(i=0;i<Triangulation_hierarchy_2__maxlevel;++i)
|
||||
result = result && hierarchy[i]->is_valid(verbose,level);
|
||||
//verify that lower level has no down pointers
|
||||
for( it = hierarchy[0]->vertices_begin();
|
||||
it != hierarchy[0]->vertices_end(); ++it)
|
||||
result = result && ( it->down() == 0 );
|
||||
//verify that other levels has down pointer and reciprocal link is fine
|
||||
for( it = hierarchy[0]->finite_vertices_begin();
|
||||
it != hierarchy[0]->finite_vertices_end(); ++it)
|
||||
result = result && ( it->down() == NULL );
|
||||
//verify that other levels have down pointer and reciprocal link is fine
|
||||
for(i=1;i<Triangulation_hierarchy_2__maxlevel;++i)
|
||||
for( it = hierarchy[i]->vertices_begin();
|
||||
it != hierarchy[i]->vertices_end(); ++it)
|
||||
for( it = hierarchy[i]->finite_vertices_begin();
|
||||
it != hierarchy[i]->finite_vertices_end(); ++it)
|
||||
result = result &&
|
||||
( ((Vertex*)((Vertex*)it->down())->up()) == &(*it) );
|
||||
( &*(it->down()->up()) == &*(it) );
|
||||
//verify that levels have up pointer and reciprocal link is fine
|
||||
for(i=0;i<Triangulation_hierarchy_2__maxlevel-1;++i)
|
||||
for( it = hierarchy[i]->finite_vertices_begin();
|
||||
it != hierarchy[i]->finite_vertices_end(); ++it)
|
||||
result = result && ( it->up() == NULL ||
|
||||
&*it == &*(it->up())->down() );
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
@ -296,8 +273,8 @@ insert(const Point &p, Face_handle)
|
|||
int level = 1;
|
||||
while (level <= vertex_level ){
|
||||
vertex=hierarchy[level]->Tr_Base::insert(p,positions[level]);
|
||||
vertex->set_down((void *) &*previous);// link with level above
|
||||
previous->set_up((void *) &*vertex);
|
||||
vertex->set_down(previous);// link with level above
|
||||
previous->set_up(vertex);
|
||||
previous=vertex;
|
||||
level++;
|
||||
}
|
||||
|
|
@ -328,8 +305,8 @@ insert(const Point& p,
|
|||
int level = 1;
|
||||
while (level <= vertex_level ){
|
||||
vertex=hierarchy[level]->Tr_Base::insert(p,positions[level]);
|
||||
vertex->set_down((void *) &*previous);// link with level above
|
||||
previous->set_up((void *) &*vertex);
|
||||
vertex->set_down(previous);// link with level above
|
||||
previous->set_up(vertex);
|
||||
previous=vertex;
|
||||
level++;
|
||||
}
|
||||
|
|
@ -352,13 +329,13 @@ void
|
|||
Triangulation_hierarchy_2<Tr>::
|
||||
remove(Vertex_handle v )
|
||||
{
|
||||
void * u=v->up();
|
||||
Vertex_handle u=v->up();
|
||||
int l = 0 ;
|
||||
while(1){
|
||||
hierarchy[l++]->remove(v);
|
||||
if (!u) break;
|
||||
if (u == NULL) break;
|
||||
if(l>Triangulation_hierarchy_2__maxlevel) break;
|
||||
v=(Vertex*)u; u=v->up();
|
||||
v=u; u=v->up();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -446,10 +423,10 @@ locate_in_all(const Point& p,
|
|||
if ( ! hierarchy[level]->is_infinite(position->vertex(2)))
|
||||
if ( closer( p,
|
||||
position->vertex(2)->point(),
|
||||
nearest->point()) == SMALLER)
|
||||
nearest->point()) == SMALLER )
|
||||
nearest = position->vertex(2);
|
||||
// go at the same vertex on level below
|
||||
nearest = (Vertex*)( nearest->down() );
|
||||
nearest = nearest->down();
|
||||
position = nearest->face(); // incident face
|
||||
--level;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,75 @@
|
|||
// ============================================================================
|
||||
//
|
||||
// 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 :
|
||||
//
|
||||
// file : include/CGAL/Triangulation_hierarchy_vertex_base_2.h
|
||||
// revision : $Revision$
|
||||
// revision_date : $Date$
|
||||
// package : Triangulation_2
|
||||
// author(s) : Olivier Devillers <Olivivier.Devillers@sophia.inria.fr>
|
||||
// Mariette Yvinec <Mariette.Yvinec@sophia.inria.fr>
|
||||
//
|
||||
// coordinator : INRIA Sophia-Antipolis (<Mariette.Yvinec@sophia.inria.fr>)
|
||||
//
|
||||
// ============================================================================
|
||||
|
||||
#ifndef CGAL_TRIANGULATION_HIERARCHY_VERTEX_BASE_2_H
|
||||
#define CGAL_TRIANGULATION_HIERARCHY_VERTEX_BASE_2_H
|
||||
|
||||
#include <CGAL/basic.h>
|
||||
#include <CGAL/Triangulation_short_names_3.h>
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
template < class Vbb>
|
||||
class Triangulation_hierarchy_vertex_base_2
|
||||
: public Vbb
|
||||
{
|
||||
typedef Vbb Base;
|
||||
typedef typename Base::Triangulation_data_structure Tds;
|
||||
|
||||
public:
|
||||
typedef typename Base::Point Point;
|
||||
typedef Tds Triangulation_data_structure;
|
||||
typedef typename Tds::Vertex_handle Vertex_handle;
|
||||
typedef typename Tds::Face_handle Face_handle;
|
||||
|
||||
template < typename TDS2 >
|
||||
struct Rebind_TDS {
|
||||
typedef typename Vbb::template Rebind_TDS<TDS2>::Other Vb2;
|
||||
typedef Triangulation_hierarchy_vertex_base_2<Vb2> Other;
|
||||
};
|
||||
|
||||
Triangulation_hierarchy_vertex_base_2()
|
||||
: Base(), _up(0), _down(0)
|
||||
{}
|
||||
Triangulation_hierarchy_vertex_base_2(const Point & p, Face_handle f)
|
||||
: Base(p,f), _up(0), _down(0)
|
||||
{}
|
||||
Triangulation_hierarchy_vertex_base_2(const Point & p)
|
||||
: Base(p), _up(0), _down(0)
|
||||
{}
|
||||
|
||||
Vertex_handle up() {return _up;}
|
||||
Vertex_handle down() {return _down;}
|
||||
void set_up(Vertex_handle u) {_up=u;}
|
||||
void set_down(Vertex_handle d) {if (this) _down=d;}
|
||||
|
||||
|
||||
private:
|
||||
Vertex_handle _up; // same vertex one level above
|
||||
Vertex_handle _down; // same vertex one level below
|
||||
};
|
||||
|
||||
CGAL_END_NAMESPACE
|
||||
|
||||
#endif // CGAL_TRIANGULATION_HIERARCHY_VERTEX_BASE_2_H
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
// ======================================================================
|
||||
//
|
||||
// Copyright (c) 1997 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 :
|
||||
//
|
||||
// file : include/CGAL/Triangulation_iterator_adaptator.h
|
||||
// package : Triangulation_2
|
||||
// source : $RCSfile$
|
||||
// revision : $Revision$
|
||||
// revision_date : $Date$
|
||||
// author(s) : Mariette Yvinec
|
||||
//
|
||||
// coordinator : Mariette Yvinec <Mariette Yvinec@sophia.inria.fr>
|
||||
//
|
||||
// ======================================================================
|
||||
|
||||
#ifndef CGAL_TRIANGULATION_ITERATOR_ADAPTATOR_H
|
||||
#define CGAL_TRIANGULATION_ITERATOR_ADAPTATOR_H
|
||||
|
||||
#include <CGAL/triangulation_assertions.h>
|
||||
#include <CGAL/Triangulation_short_names_2.h>
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
template <class Base, class Handle>
|
||||
struct Triangulation_iterator_handle_adaptor
|
||||
: public Base
|
||||
{
|
||||
typedef Triangulation_iterator_handle_adaptor<Base, Handle> Self;
|
||||
Triangulation_iterator_handle_adaptor() : Base() {}
|
||||
|
||||
Triangulation_iterator_handle_adaptor(const Base & b)
|
||||
: Base(b) {}
|
||||
|
||||
operator Handle() const {return (*this)->handle();}
|
||||
Self& operator++() { Base::operator++(); return *this;}
|
||||
Self& operator--() { Base::operator--(); return *this;}
|
||||
Self operator++(int) { Self tmp(*this); ++(*this); return tmp; }
|
||||
Self operator--(int) { Self tmp(*this); --(*this); return tmp; }
|
||||
};
|
||||
|
||||
|
||||
|
||||
CGAL_END_NAMESPACE
|
||||
|
||||
#endif //CGAL_TRIANGULATION_ITERATOR_ADAPTATOR_H
|
||||
|
|
@ -1,107 +0,0 @@
|
|||
// ============================================================================
|
||||
//
|
||||
// Copyright (c) 1997 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 :
|
||||
//
|
||||
// file : Triangulation/include/CGAL/Triangulation_iterators_2.h
|
||||
// source : $RCSfile$
|
||||
// revision : $Revision$
|
||||
// revision_date : $Date$
|
||||
// author(s) : Mariette Yvinec
|
||||
//
|
||||
// coordinator : Mariette Yvinec <Mariette Yvinec@sophia.inria.fr>
|
||||
//
|
||||
// ============================================================================
|
||||
|
||||
#ifndef CGAL_TRIANGULATION_ITERATORS_2_H
|
||||
#define CGAL_TRIANGULATION_ITERATORS_2_H
|
||||
|
||||
#include <utility>
|
||||
#include <iterator>
|
||||
#include <CGAL/triangulation_assertions.h>
|
||||
#include <CGAL/Triangulation_short_names_2.h>
|
||||
#include <CGAL/Triangulation_utils_2.h>
|
||||
#include <CGAL/Triangulation_ds_iterators_2.h>
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
template < class Triangulation>
|
||||
class Triangulation_finite_faces_iterator_2
|
||||
: public Filter_iterator< typename Triangulation::All_faces_iterator,
|
||||
typename Triangulation::Infinite_tester >
|
||||
{
|
||||
public:
|
||||
typedef typename Triangulation::All_faces_iterator All_faces_iterator;
|
||||
typedef typename Triangulation::Infinite_tester Infinite_tester;
|
||||
typedef Filter_iterator<All_faces_iterator,Infinite_tester> Base;
|
||||
typedef Triangulation_finite_faces_iterator_2<Triangulation> Self;
|
||||
typedef typename Triangulation::Face_handle Face_handle;
|
||||
|
||||
Triangulation_finite_faces_iterator_2() : Base() {}
|
||||
|
||||
Triangulation_finite_faces_iterator_2(const Triangulation* tr)
|
||||
: Base( filter_iterator(tr->all_faces_begin(),
|
||||
tr->all_faces_end(),
|
||||
tr->infinite_tester())) {}
|
||||
|
||||
Triangulation_finite_faces_iterator_2(const Triangulation* tr, int)
|
||||
: Base( filter_iterator(tr->all_faces_begin(),
|
||||
tr->all_faces_end(),
|
||||
tr->infinite_tester(),
|
||||
tr->all_faces_end())) {}
|
||||
|
||||
operator Face_handle() const {return (*this)->handle();}
|
||||
Self& operator++() { Base::operator++(); return *this;}
|
||||
Self& operator--() { Base::operator--(); return *this; }
|
||||
Self operator++(int) { Self tmp(*this); ++(*this); return tmp; }
|
||||
Self operator--(int) { Self tmp(*this); --(*this); return tmp; }
|
||||
};
|
||||
|
||||
|
||||
template < class Triangulation>
|
||||
class Triangulation_finite_vertices_iterator_2
|
||||
: public Filter_iterator< typename Triangulation::All_vertices_iterator,
|
||||
typename Triangulation::Infinite_tester >
|
||||
{
|
||||
public:
|
||||
typedef typename Triangulation::All_vertices_iterator All_vertices_iterator;
|
||||
typedef typename Triangulation::Infinite_tester Infinite_tester;
|
||||
typedef Filter_iterator<All_vertices_iterator,Infinite_tester> Base;
|
||||
typedef Triangulation_finite_vertices_iterator_2<Triangulation> Self;
|
||||
typedef typename Triangulation::Vertex_handle Vertex_handle;
|
||||
|
||||
Triangulation_finite_vertices_iterator_2() : Base() {}
|
||||
|
||||
Triangulation_finite_vertices_iterator_2(const Triangulation *tr)
|
||||
: Base( filter_iterator(tr->all_vertices_begin(),
|
||||
tr->all_vertices_end(),
|
||||
tr->infinite_tester())) {}
|
||||
|
||||
Triangulation_finite_vertices_iterator_2(const Triangulation *tr, int )
|
||||
: Base( filter_iterator(tr->all_vertices_begin(),
|
||||
tr->all_vertices_end(),
|
||||
tr->infinite_tester(),
|
||||
tr->all_vertices_end())) {}
|
||||
|
||||
operator Vertex_handle() const {return (*this)->handle();}
|
||||
Self& operator++() { Base::operator++(); return *this;}
|
||||
Self& operator--() { Base::operator--(); return *this;}
|
||||
Self operator++(int) { Self tmp(*this); ++(*this); return tmp; }
|
||||
Self operator--(int) { Self tmp(*this); --(*this); return tmp; }
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
CGAL_END_NAMESPACE
|
||||
|
||||
|
||||
#endif //CGAL_TRIANGULATION_ITERATORS_2_H
|
||||
|
|
@ -27,9 +27,7 @@
|
|||
|
||||
//Define shorter names to please linker (g++/egcs)
|
||||
|
||||
// for backward compatibilite
|
||||
#define Triangulation_default_data_structure_2 TDDS
|
||||
#define Triangulation_data_structure_using_list_2 TDSUL
|
||||
|
||||
#define Triangulation_data_structure_2 TDS
|
||||
#define Triangulation_vertex_base_2 Tvb
|
||||
#define Triangulation_face_base_2 Tfb
|
||||
|
|
@ -40,8 +38,8 @@
|
|||
|
||||
#define Triangulation_ds_vertex_2 Tdsv
|
||||
#define Triangulation_ds_face_2 Tdsf
|
||||
#define Triangulation_dsul_vertex_2 Tdsulv
|
||||
#define Triangulation_dsul_face_2 Tdsulf
|
||||
#define Triangulation_ds_face_base_2 Tdsfb
|
||||
#define Triangulation_ds_vertex_base_2 Tdsvb
|
||||
#define Triangulation_vertex_2 Tv
|
||||
#define Triangulation_face_2 Tf
|
||||
#define Triangulation_vertex_handle_2 Tvh
|
||||
|
|
|
|||
|
|
@ -25,48 +25,74 @@
|
|||
#ifndef CGAL_TRIANGULATION_VERTEX_BASE_2_H
|
||||
#define CGAL_TRIANGULATION_VERTEX_BASE_2_H
|
||||
|
||||
#include <CGAL/basic.h>
|
||||
#include <CGAL/Triangulation_short_names_2.h>
|
||||
#include <CGAL/Triangulation_ds_vertex_base_2.h>
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
template < class GT >
|
||||
class Triangulation_vertex_base_2 {
|
||||
template < typename GT,
|
||||
typename Vb = Triangulation_ds_vertex_base_2<> >
|
||||
class Triangulation_vertex_base_2
|
||||
: public Vb
|
||||
|
||||
{
|
||||
typedef typename Vb::Triangulation_data_structure Tds;
|
||||
public:
|
||||
typedef GT Geom_traits;
|
||||
typedef typename GT::Point_2 Point;
|
||||
typedef Tds Triangulation_data_structure;
|
||||
typedef typename Tds::Face_handle Face_handle;
|
||||
typedef typename Tds::Vertex_handle Vertex_handle;
|
||||
|
||||
template < typename TDS2 >
|
||||
struct Rebind_TDS {
|
||||
typedef typename Vb::template Rebind_TDS<TDS2>::Other Vb2;
|
||||
typedef Triangulation_vertex_base_2<GT, Vb2> Other;
|
||||
};
|
||||
|
||||
private:
|
||||
Point _p;
|
||||
|
||||
public:
|
||||
typedef typename GT::Point_2 Point;
|
||||
|
||||
Triangulation_vertex_base_2 ()
|
||||
: _p(Point()), _f(NULL)
|
||||
{}
|
||||
|
||||
Triangulation_vertex_base_2(const Point & p, void * f = NULL)
|
||||
: _p(p), _f(f)
|
||||
{}
|
||||
Triangulation_vertex_base_2 () : Vb() {}
|
||||
Triangulation_vertex_base_2(const Point & p) : Vb(), _p(p) {}
|
||||
Triangulation_vertex_base_2(const Point & p, Face_handle f)
|
||||
: Vb(f), _p(p) {}
|
||||
|
||||
void set_point(const Point & p) { _p = p; }
|
||||
void set_face(void* f) { _f = f ;}
|
||||
|
||||
const Point& point() const { return _p; }
|
||||
void* face() const { return _f;}
|
||||
|
||||
|
||||
// the non const version of point() is undocument
|
||||
// but needed to make the point iterator works
|
||||
// using Lutz projection scheme
|
||||
Point& point() { return _p; }
|
||||
|
||||
|
||||
//the following trivial is_valid to allow
|
||||
// the user of derived face base classes
|
||||
// to add their own purpose checking
|
||||
bool is_valid(bool /* verbose */ = false, int /* level */ = 0) const
|
||||
{return true;}
|
||||
|
||||
private:
|
||||
Point _p;
|
||||
void * _f;
|
||||
|
||||
};
|
||||
|
||||
template < class GT, class Vb >
|
||||
std::istream&
|
||||
operator>>(std::istream &is, Triangulation_vertex_base_2<GT, Vb> &v)
|
||||
// non combinatorial information. Default = point
|
||||
{
|
||||
return is >> static_cast<Vb&>(v) >> v.point();
|
||||
}
|
||||
|
||||
template < class GT, class Vb >
|
||||
std::ostream&
|
||||
operator<<(std::ostream &os, const Triangulation_vertex_base_2<GT, Vb> &v)
|
||||
// non combinatorial information. Default = point
|
||||
{
|
||||
return os << static_cast<const Vb&>(v) << v.point();
|
||||
}
|
||||
|
||||
|
||||
|
||||
CGAL_END_NAMESPACE
|
||||
|
||||
#endif //CGAL_TRIANGULATION_VERTEX_BASE_2_H
|
||||
|
|
|
|||
|
|
@ -539,6 +539,7 @@ _test_cls_reg_triangulation_2( const Triangulation & )
|
|||
fc2 = TT.line_walk(Bare_point(0,0),Bare_point(1,1),loc);
|
||||
if (fc != fc2)
|
||||
{
|
||||
TT.show_all();
|
||||
TT.show_face(loc);
|
||||
TT.show_face(fc);
|
||||
TT.show_face(fc2);
|
||||
|
|
|
|||
|
|
@ -29,9 +29,9 @@
|
|||
|
||||
|
||||
|
||||
template <class Tds, class Gt>
|
||||
template <class Tds>
|
||||
void
|
||||
_test_cls_tds_2( const Tds &, const Gt &)
|
||||
_test_cls_tds_2( const Tds &)
|
||||
{
|
||||
|
||||
typedef typename Tds::Vertex Vertex;
|
||||
|
|
@ -48,11 +48,10 @@ _test_cls_tds_2( const Tds &, const Gt &)
|
|||
typedef typename Tds::Face_circulator Face_circulator;
|
||||
typedef typename Tds::Edge_circulator Edge_circulator;
|
||||
|
||||
typedef typename Gt::Point_2 Point;
|
||||
|
||||
|
||||
// Test subclasses
|
||||
CGAL::_test_cls_tds_vertex( Vertex(), Gt() );
|
||||
CGAL::_test_cls_tds_face( Face(), Gt() );
|
||||
CGAL::_test_cls_tds_vertex( Vertex());
|
||||
CGAL::_test_cls_tds_face( Face());
|
||||
|
||||
// Test constructors
|
||||
std::cout << " constructors" << std::endl;
|
||||
|
|
@ -116,33 +115,21 @@ _test_cls_tds_2( const Tds &, const Gt &)
|
|||
Vertex_handle w4 = tds4.insert_first();
|
||||
Vertex_handle v4_1 = tds4.insert_second();
|
||||
Vertex_handle v4_2 = tds4.insert_dim_up(w4,true);
|
||||
// from now on, coordinates have to be introduced for
|
||||
// the ierators in is_valid() to work
|
||||
Point p1(0,0);
|
||||
Point p2(2,0);
|
||||
Point p3(1,2);
|
||||
Point p3bis(1,-2);
|
||||
Point p4(1,1);
|
||||
Point p5(1,0);
|
||||
v4_1->set_point(p1);
|
||||
v4_2->set_point(p2);
|
||||
//test insert_dim_up, remove _dim_down from dimsension 1 to 2
|
||||
Vertex_handle v4_3 = tds4.insert_dim_up(w4,false);
|
||||
v4_3->set_point(p3bis);
|
||||
assert(tds4.dimension()== 2);
|
||||
assert(tds4.number_of_vertices() == 4);
|
||||
assert(tds4.is_valid() );
|
||||
tds4.remove_dim_down(v4_3);
|
||||
assert(tds4.is_valid() );
|
||||
v4_3 = tds4.insert_dim_up(w4,true);
|
||||
v4_3->set_point(p3);
|
||||
assert(tds4.is_valid() );
|
||||
// test insert-in-face, insert_in_egde dim==2
|
||||
// Find the face v4_1 v4_2 v4_3 for insertion
|
||||
Face_circulator fc= v4_1->incident_faces();
|
||||
while( ! (fc->has_vertex(v4_2) && fc->has_vertex(v4_3)) ) fc++;
|
||||
Vertex_handle v4_4 = tds4.insert_in_face(&( *fc));
|
||||
v4_4->set_point(p4);
|
||||
assert(v4_4->degree() == 3);
|
||||
assert(tds4.is_valid() );
|
||||
// Find the edge v4_1v4_2 for insertion
|
||||
fc = v4_1->incident_faces();
|
||||
|
|
@ -150,7 +137,6 @@ _test_cls_tds_2( const Tds &, const Gt &)
|
|||
while(! (fc->has_vertex(v4_2, ic ) && ic == fc->ccw(fc->index(v4_1))))
|
||||
fc++;
|
||||
Vertex_handle v4_5 = tds4.insert_in_edge(&(*fc), ic);
|
||||
v4_5->set_point(p5);
|
||||
assert(tds4.is_valid() );
|
||||
assert(tds4.dimension()== 2);
|
||||
assert(tds4.number_of_vertices() == 6);
|
||||
|
|
@ -288,18 +274,7 @@ _test_cls_tds_2( const Tds &, const Gt &)
|
|||
|
||||
//test input, output
|
||||
|
||||
// first set_point to vertices which have not been set
|
||||
//for clean input output of points
|
||||
w1->set_point(p1);
|
||||
w2->set_point(p1);
|
||||
v2->set_point(p1);
|
||||
w3->set_point(p1);
|
||||
v3->set_point(p1);
|
||||
w4->set_point(p1);
|
||||
vit = tds3.vertices_begin();
|
||||
for ( ; vit != tds3.vertices_end(); vit++) {
|
||||
vit->set_point(p1);
|
||||
}
|
||||
|
||||
std::cout << " output to a file" << std::endl;
|
||||
std::ofstream of0("file_tds0");
|
||||
CGAL::set_ascii_mode(of0);
|
||||
|
|
@ -435,7 +410,6 @@ _test_tds_iterators( const Tds& tds)
|
|||
typedef typename Tds::Vertex_iterator Vertex_iterator;
|
||||
typedef typename Tds::Face_iterator Face_iterator;
|
||||
typedef typename Tds::Edge_iterator Edge_iterator;
|
||||
typedef typename Tds::Iterator_base Iterator_base;
|
||||
|
||||
int nv, ne, nf;
|
||||
nv = ne = nf = 0;
|
||||
|
|
|
|||
|
|
@ -25,15 +25,17 @@
|
|||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
template <class Face, class Gt>
|
||||
template <class Ftds>
|
||||
void
|
||||
_test_cls_tds_face( const Face &, const Gt & )
|
||||
_test_cls_tds_face( const Ftds )
|
||||
{
|
||||
std::cout << " face" << std::endl;
|
||||
|
||||
typedef typename Face::Vertex Vertex;
|
||||
typedef typename Face::Face_handle Face_handle;
|
||||
typedef typename Face::Vertex_handle Vertex_handle;
|
||||
typedef typename Ftds::Tds Tds;
|
||||
typedef typename Ftds::Vertex Vertex;
|
||||
typedef typename Ftds::Face Face;
|
||||
typedef typename Ftds::Face_handle Face_handle;
|
||||
typedef typename Ftds::Vertex_handle Vertex_handle;
|
||||
|
||||
// Build a few objects
|
||||
int i;
|
||||
|
|
|
|||
|
|
@ -24,44 +24,32 @@
|
|||
#include <cassert>
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
template <class Vertex, class Gt>
|
||||
template <class Vtds>
|
||||
void
|
||||
_test_cls_tds_vertex( const Vertex &, const Gt & )
|
||||
_test_cls_tds_vertex( const Vtds&)
|
||||
{
|
||||
std::cout << " vertex" << std::endl;
|
||||
|
||||
typedef typename Vertex::Point Point;
|
||||
typedef typename Vertex::Face Face;
|
||||
typedef typename Vertex::Edge Edge;
|
||||
typedef typename Vertex::Face_handle Face_handle;
|
||||
typedef typename Vertex::Vertex_handle Vertex_handle;
|
||||
typedef typename Vtds::Face_handle Face_handle;
|
||||
typedef typename Vtds::Vertex_handle Vertex_handle;
|
||||
|
||||
typedef typename Vertex::Vertex_circulator Vertex_circulator;
|
||||
typedef typename Vertex::Face_circulator Face_circulator;
|
||||
typedef typename Vertex::Edge_circulator Edge_circulator;
|
||||
typedef typename Vtds::Vertex_circulator Vertex_circulator;
|
||||
typedef typename Vtds::Face_circulator Face_circulator;
|
||||
typedef typename Vtds::Edge_circulator Edge_circulator;
|
||||
|
||||
typedef typename Vtds::Tds Tds;
|
||||
typedef typename Tds::Face Face;
|
||||
typedef typename Vtds::Vertex Vertex;
|
||||
|
||||
// Build a few objects
|
||||
// Build a few objects
|
||||
Point p2(1,2);
|
||||
Point p3(2,3);
|
||||
Face f3;
|
||||
Face_handle fh3 = f3.handle();
|
||||
|
||||
// Test constructors
|
||||
Vertex v1;
|
||||
// Vertex v2(p2);
|
||||
// Vertex v3(p3,fh3);
|
||||
Vertex v2, v3;
|
||||
v2.set_point(p2);
|
||||
v3.set_point(p3); v3.set_face(f3.handle());
|
||||
|
||||
// Test point()
|
||||
// assert( Gt().compare_x_2_object()(v2.point(),p2) == CGAL::EQUAL &&
|
||||
// Gt().compare_y_2_object()(v2.point(),p2) == CGAL::EQUAL) ;
|
||||
// assert( Gt().compare_x_2_object()(v3.point(),p3) == CGAL::EQUAL &&
|
||||
// Gt().compare_y_2_object()(v3.point(),p3) == CGAL::EQUAL) ;
|
||||
v3.set_face(f3.handle());
|
||||
|
||||
|
||||
// Test face()
|
||||
assert( v3.face() == fh3 );
|
||||
// to avoid "unused variable warning
|
||||
|
|
@ -71,18 +59,13 @@ _test_cls_tds_vertex( const Vertex &, const Gt & )
|
|||
v2.set_face(fh3);
|
||||
assert( v2.face() == fh3 );
|
||||
|
||||
// Test set_point()
|
||||
v1.set_point(p3);
|
||||
assert( Gt().compare_x_2_object()(v1.point(),p3) == CGAL::EQUAL &&
|
||||
Gt().compare_y_2_object()(v1.point(),p3) == CGAL::EQUAL) ;
|
||||
|
||||
// Test ccw() and cw()
|
||||
assert( v1.ccw(0) == 1 );
|
||||
assert( v1.ccw(1) == 2 );
|
||||
assert( v1.ccw(2) == 0 );
|
||||
assert( v1.cw(0) == 2 );
|
||||
assert( v1.cw(1) == 0 );
|
||||
assert( v1.cw(2) == 1 );
|
||||
// // Test ccw() and cw()
|
||||
// assert( v1.ccw(0) == 1 );
|
||||
// assert( v1.ccw(1) == 2 );
|
||||
// assert( v1.ccw(2) == 0 );
|
||||
// assert( v1.cw(0) == 2 );
|
||||
// assert( v1.cw(1) == 0 );
|
||||
// assert( v1.cw(2) == 1 );
|
||||
|
||||
// The functions degree(), incident_faces(), incident_vertices(),
|
||||
// incident_edges() and is_valid() need a vertex in some
|
||||
|
|
|
|||
|
|
@ -249,7 +249,7 @@ _test_cls_triangulation_2( const Triangul & )
|
|||
Vertex_handle v2_3_4 = T2_3.insert(p4);
|
||||
assert( T2_3.dimension() == 2 );
|
||||
Vertex_handle v2_3_6 = T2_3.insert(p6, T2_3.finite_faces_begin());
|
||||
Vertex_handle v2_3_0 = T2_3.insert(p0, ++T2_3.finite_faces_begin());
|
||||
Vertex_handle v2_3_0 = T2_3.insert(p0, ++T2_3.finite_faces_begin());
|
||||
Vertex_handle v2_3_5 = T2_3.insert(p5);
|
||||
Vertex_handle v2_3_7 = T2_3.insert(p7);
|
||||
loc = T2_3.locate(p10,lt,li);
|
||||
|
|
|
|||
|
|
@ -23,25 +23,29 @@
|
|||
|
||||
#include <cassert>
|
||||
|
||||
template <class Vertex>
|
||||
template <class Ve>
|
||||
void
|
||||
_test_cls_triangulation_vertex( const Vertex & )
|
||||
_test_cls_triangulation_vertex( const Ve & )
|
||||
{
|
||||
std::cout << " vertex" << std::endl;
|
||||
|
||||
//typedef typename Vertex::Geom_traits Gt;
|
||||
typedef typename Ve::Point Point;
|
||||
typedef typename Ve::Triangulation_data_structure Tds;
|
||||
|
||||
typedef typename Vertex::Point Point;
|
||||
typedef typename Tds::Face Face;
|
||||
typedef typename Tds::Edge Edge;
|
||||
typedef typename Tds::Vertex Vertex;
|
||||
typedef typename Tds::Vertex_handle Vertex_handle;
|
||||
typedef typename Tds::Face_handle Face_handle;
|
||||
|
||||
typedef typename Vertex::Face Face;
|
||||
typedef typename Vertex::Edge Edge;
|
||||
typedef typename Tds::Vertex_circulator Vertex_circulator;
|
||||
typedef typename Tds::Face_circulator Face_circulator;
|
||||
typedef typename Tds::Edge_circulator Edge_circulator;
|
||||
|
||||
typedef typename Vertex::Vertex_handle Vertex_handle;
|
||||
typedef typename Vertex::Face_handle Face_handle;
|
||||
|
||||
typedef typename Vertex::Vertex_circulator Vertex_circulator;
|
||||
typedef typename Vertex::Face_circulator Face_circulator;
|
||||
typedef typename Vertex::Edge_circulator Edge_circulator;
|
||||
|
||||
typedef typename Tds::Face Face;
|
||||
|
||||
|
||||
|
||||
// Build a few objects
|
||||
Point p2(5,6,1);
|
||||
|
|
@ -75,12 +79,12 @@ _test_cls_triangulation_vertex( const Vertex & )
|
|||
assert( v2.face() == f3.handle() );
|
||||
|
||||
// Test ccw() and cw()
|
||||
assert( v1.ccw(0) == 1 );
|
||||
assert( v1.ccw(1) == 2 );
|
||||
assert( v1.ccw(2) == 0 );
|
||||
assert( v1.cw(0) == 2 );
|
||||
assert( v1.cw(1) == 0 );
|
||||
assert( v1.cw(2) == 1 );
|
||||
// assert( v1.ccw(0) == 1 );
|
||||
// assert( v1.ccw(1) == 2 );
|
||||
// assert( v1.ccw(2) == 0 );
|
||||
// assert( v1.cw(0) == 2 );
|
||||
// assert( v1.cw(1) == 0 );
|
||||
// assert( v1.cw(2) == 1 );
|
||||
|
||||
// The functions degree(), incident_faces(), incident_vertices(),
|
||||
// incident_edges() need a vertex in some triangulation,
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ int main()
|
|||
std::cout << " with Euclidean_traits_2<Cartesian> : " << std::endl ;
|
||||
typedef CGAL::Triangulation_euclidean_traits_2<Test_rep_cartesian> Gt1;
|
||||
typedef CGAL::Triangulation_vertex_base_2<Gt1> Vb1;
|
||||
typedef CGAL::Triangulation_face_base_2<Gt1> Fb1;
|
||||
typedef CGAL::Triangulation_ds_face_base_2<> Fb1;
|
||||
typedef CGAL::Triangulation_data_structure_2<Vb1,Fb1> Tds1;
|
||||
typedef CGAL::Triangulation_2<Gt1,Tds1> Cls1;
|
||||
_test_cls_triangulation_2( Cls1() );
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ int main()
|
|||
std::cout << " this use double type coordinates " << std::endl;
|
||||
typedef CGAL::_Triangulation_test_traits Gt2;
|
||||
typedef CGAL::Triangulation_vertex_base_2<Gt2> Vb2;
|
||||
typedef CGAL::Triangulation_face_base_2<Gt2> Fb2;
|
||||
typedef CGAL::Triangulation_ds_face_base_2<> Fb2;
|
||||
typedef CGAL::Triangulation_data_structure_2<Vb2,Fb2> Tds2;
|
||||
typedef CGAL::Triangulation_2<Gt2,Tds2> Cls2;
|
||||
_test_cls_triangulation_short_2( Cls2() );
|
||||
|
|
|
|||
|
|
@ -24,8 +24,6 @@
|
|||
#include <CGAL/basic.h>
|
||||
#include <CGAL/_test_types.h>
|
||||
|
||||
#include <CGAL/Triangulation_vertex_base_2.h>
|
||||
#include <CGAL/Triangulation_face_base_2.h>
|
||||
#include <CGAL/Triangulation_data_structure_2.h>
|
||||
|
||||
#include <CGAL/_test_types.C>
|
||||
|
|
@ -33,8 +31,8 @@
|
|||
|
||||
|
||||
|
||||
typedef CGAL::Triangulation_vertex_base_2<TestK> Vb;
|
||||
typedef CGAL::Triangulation_face_base_2<TestK> Fb;
|
||||
typedef CGAL::Triangulation_ds_vertex_base_2<> Vb;
|
||||
typedef CGAL::Triangulation_ds_face_base_2<> Fb;
|
||||
|
||||
// Explicit instantiation :
|
||||
// does not work because of off_file_input
|
||||
|
|
@ -44,24 +42,22 @@ int main()
|
|||
{
|
||||
std::cout << "Testing Triangulation_data_structure_2"
|
||||
<< std::endl << std::endl;
|
||||
typedef CGAL::_Triangulation_test_traits Gt;
|
||||
typedef CGAL::Triangulation_vertex_base_2<Gt> Vb;
|
||||
typedef CGAL::Triangulation_face_base_2<Gt> Fb;
|
||||
typedef CGAL::Triangulation_data_structure_2<Vb,Fb> Cls1;
|
||||
_test_cls_tds_2( Cls1(), Gt() );
|
||||
typedef CGAL::Triangulation_data_structure_2<> Cls1;
|
||||
_test_cls_tds_2( Cls1());
|
||||
|
||||
std::cout << "Testing bakward compatibility" << std::endl;
|
||||
std::cout << "Testing Triangulation_defaut_data_structure_2"
|
||||
<< std::endl;
|
||||
typedef CGAL::_Triangulation_test_traits Gt;
|
||||
typedef CGAL::Triangulation_ds_vertex_base_2<> Vb;
|
||||
typedef CGAL::Triangulation_ds_face_base_2<> Fb;
|
||||
typedef CGAL::Triangulation_default_data_structure_2<Gt,Vb,Fb> Cls2;
|
||||
_test_cls_tds_2( Cls2(), Gt() );
|
||||
_test_cls_tds_2( Cls2());
|
||||
|
||||
std::cout << "Testing Triangulation_data_structure_using_list_2"
|
||||
<< std::endl;
|
||||
typedef CGAL::Triangulation_data_structure_using_list_2<Vb,Fb> Cls3;
|
||||
|
||||
_test_cls_tds_2( Cls3(), Gt() );
|
||||
|
||||
|
||||
_test_cls_tds_2( Cls3());
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ typedef double Coord_type;
|
|||
typedef CGAL::Cartesian<Coord_type> Gt;
|
||||
typedef CGAL::Triangulation_vertex_base_2<Gt> Vbb;
|
||||
typedef CGAL::Triangulation_hierarchy_vertex_base_2<Vbb> Vb;
|
||||
typedef CGAL::Triangulation_face_base_2<Gt> Fb;
|
||||
typedef CGAL::Triangulation_ds_face_base_2<> Fb;
|
||||
typedef CGAL::Triangulation_data_structure_2<Vb,Fb> Tds;
|
||||
typedef CGAL::Delaunay_triangulation_2<Gt,Tds> Dt;
|
||||
// Explicit instantiation of the whole class :
|
||||
|
|
|
|||
|
|
@ -40,10 +40,7 @@ int main()
|
|||
std::cout << "Testing Delaunay Triangulation_2 " << std::endl;
|
||||
std::cout << " with Euclidean cartesian points : " << std::endl;
|
||||
typedef CGAL::Triangulation_euclidean_traits_2<Test_rep_cartesian> Gt1;
|
||||
typedef CGAL::Triangulation_vertex_base_2<Gt1> Vb1;
|
||||
typedef CGAL::Triangulation_face_base_2<Gt1> Fb1;
|
||||
typedef CGAL::Triangulation_data_structure_2<Vb1,Fb1> Tds1;
|
||||
typedef CGAL::Delaunay_triangulation_2<Gt1,Tds1> Cls1;
|
||||
typedef CGAL::Delaunay_triangulation_2<Gt1> Cls1;
|
||||
|
||||
_test_cls_delaunay_triangulation_2( Cls1() );
|
||||
|
||||
|
|
@ -51,10 +48,7 @@ int main()
|
|||
std::cout << "Testing Delaunay Triangulation_2 "<< std::endl;
|
||||
std::cout << " with Triangulation_test_traits : " << std::endl;
|
||||
typedef CGAL::_Triangulation_test_traits Gt;
|
||||
typedef CGAL::Triangulation_vertex_base_2<Gt> Vb;
|
||||
typedef CGAL::Triangulation_face_base_2<Gt> Fb;
|
||||
typedef CGAL::Triangulation_data_structure_2<Vb,Fb> Tds;
|
||||
typedef CGAL::Delaunay_triangulation_2<Gt,Tds> Cls;
|
||||
typedef CGAL::Delaunay_triangulation_2<Gt> Cls;
|
||||
|
||||
_test_cls_delaunay_triangulation_2( Cls() );
|
||||
|
||||
|
|
@ -72,10 +66,7 @@ int main()
|
|||
std::cout << " using Kernel_traits : " << std::endl;
|
||||
std::cout << " and Homogeneous Points " << std::endl;
|
||||
typedef CGAL::Homogeneous<double> Gt4;
|
||||
typedef CGAL::Triangulation_vertex_base_2<Gt4> Vb4;
|
||||
typedef CGAL::Triangulation_face_base_2<Gt4> Fb4;
|
||||
typedef CGAL::Triangulation_data_structure_2<Vb4,Fb4> Tds4;
|
||||
typedef CGAL::Delaunay_triangulation_2<Gt4,Tds4> Cls4;
|
||||
typedef CGAL::Delaunay_triangulation_2<Gt4> Cls4;
|
||||
|
||||
_test_cls_delaunay_triangulation_2( Cls4() );
|
||||
|
||||
|
|
|
|||
|
|
@ -26,18 +26,21 @@
|
|||
|
||||
#include <CGAL/_test_types.h>
|
||||
#include <CGAL/Weighted_point.h>
|
||||
#include <CGAL/Filtered_exact.h>
|
||||
|
||||
#include <CGAL/Regular_triangulation_euclidean_traits_2.h>
|
||||
#include <CGAL/Regular_triangulation_2.h>
|
||||
#include <CGAL/Triangulation_hierarchy_2.h>
|
||||
|
||||
#include <CGAL/_test_cls_regular_hierarchy_2.C>
|
||||
#include <CGAL/_test_cls_regular_triangulation_2.C>
|
||||
|
||||
typedef CGAL::Regular_triangulation_euclidean_traits_2 <TestK, double> RGt;
|
||||
//#include <CGAL/_test_cls_regular_hierarchy_2.C>
|
||||
|
||||
//typedef CGAL::Regular_triangulation_euclidean_traits_2 <TestK,
|
||||
//double> RGt;
|
||||
typedef CGAL::Regular_triangulation_euclidean_traits_2<Test_rep_cartesian> RGt;
|
||||
typedef CGAL::Regular_triangulation_vertex_base_2<RGt> Vbb;
|
||||
typedef CGAL::Triangulation_hierarchy_vertex_base_2<Vbb> Vb;
|
||||
typedef CGAL::Regular_triangulation_face_base_2<RGt> Fb;
|
||||
typedef CGAL::Regular_triangulation_face_base_2<> Fb;
|
||||
typedef CGAL::Triangulation_data_structure_2<Vb,Fb> Tds;
|
||||
typedef CGAL::Regular_triangulation_2<RGt,Tds> Rt;
|
||||
typedef CGAL::Triangulation_hierarchy_2<Rt> Regular_hierarchy_cartesian;
|
||||
|
|
@ -55,7 +58,7 @@ int main()
|
|||
std::cout << "using Cartesian points " << std::endl;
|
||||
|
||||
std::cout << "Testing hierarchy" << std::endl;
|
||||
_test_cls_regular_hierarchy_2( Regular_hierarchy_cartesian() );
|
||||
_test_cls_reg_triangulation_2( Regular_hierarchy_cartesian() );
|
||||
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -43,13 +43,10 @@ int main()
|
|||
std::cout << "Testing constrained_triangulation_plus_2 "<< std::endl;
|
||||
std::cout << " with Exact_predicates_tag : " << std::endl;
|
||||
typedef CGAL::Triangulation_vertex_base_2<TestK> Vb;
|
||||
typedef CGAL::Constrained_triangulation_face_base_2<TestK> Fb;
|
||||
//typedef CGAL::Triangulation_vertex_base_2<EK> Vb;
|
||||
//typedef CGAL::Constrained_triangulation_face_base_2<EK> Fb;
|
||||
typedef CGAL::Constrained_triangulation_face_base_2<> Fb;
|
||||
typedef CGAL::Triangulation_data_structure_2<Vb,Fb> TDS;
|
||||
typedef CGAL::Exact_predicates_tag Itag;
|
||||
typedef CGAL::Constrained_Delaunay_triangulation_2<TestK,TDS,Itag> CDt;
|
||||
//typedef CGAL::Constrained_Delaunay_triangulation_2<EK,TDS,Itag> CDt;
|
||||
typedef CGAL::Constrained_triangulation_plus_2<CDt> CDtplus;
|
||||
|
||||
|
||||
|
|
@ -59,7 +56,7 @@ int main()
|
|||
std::cout << "Testing constrained_triangulation_plus_2 "<< std::endl;
|
||||
std::cout << " with Exact_intersections_tag : " << std::endl;
|
||||
typedef CGAL::Triangulation_vertex_base_2<EK> Vbb;
|
||||
typedef CGAL::Constrained_triangulation_face_base_2<EK> Fbb;
|
||||
typedef CGAL::Constrained_triangulation_face_base_2<> Fbb;
|
||||
typedef CGAL::Triangulation_data_structure_2<Vbb,Fbb> TDSS;
|
||||
typedef CGAL::Exact_intersections_tag EItag;
|
||||
typedef CGAL::Constrained_Delaunay_triangulation_2<EK,TDSS,EItag> CDtei;
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ int main()
|
|||
std::cout << "Testing constrained_triangulation "<< std::endl;
|
||||
std::cout << " with Exact_predicates_tag : " << std::endl;
|
||||
typedef CGAL::Triangulation_vertex_base_2<TestK> Vb;
|
||||
typedef CGAL::Constrained_triangulation_face_base_2<TestK> Fb;
|
||||
typedef CGAL::Constrained_triangulation_face_base_2<> Fb;
|
||||
typedef CGAL::Triangulation_data_structure_2<Vb,Fb> TDS;
|
||||
typedef CGAL::Exact_predicates_tag Itag;
|
||||
typedef CGAL::Constrained_triangulation_2<TestK,TDS,Itag> Ctwi;
|
||||
|
|
@ -51,7 +51,7 @@ int main()
|
|||
std::cout << "Testing constrained_triangulation "<< std::endl;
|
||||
std::cout << " with Exact_intersections_tag : " << std::endl;
|
||||
typedef CGAL::Triangulation_vertex_base_2<EK> Vbb;
|
||||
typedef CGAL::Constrained_triangulation_face_base_2<EK> Fbb;
|
||||
typedef CGAL::Constrained_triangulation_face_base_2<> Fbb;
|
||||
typedef CGAL::Triangulation_data_structure_2<Vbb,Fbb> TDSS;
|
||||
typedef CGAL::Exact_intersections_tag EItag;
|
||||
typedef CGAL::Constrained_triangulation_2<EK,TDSS,EItag> Ctwei;
|
||||
|
|
|
|||
|
|
@ -1,65 +0,0 @@
|
|||
# Created by the script create_makefile
|
||||
# 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 = /0/prisme_util/CGAL/CGAL-I/make/makefile_i686_Linux-2.2.18_g++-2.95_LEDA
|
||||
include $(CGAL_MAKEFILE)
|
||||
|
||||
#---------------------------------------------------------------------#
|
||||
# compiler flags
|
||||
#---------------------------------------------------------------------#
|
||||
|
||||
CXXFLAGS = \
|
||||
-I../../include \
|
||||
$(TESTSUITE_CXXFLAGS) \
|
||||
$(EXTRA_FLAGS) \
|
||||
$(CGAL_CXXFLAGS) \
|
||||
$(LONG_NAME_PROBLEM_CXXFLAGS) \
|
||||
$(DEBUG_OPT)
|
||||
|
||||
#---------------------------------------------------------------------#
|
||||
# linker flags
|
||||
#---------------------------------------------------------------------#
|
||||
|
||||
LIBPATH = \
|
||||
$(TESTSUITE_LIBPATH) \
|
||||
$(CGAL_LIBPATH)
|
||||
|
||||
LDFLAGS = \
|
||||
$(TESTSUITE_LDFLAGS) \
|
||||
$(LONG_NAME_PROBLEM_LDFLAGS) \
|
||||
$(CGAL_LDFLAGS)
|
||||
|
||||
#---------------------------------------------------------------------#
|
||||
# target entries
|
||||
#---------------------------------------------------------------------#
|
||||
|
||||
all: \
|
||||
example_1$(EXE_EXT) \
|
||||
example_2$(EXE_EXT)
|
||||
|
||||
example_1$(EXE_EXT): example_1$(OBJ_EXT)
|
||||
$(CGAL_CXX) $(LIBPATH) $(EXE_OPT)example_1 example_1$(OBJ_EXT) $(LDFLAGS)
|
||||
|
||||
example_2$(EXE_EXT): example_2$(OBJ_EXT)
|
||||
$(CGAL_CXX) $(LIBPATH) $(EXE_OPT)example_2 example_2$(OBJ_EXT) $(LDFLAGS)
|
||||
|
||||
clean: \
|
||||
example_1.clean \
|
||||
example_2.clean
|
||||
|
||||
realclean: clean
|
||||
- rm -f Program* Error* Compiler* error*
|
||||
|
||||
|
||||
#---------------------------------------------------------------------#
|
||||
# suffix rules
|
||||
#---------------------------------------------------------------------#
|
||||
|
||||
.C$(OBJ_EXT):
|
||||
$(CGAL_CXX) $(CXXFLAGS) $(OBJ_OPT) $<
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,166 +0,0 @@
|
|||
// Try to make deferred instantiation at the level of the Tds
|
||||
|
||||
|
||||
#include <CGAL/basic.h>
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
#define Cartesian Ca
|
||||
#define Homogeneous Ho
|
||||
|
||||
#include <CGAL/Cartesian.h>
|
||||
#include <CGAL/Triangulation_euclidean_traits_2.h>
|
||||
#include <CGAL/Triangulation_2.h>
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
template <class Gt, class Ref>
|
||||
class My_vertex : public Triangulation_vertex_base_2<Gt>
|
||||
{
|
||||
public:
|
||||
typedef typename Gt::Point_2 Point;
|
||||
typedef Triangulation_vertex_base_2<Gt> Vertex_base;
|
||||
|
||||
typedef typename Ref::Face Face;
|
||||
typedef typename Ref::Vertex Vertex;
|
||||
typedef typename Ref::Face_handle Face_handle;
|
||||
typedef typename Ref::Vertex_handle Vertex_handle;
|
||||
|
||||
My_vertex() : Vertex_base (){}
|
||||
|
||||
My_vertex (const Point & p, void * f = NULL) : Vertex_base (p, f) {}
|
||||
|
||||
void set_v (Vertex* v) {_v = v;}
|
||||
void set_f (Face* f) {_f = f;}
|
||||
void set_vh(Vertex_handle vh) { _v = &(*vh);}
|
||||
void set_fh(Face_handle fh) {_f = &(*fh);}
|
||||
|
||||
Vertex* get_v() { return _v;}
|
||||
Face* get_f() { return _f;}
|
||||
Vertex_handle get_vh() {return Vertex_handle(_v) ;}
|
||||
Face_handle get_fh() {return Face_handle(_f);}
|
||||
|
||||
private:
|
||||
Vertex* _v;
|
||||
Face* _f;
|
||||
};
|
||||
|
||||
|
||||
template <class Gt, class Ref>
|
||||
class My_face : public Triangulation_face_base_2<Gt>
|
||||
{
|
||||
public:
|
||||
typedef Triangulation_face_base_2<Gt> Face_base;
|
||||
|
||||
typedef typename Ref::Face Face;
|
||||
typedef typename Ref::Vertex Vertex;
|
||||
typedef typename Ref::Face_handle Face_handle;
|
||||
typedef typename Ref::Vertex_handle Vertex_handle;
|
||||
|
||||
My_face() : Face_base (){}
|
||||
|
||||
My_face (void* v0, void* v1, void* v2) : Face_base (v0, v1, v2){}
|
||||
|
||||
My_face (void* v0, void* v1, void* v2,
|
||||
void* n0, void* n1, void* n2)
|
||||
: Face_base (v0, v1, v2, n0, n1, n2){}
|
||||
|
||||
void set_v (Vertex* v) {_v = v;}
|
||||
void set_f (Face* f) {_f = f;}
|
||||
void set_vh(Vertex_handle vh) { _v = &(*vh);}
|
||||
void set_fh(Face_handle fh) {_f = &(*fh);}
|
||||
|
||||
Vertex* get_v() { return _v;}
|
||||
Face* get_f() { return _f;}
|
||||
Vertex_handle get_vh() {return Vertex_handle(_v) ;}
|
||||
Face_handle get_fh() {return Face_handle(_f);}
|
||||
|
||||
private:
|
||||
Vertex* _v;
|
||||
Face* _f;
|
||||
};
|
||||
|
||||
//
|
||||
//The user who wants to use its own face or own vertex
|
||||
// has to rewrite this class
|
||||
template <class Gt>
|
||||
class My_TDS:
|
||||
public Triangulation_data_structure_2 < My_vertex <Gt, My_TDS<Gt> > ,
|
||||
My_face <Gt, My_TDS<Gt> > >
|
||||
{
|
||||
public: // CREATION
|
||||
My_TDS() {}
|
||||
};
|
||||
|
||||
CGAL_END_NAMESPACE
|
||||
|
||||
typedef double coord_type;
|
||||
typedef CGAL::Cartesian<coord_type> Rpst;
|
||||
typedef CGAL::Triangulation_euclidean_traits_2<Rpst> Gt;
|
||||
typedef CGAL::My_TDS<Gt> My_tds;
|
||||
typedef CGAL::Triangulation_2<Gt,My_tds> Triangulation;
|
||||
|
||||
typedef Gt::Point_2 Point;
|
||||
typedef Triangulation::Face Face;
|
||||
typedef Triangulation::Vertex Vertex;
|
||||
typedef Triangulation::Face_handle Face_handle;
|
||||
typedef Triangulation::Vertex_handle Vertex_handle;
|
||||
|
||||
typedef Triangulation::Face_circulator Face_circulator;
|
||||
typedef Triangulation::Vertex_circulator Vertex_circulator;
|
||||
|
||||
typedef Triangulation::Locate_type Locate_type;
|
||||
|
||||
typedef Triangulation::Face_iterator Face_iterator;
|
||||
typedef Triangulation::Vertex_iterator Vertex_iterator;
|
||||
typedef Triangulation::Edge_iterator Edge_iterator;
|
||||
typedef Triangulation::Line_face_circulator Line_face_circulator;
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
Triangulation T;
|
||||
std::vector<Point> points;
|
||||
|
||||
points.push_back(Point(0,0));
|
||||
points.push_back(Point(1,1));
|
||||
points.push_back(Point(2,2));
|
||||
|
||||
for (unsigned int i = 0; i < points.size(); i++)
|
||||
T.insert(points[i]);
|
||||
|
||||
Vertex_iterator v0_iter = T.finite_vertices_begin();
|
||||
|
||||
Vertex_handle vertex = T.finite_vertex();
|
||||
Face_handle face = v0_iter->face();
|
||||
|
||||
for (Vertex_iterator v_iter = T.finite_vertices_begin();
|
||||
v_iter != T.finite_vertices_end();
|
||||
v_iter++){
|
||||
v_iter->set_v(&(*vertex));
|
||||
v_iter->set_vh(vertex);
|
||||
v_iter->set_f(&(*face));
|
||||
v_iter->set_fh(face);
|
||||
}
|
||||
|
||||
for (Face_iterator f_iter = T.faces_begin();
|
||||
f_iter != T.faces_end();
|
||||
f_iter++){
|
||||
f_iter->set_v(&(*vertex));
|
||||
f_iter->set_vh(vertex);
|
||||
f_iter->set_f(&(*face));
|
||||
f_iter->set_fh(face);
|
||||
}
|
||||
|
||||
|
||||
Vertex_iterator v_it = T.finite_vertices_begin();
|
||||
std::cout<< v_it->get_v()->point()<<"\n";
|
||||
std::cout<< v_it->get_vh()->point()<<"\n";
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,170 +0,0 @@
|
|||
// Try to make deferred instantiation at the level of the Triangulation
|
||||
|
||||
|
||||
#include <CGAL/basic.h>
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
#define Cartesian Ca
|
||||
#define Homogeneous Ho
|
||||
|
||||
#include <CGAL/Cartesian.h>
|
||||
#include <CGAL/Triangulation_euclidean_traits_2.h>
|
||||
#include <CGAL/Triangulation_2.h>
|
||||
#include <CGAL/Delaunay_triangulation_2.h>
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
template <class Gt, class Ref>
|
||||
class My_vertex : public Triangulation_vertex_base_2<Gt>
|
||||
{
|
||||
public:
|
||||
typedef typename Gt::Point_2 Point;
|
||||
typedef Triangulation_vertex_base_2<Gt> Vertex_base;
|
||||
|
||||
typedef typename Ref::Face Face;
|
||||
typedef typename Ref::Vertex Vertex;
|
||||
typedef typename Ref::Vertex_handle Vertex_handle;
|
||||
typedef typename Ref::Face_handle Face_handle;
|
||||
|
||||
My_vertex() : Vertex_base (){}
|
||||
|
||||
My_vertex (const Point & p, void * f = NULL) : Vertex_base (p, f) {}
|
||||
|
||||
void set_v (Vertex* v) {_vh = Vertex_handle(v);}
|
||||
void set_f (Face* f) {_fh = Face_handle(f);}
|
||||
void set_vh(Vertex_handle vh) { _vh = vh;}
|
||||
void set_fh(Face_handle fh) {_fh = fh;}
|
||||
|
||||
Vertex* get_v() { return &(*_vh);}
|
||||
Face* get_f() { return &(*_fh);}
|
||||
Vertex_handle get_vh() {return _vh ;}
|
||||
Face_handle get_fh() {return _fh;}
|
||||
|
||||
|
||||
private:
|
||||
Vertex_handle _vh;
|
||||
Face_handle _fh;
|
||||
};
|
||||
|
||||
|
||||
template <class Gt, class Ref>
|
||||
class My_face : public Triangulation_face_base_2<Gt>
|
||||
{
|
||||
public:
|
||||
typedef Triangulation_face_base_2<Gt> Face_base;
|
||||
|
||||
typedef typename Ref::Face Face;
|
||||
typedef typename Ref::Vertex Vertex;
|
||||
typedef typename Ref::Vertex_handle Vertex_handle;
|
||||
typedef typename Ref::Face_handle Face_handle;
|
||||
|
||||
My_face() : Face_base (){}
|
||||
|
||||
My_face (void* v0, void* v1, void* v2) : Face_base (v0, v1, v2){}
|
||||
|
||||
My_face (void* v0, void* v1, void* v2,
|
||||
void* n0, void* n1, void* n2)
|
||||
: Face_base (v0, v1, v2, n0, n1, n2){}
|
||||
|
||||
void set_v (Vertex* v) {_vh = Vertex_handle(v);}
|
||||
void set_f (Face* f) {_fh = Face_handle(f);}
|
||||
void set_vh(Vertex_handle vh) { _vh = vh;}
|
||||
void set_fh(Face_handle fh) {_fh = fh;}
|
||||
|
||||
Vertex* get_v() { return &(*_vh);}
|
||||
Face* get_f() { return &(*_fh);}
|
||||
Vertex_handle get_vh() {return _vh ;}
|
||||
Face_handle get_fh() {return _fh;}
|
||||
|
||||
|
||||
private:
|
||||
Vertex_handle _vh;
|
||||
Face_handle _fh;
|
||||
};
|
||||
|
||||
|
||||
template <class Gt>
|
||||
class My_TDS:
|
||||
public Triangulation_data_structure_2 <
|
||||
My_vertex <Gt, Triangulation_2<Gt, My_TDS<Gt> > > ,
|
||||
My_face <Gt, Triangulation_2<Gt, My_TDS<Gt> > >
|
||||
>
|
||||
|
||||
{
|
||||
public: // CREATION
|
||||
My_TDS() {}
|
||||
};
|
||||
|
||||
CGAL_END_NAMESPACE
|
||||
|
||||
typedef double coord_type;
|
||||
typedef CGAL::Cartesian<coord_type> Rpst;
|
||||
typedef CGAL::Triangulation_euclidean_traits_2<Rpst> Gt;
|
||||
typedef CGAL::My_TDS<Gt> My_tds;
|
||||
typedef CGAL::Triangulation_2<Gt,My_tds> Triangulation;
|
||||
|
||||
typedef Gt::Point_2 Point;
|
||||
typedef Triangulation::Face Face;
|
||||
typedef Triangulation::Vertex Vertex;
|
||||
typedef Triangulation::Face_handle Face_handle;
|
||||
typedef Triangulation::Vertex_handle Vertex_handle;
|
||||
|
||||
typedef Triangulation::Face_circulator Face_circulator;
|
||||
typedef Triangulation::Vertex_circulator Vertex_circulator;
|
||||
|
||||
typedef Triangulation::Locate_type Locate_type;
|
||||
|
||||
typedef Triangulation::Face_iterator Face_iterator;
|
||||
typedef Triangulation::Vertex_iterator Vertex_iterator;
|
||||
typedef Triangulation::Edge_iterator Edge_iterator;
|
||||
typedef Triangulation::Line_face_circulator Line_face_circulator;
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
Triangulation T;
|
||||
std::vector<Point> points;
|
||||
|
||||
points.push_back(Point(0,0));
|
||||
points.push_back(Point(1,1));
|
||||
points.push_back(Point(2,2));
|
||||
|
||||
for (unsigned int i = 0; i < points.size(); i++)
|
||||
T.insert(points[i]);
|
||||
|
||||
Vertex_iterator v0_iter = T.finite_vertices_begin();
|
||||
|
||||
Vertex_handle vertex = T.finite_vertex();
|
||||
Face_handle face = v0_iter->face();
|
||||
|
||||
for (Vertex_iterator v_iter = T.finite_vertices_begin();
|
||||
v_iter != T.finite_vertices_end();
|
||||
v_iter++){
|
||||
v_iter->set_v(&(*vertex));
|
||||
v_iter->set_vh(vertex);
|
||||
v_iter->set_f(&(*face));
|
||||
v_iter->set_fh(face);
|
||||
}
|
||||
|
||||
for (Face_iterator f_iter = T.faces_begin();
|
||||
f_iter != T.faces_end();
|
||||
f_iter++){
|
||||
f_iter->set_v(&(*vertex));
|
||||
f_iter->set_vh(vertex);
|
||||
f_iter->set_f(&(*face));
|
||||
f_iter->set_fh(face);
|
||||
}
|
||||
|
||||
|
||||
Vertex_iterator v_it = T.finite_vertices_begin();
|
||||
std::cout<< v_it->get_v()->point()<<"\n";
|
||||
std::cout<< v_it->get_vh()->point()<<"\n";
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,177 +0,0 @@
|
|||
// Try Sylvain proposal for a fully flexible design
|
||||
// using the rebind trick
|
||||
|
||||
|
||||
#include <CGAL/basic.h>
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
#define Cartesian Ca
|
||||
#define Homogeneous Ho
|
||||
|
||||
#include "Triangulation_data_structure_2.h"
|
||||
#include <CGAL/Cartesian.h>
|
||||
#include <CGAL/Triangulation_euclidean_traits_2.h>
|
||||
#include <CGAL/Triangulation_2.h>
|
||||
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
struct TDS_Bidon {
|
||||
typedef int Vertex_handle;
|
||||
typedef int Face_handle;
|
||||
};
|
||||
|
||||
|
||||
|
||||
template <class Gt, class TDS = TDS_Bidon>
|
||||
class Vertex_base_2 : public Triangulation_vertex_base_2<Gt>
|
||||
{
|
||||
public:
|
||||
typedef typename Gt::Point_2 Point;
|
||||
typedef Triangulation_vertex_base_2<Gt> Base;
|
||||
|
||||
typedef typename TDS::Face_handle Face_handle;
|
||||
typedef typename TDS::Vertex_handle Vertex_handle;
|
||||
|
||||
template < class My_TDS>
|
||||
struct TDS_rebind { typedef Vertex_base_2<Gt, My_TDS> Rebound;};
|
||||
|
||||
Vertex_base_2() : Base (){}
|
||||
Vertex_base_2(const Point & p, void * f = NULL) : Base(p,f) {}
|
||||
|
||||
void set_vh(Vertex_handle vh) { _vh = vh;}
|
||||
void set_fh(Face_handle fh) {_fh = fh ;}
|
||||
|
||||
Vertex_handle get_vh() {return _vh ;}
|
||||
Face_handle get_fh() {return _fh ;}
|
||||
|
||||
private:
|
||||
Vertex_handle _vh;
|
||||
Face_handle _fh;
|
||||
};
|
||||
|
||||
|
||||
template <class Gt, class TDS = TDS_Bidon>
|
||||
class Face_base_2 : public Triangulation_face_base_2<Gt>
|
||||
{
|
||||
public:
|
||||
typedef Triangulation_face_base_2<Gt> Base;
|
||||
|
||||
typedef typename TDS::Face_handle Face_handle;
|
||||
typedef typename TDS::Vertex_handle Vertex_handle;
|
||||
|
||||
template < class My_TDS>
|
||||
struct TDS_rebind { typedef Face_base_2<Gt, My_TDS> Rebound; };
|
||||
|
||||
|
||||
Face_base_2() : Base (){}
|
||||
|
||||
Face_base_2 (void* v0, void* v1, void* v2) : Base (v0, v1, v2){}
|
||||
|
||||
Face_base_2 (void* v0, void* v1, void* v2,
|
||||
void* n0, void* n1, void* n2)
|
||||
: Base (v0, v1, v2, n0, n1, n2){}
|
||||
|
||||
void set_vh(Vertex_handle vh) { _vh = vh;}
|
||||
void set_fh(Face_handle fh) {_fh = fh;}
|
||||
|
||||
Vertex_handle get_vh() {return _vh ;}
|
||||
Face_handle get_fh() {return _fh ;}
|
||||
|
||||
private:
|
||||
Vertex_handle _vh;
|
||||
Face_handle _fh;
|
||||
};
|
||||
|
||||
CGAL_END_NAMESPACE
|
||||
|
||||
//
|
||||
// A user defined Vertex
|
||||
template <class Gt, class TDS = CGAL::TDS_Bidon>
|
||||
class My_vertex : public CGAL::Vertex_base_2<Gt, TDS>
|
||||
{
|
||||
public:
|
||||
typedef CGAL::Vertex_base_2<Gt,TDS> Base;
|
||||
typedef typename Base::Point Point;
|
||||
typedef typename TDS::Face_handle Face_handle;
|
||||
typedef typename TDS::Vertex_handle Vertex_handle;
|
||||
|
||||
template < class My_TDS>
|
||||
struct TDS_rebind { typedef My_vertex<Gt, My_TDS> Rebound;};
|
||||
|
||||
My_vertex() : Base (){}
|
||||
My_vertex(const Point & p, void * f = NULL) : Base(p,f) {}
|
||||
|
||||
void set_wahou(Vertex_handle vh) { wahou = vh;}
|
||||
Vertex_handle get_wahou() {return wahou ;}
|
||||
|
||||
private:
|
||||
Vertex_handle wahou;
|
||||
};
|
||||
|
||||
|
||||
typedef CGAL::Cartesian<double> K;
|
||||
typedef My_vertex<K> MyVb;
|
||||
typedef CGAL::Vertex_base_2<K> Vb;
|
||||
typedef CGAL::Face_base_2<K> Fb;
|
||||
//typedef CGAL::Triangulation_data_structure_2<Vb,Fb> Tds;
|
||||
typedef CGAL::Triangulation_data_structure_2<MyVb,Fb> Tds;
|
||||
typedef CGAL::Triangulation_2<K,Tds> Triangulation;
|
||||
|
||||
typedef K::Point_2 Point;
|
||||
typedef Triangulation::Face_handle Face_handle;
|
||||
typedef Triangulation::Vertex_handle Vertex_handle;
|
||||
|
||||
typedef Triangulation::Finite_faces_iterator Face_iterator;
|
||||
typedef Triangulation::Finite_vertices_iterator Vertex_iterator;
|
||||
typedef Triangulation::Finite_edges_iterator Edge_iterator;
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
Triangulation T;
|
||||
std::vector<Point> points;
|
||||
|
||||
points.push_back(Point(0,0));
|
||||
points.push_back(Point(1,1));
|
||||
points.push_back(Point(2,2));
|
||||
|
||||
for (unsigned int i = 0; i < points.size(); i++)
|
||||
T.insert(points[i]);
|
||||
|
||||
Vertex_iterator v0_iter = T.finite_vertices_begin();
|
||||
|
||||
Vertex_handle vertex = T.finite_vertex();
|
||||
Face_handle face = v0_iter->face();
|
||||
|
||||
for (Vertex_iterator v_iter = T.finite_vertices_begin();
|
||||
v_iter != T.finite_vertices_end();
|
||||
v_iter++){
|
||||
v_iter->set_vh(vertex);
|
||||
v_iter->set_fh(face);
|
||||
vertex = v_iter;
|
||||
face = v_iter->face();
|
||||
v_iter->set_wahou(v_iter);
|
||||
}
|
||||
|
||||
for (Face_iterator f_iter = T.faces_begin();
|
||||
f_iter != T.faces_end();
|
||||
f_iter++){
|
||||
f_iter->set_vh(vertex);
|
||||
f_iter->set_fh(face);
|
||||
}
|
||||
|
||||
|
||||
for (Vertex_iterator v_it = T.finite_vertices_begin();
|
||||
v_it != T.finite_vertices_end();
|
||||
v_it++){
|
||||
std::cerr << v_it->point() << " " << v_it->get_wahou()->point()<<"\n";
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,106 +0,0 @@
|
|||
// Try Sylvain proposal for a fully flexible design
|
||||
// using the rebind trick
|
||||
// try a general example (not in CGAL), first
|
||||
#include <list>
|
||||
|
||||
struct TDS_Bidon {
|
||||
typedef int Vertex_handle;
|
||||
};
|
||||
|
||||
template<class Vb>
|
||||
class TDS_2 {
|
||||
public:
|
||||
typedef TDS_2<Vb> Self;
|
||||
typedef typename Vb::template TDS_rebind<Self>::Rebound Vertex;
|
||||
|
||||
typedef std::list<Vertex> Vertex_container;
|
||||
typedef Vertex* Vertex_handle;
|
||||
|
||||
protected:
|
||||
Vertex_container container;
|
||||
|
||||
public:
|
||||
Vertex_handle create_vertex(Vertex_handle vh){
|
||||
Vertex* vv = new Vertex(vh);
|
||||
container.push_back(*vv);
|
||||
return vv;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
//template <class TDS = void>
|
||||
template <class TDS = TDS_Bidon>
|
||||
class Vertex_base
|
||||
{
|
||||
public:
|
||||
typedef typename TDS::Vertex_handle Vertex_handle;
|
||||
|
||||
template < class My_TDS>
|
||||
struct TDS_rebind { typedef Vertex_base<My_TDS> Rebound;};
|
||||
|
||||
Vertex_base() : _vh(0){}
|
||||
Vertex_base(Vertex_handle vh) : _vh(vh) {}
|
||||
void set_vh(Vertex_handle vh) { _vh = vh;}
|
||||
Vertex_handle get_vh() {return _vh ;}
|
||||
|
||||
private:
|
||||
Vertex_handle _vh;
|
||||
};
|
||||
|
||||
|
||||
|
||||
//
|
||||
// A user defined Vertex
|
||||
template <class TDS = TDS_Bidon>
|
||||
class My_vertex_base : public Vertex_base<TDS>
|
||||
{
|
||||
public:
|
||||
typedef Vertex_base<TDS> Base;
|
||||
typedef typename TDS::Vertex_handle Vertex_handle;
|
||||
|
||||
template < class My_TDS>
|
||||
struct TDS_rebind { typedef My_vertex_base<My_TDS> Rebound;};
|
||||
|
||||
My_vertex_base() : Base (){}
|
||||
My_vertex_base(Vertex_handle vh) : Base(vh) {}
|
||||
|
||||
void set_wahou(Vertex_handle vh) { wahou = vh;}
|
||||
Vertex_handle get_wahou() {return wahou ;}
|
||||
|
||||
private:
|
||||
Vertex_handle wahou;
|
||||
};
|
||||
|
||||
|
||||
typedef Vertex_base<> Vb;
|
||||
typedef TDS_2<Vb> Tds;
|
||||
typedef My_vertex_base<> Myvb;
|
||||
typedef TDS_2<Myvb> Mytds;
|
||||
|
||||
typedef Tds::Vertex Vertex;
|
||||
typedef Tds::Vertex_handle Vertex_handle;
|
||||
typedef Mytds::Vertex My_vertex;
|
||||
typedef Mytds::Vertex_handle My_vertex_handle;
|
||||
|
||||
int main()
|
||||
{
|
||||
Tds tds;
|
||||
Vertex_handle vh = new Vertex;
|
||||
for(int i = 0 ; i < 10 ; i++) {
|
||||
vh = tds.create_vertex(vh);
|
||||
}
|
||||
|
||||
Mytds mytds;
|
||||
My_vertex_handle myvh = new My_vertex;
|
||||
for(int i = 0 ; i < 10 ; i++) {
|
||||
myvh = mytds.create_vertex(myvh);
|
||||
myvh->set_wahou(myvh);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue