mirror of https://github.com/CGAL/cgal
various changes:
1. removed macros USE_KERNEL_PREDICATES, USE_BF, USE_MAP, USE_VECTOR, USE_INIT, USE_SET and USE_INPLACE_EDGE_LIST 2. number_of* methods return size_type 3. added the following predicates for sites: Compare_x_2, Compare_y_2 and Orientation_2 4. The second template parameter of the Segment_Voronoi_diagram_2 class no longer defaults to Point_container, but rather to std::list; the std::list is then wrapped to give the intented functionality; the concept of PC is: back-insertion sequence with non-mutable iterators 5. The (advanced) user can (sort of) choose what kind of map goes into the edge list; by default this is an STL map, but by changing the last template parameter the map switches to CGAL's Unique_hash_map 6. The (advanced) user can switch between optimizing speed and space by switching the last template parameter of the Segment_Voronoi_diagram_2 class; optimization with respect to speed implies the need for an in-place edge list but that approximately doubles the space requirements; optimization with respect to space means about 5% decrease in speed but much less memory and a simpler interface for the Segment_Voronoi diagram_face_base_2 class (in fact in this case the standard Triangulation_face_base_2 class will work as is). 7. removed unused typedef Face_face_map
This commit is contained in:
parent
ae971e89f4
commit
1f2d2aba4c
|
|
@ -1,4 +1,5 @@
|
|||
- make number_of* methods return a size_type
|
||||
- in the doc change the name of the template parameter for the
|
||||
point container from SC to PC.
|
||||
- add two different storage sites, one for the case of intersecting
|
||||
segments and one for the case of non-intersecting segments
|
||||
- add boolean parameter in Segment_Voronoi_diagram_2 class that indicates
|
||||
|
|
@ -15,38 +16,9 @@
|
|||
derive from that; the base class should accomodate different sites, other
|
||||
than points, and also have the capability of having a different type
|
||||
for storage and the actual site. Then derive from that.
|
||||
- move the definition of the Segment_Voronoi_diagram_hierarchy_vertex_base_2
|
||||
class in a separate file
|
||||
- add the methods insert_polyline and insert_polygon that do some
|
||||
optimized insertion for polylines and polygons; add these in both
|
||||
the one-level and hierarchy classes
|
||||
- remove the macro USE_KERNEL_PREDICATES from the traits classes, once
|
||||
the traits' interface is finalized
|
||||
- define the Orientation_2 predicate in the traits but for sites, not
|
||||
for points.
|
||||
- replace the Point_container class by a more generic class called
|
||||
Simple_container_wrapper; the Segment_Voronoi_diagram_2 class
|
||||
should take as template parameter the real container (by default
|
||||
std::list<typename Gt::Point_2>) and then inside wrap it.
|
||||
- remove the typedef for Face_face_map; it is not used
|
||||
- check if implementing the Face_map as an std::set<Face_handle> is faster
|
||||
than std::map<Face_handle,bool>.
|
||||
- add a boolean template parameter in the Segment_Voronoi_diagram_2
|
||||
that indicates if we want to optimize for space or time; in the case of space
|
||||
use the Edge_list class and a set in add_bogus_vertices; in the case of time
|
||||
use the In_place_edge_list_class and a vector in add_bogus_vertices
|
||||
- remove the macros USE_VECTOR, USE_SET from the add_bogus_vertices
|
||||
method of the Segment_Voronoi_diagram_2 class; use a set (which
|
||||
should be static)
|
||||
- remove the macros USE_BF, USE_STD_MAP and USE_INIT from the Edge_list
|
||||
class; change the class Edge_list so that it takes an additional
|
||||
boolean template parameter that indicates whether to use Unique_hash_map
|
||||
of CGAL, or STL's map; use the STL map by default
|
||||
- remove the macro USE_INPLACE_EDGE_LIST
|
||||
- check if using an STL map in place of the Unique_hash_map, the edge
|
||||
list runs faster. Also check if the Edge_vector, Vertex_map and
|
||||
Face_map can be replaced by implementations using the
|
||||
Unique_hash_map of CGAL.
|
||||
- fix the bug in insert_third for point
|
||||
- add the check for a segment intersecting an existing point and
|
||||
a point intersecting an existing segment.
|
||||
|
|
|
|||
|
|
@ -29,9 +29,9 @@ CGAL_BEGIN_NAMESPACE
|
|||
//--------------------------------------------------------------------
|
||||
// test method
|
||||
//--------------------------------------------------------------------
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
bool
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
is_valid(bool verbose, int level) const
|
||||
{
|
||||
if (level < 0) { return true; }
|
||||
|
|
@ -149,10 +149,10 @@ is_valid(bool verbose, int level) const
|
|||
//--------------------------------------------------------------------
|
||||
|
||||
// circumcenter
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
inline
|
||||
typename Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::Point
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
typename Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::Point
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
circumcenter(const Face_handle& f) const
|
||||
{
|
||||
CGAL_precondition( this->dimension()==2 || !is_infinite(f) );
|
||||
|
|
@ -161,10 +161,10 @@ circumcenter(const Face_handle& f) const
|
|||
f->vertex(2)->site());
|
||||
}
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
inline
|
||||
typename Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::Point
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
typename Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::Point
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
circumcenter(const Site& t0, const Site& t1,
|
||||
const Site& t2) const
|
||||
{
|
||||
|
|
@ -173,10 +173,10 @@ circumcenter(const Site& t0, const Site& t1,
|
|||
}
|
||||
|
||||
// circumcircle
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
inline
|
||||
typename Gt::Circle_2
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
circumcircle(const Face_handle& f) const
|
||||
{
|
||||
CGAL_precondition( this->dimension()==2 || !is_infinite(f) );
|
||||
|
|
@ -185,20 +185,20 @@ circumcircle(const Face_handle& f) const
|
|||
f->vertex(2)->site());
|
||||
}
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
inline
|
||||
typename Gt::Circle_2
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
circumcircle(const Site& t0, const Site& t1, const Site& t2) const
|
||||
{
|
||||
return Construct_svd_circle_2()(t0, t1, t2);
|
||||
}
|
||||
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
inline
|
||||
typename Gt::Line_2
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
circumcircle(const Point& p0, const Point& p1) const
|
||||
{
|
||||
return
|
||||
|
|
@ -207,20 +207,20 @@ circumcircle(const Point& p0, const Point& p1) const
|
|||
|
||||
|
||||
// primal
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
inline
|
||||
typename Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::Point
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
typename Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::Point
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
primal(const Face_handle& f) const
|
||||
{
|
||||
return circumcenter(f);
|
||||
}
|
||||
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
inline
|
||||
Object
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
primal(const Edge e) const
|
||||
{
|
||||
typedef typename Gt::Line_2 Line;
|
||||
|
|
@ -286,10 +286,10 @@ primal(const Edge e) const
|
|||
//--------------------------------------------------------------------
|
||||
// combinatorial operations
|
||||
//--------------------------------------------------------------------
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
inline
|
||||
typename Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::Edge
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
typename Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::Edge
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
flip(Face_handle& f, int i)
|
||||
{
|
||||
CGAL_precondition ( f != NULL );
|
||||
|
|
@ -303,20 +303,20 @@ flip(Face_handle& f, int i)
|
|||
return Edge(f, ccw(i));
|
||||
}
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
inline
|
||||
typename Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::Edge
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
typename Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::Edge
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
flip(Edge e)
|
||||
{
|
||||
return flip(e.first, e.second);
|
||||
}
|
||||
|
||||
/*
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
inline
|
||||
typename Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::Vertex_handle
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
typename Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::Vertex_handle
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
insert_in_face(Face_handle& f, const Weighted_point& p)
|
||||
{
|
||||
Vertex_handle v = ds().insert_in_face( f );
|
||||
|
|
@ -326,10 +326,10 @@ insert_in_face(Face_handle& f, const Weighted_point& p)
|
|||
}
|
||||
*/
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
inline
|
||||
bool
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
is_degree_2(const Vertex_handle& v) const
|
||||
{
|
||||
Face_circulator fc = v->incident_faces();
|
||||
|
|
@ -338,19 +338,19 @@ is_degree_2(const Vertex_handle& v) const
|
|||
return ( fc == fc1 );
|
||||
}
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
inline
|
||||
typename Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::Vertex_handle
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
typename Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::Vertex_handle
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
insert_degree_2(Edge e)
|
||||
{
|
||||
return this->_tds.insert_degree_2(e.first,e.second);
|
||||
}
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
inline
|
||||
typename Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::Vertex_handle
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
typename Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::Vertex_handle
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
insert_degree_2(Edge e, const Storage_site_2& ss)
|
||||
{
|
||||
Vertex_handle v = insert_degree_2(e);
|
||||
|
|
@ -358,10 +358,10 @@ insert_degree_2(Edge e, const Storage_site_2& ss)
|
|||
return v;
|
||||
}
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
inline
|
||||
void
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
remove_degree_2(Vertex_handle v)
|
||||
{
|
||||
CGAL_precondition( is_degree_2(v) );
|
||||
|
|
@ -371,20 +371,20 @@ remove_degree_2(Vertex_handle v)
|
|||
|
||||
|
||||
#if 0
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
inline
|
||||
void
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
remove_degree_3(Vertex_handle v)
|
||||
{
|
||||
remove_degree_3(v, NULL);
|
||||
}
|
||||
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
inline
|
||||
void
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
remove_degree_3(Vertex_handle v, Face* f)
|
||||
{
|
||||
CGAL_precondition( v->degree() == 3 );
|
||||
|
|
@ -396,10 +396,10 @@ remove_degree_3(Vertex_handle v, Face* f)
|
|||
// insertion of site
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
inline
|
||||
typename Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::Vertex_handle
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
typename Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::Vertex_handle
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
insert_first(const Point& p)
|
||||
{
|
||||
CGAL_precondition( number_of_vertices() == 0 );
|
||||
|
|
@ -412,10 +412,10 @@ insert_first(const Point& p)
|
|||
return v;
|
||||
}
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
inline
|
||||
typename Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::Vertex_handle
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
typename Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::Vertex_handle
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
insert_second(const Point& p)
|
||||
{
|
||||
CGAL_precondition( number_of_vertices() == 1 );
|
||||
|
|
@ -431,9 +431,9 @@ insert_second(const Point& p)
|
|||
return create_vertex_dim_up(ss);
|
||||
}
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
typename Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::Vertex_handle
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
typename Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::Vertex_handle
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
insert_third(const Point& p)
|
||||
{
|
||||
CGAL_precondition( number_of_vertices() == 2 );
|
||||
|
|
@ -444,8 +444,8 @@ insert_third(const Point& p)
|
|||
Site_2 t0 = finite_vertices_begin()->site();
|
||||
Site_2 t1 = (++finite_vertices_begin())->site();
|
||||
|
||||
// MK: change the equality test between points by the functor in
|
||||
// geometric traits
|
||||
// MK::ERROR: change the equality test between points by the functor
|
||||
// in geometric traits
|
||||
if ( are_same_points(t, t0) ) {
|
||||
return Vertex_handle(finite_vertices_begin());
|
||||
}
|
||||
|
|
@ -458,12 +458,12 @@ insert_third(const Point& p)
|
|||
|
||||
Face_handle f(finite_faces_begin());
|
||||
|
||||
Point p1 = f->vertex(0)->site().point();
|
||||
Point p2 = f->vertex(1)->site().point();
|
||||
Point p3 = f->vertex(2)->site().point();
|
||||
Site s1 = f->vertex(0)->site();
|
||||
Site s2 = f->vertex(1)->site();
|
||||
Site s3 = f->vertex(2)->site();
|
||||
|
||||
Orientation o =
|
||||
geom_traits().orientation_2_object()(p1, p2, p3);
|
||||
geom_traits().orientation_2_object()(s1, s2, s3);
|
||||
|
||||
if ( o != COLLINEAR ) {
|
||||
if ( o == RIGHT_TURN ) {
|
||||
|
|
@ -473,6 +473,7 @@ insert_third(const Point& p)
|
|||
}
|
||||
}
|
||||
} else {
|
||||
// MK::ERROR:
|
||||
// *************************URGENT***************************
|
||||
// Here I have to test for collinearlity... and maybe more
|
||||
// In particular the code works correctly if the triangle created by
|
||||
|
|
@ -483,9 +484,9 @@ insert_third(const Point& p)
|
|||
return v;
|
||||
}
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
typename Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::Vertex_handle
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
typename Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::Vertex_handle
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
//insert_third(const Point& p0, const Point & p1)
|
||||
insert_third(Vertex_handle v0, Vertex_handle v1)
|
||||
{
|
||||
|
|
@ -512,10 +513,10 @@ insert_third(Vertex_handle v0, Vertex_handle v1)
|
|||
}
|
||||
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
inline
|
||||
bool
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
do_intersect(const Site& t, Vertex_handle v) const
|
||||
{
|
||||
if ( is_infinite(v) ) { return false; }
|
||||
|
|
@ -535,9 +536,9 @@ do_intersect(const Site& t, Vertex_handle v) const
|
|||
return false;
|
||||
}
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
typename Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::Vertex_handle
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
typename Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::Vertex_handle
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
insert_point(const Point& p, Vertex_handle vnear)
|
||||
{
|
||||
if ( number_of_vertices() == 0 ) {
|
||||
|
|
@ -658,9 +659,9 @@ insert_point(const Point& p, Vertex_handle vnear)
|
|||
}
|
||||
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
typename Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::Vertex_handle
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
typename Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::Vertex_handle
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
insert_point(const Storage_site_2& ss, const Site& t,
|
||||
Vertex_handle vnear)
|
||||
{
|
||||
|
|
@ -784,9 +785,9 @@ insert_point(const Storage_site_2& ss, const Site& t,
|
|||
}
|
||||
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
typename Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::Vertex_handle
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
typename Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::Vertex_handle
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
insert_segment(const Site& t, Vertex_handle vnear,
|
||||
bool insert_endpoints)
|
||||
{
|
||||
|
|
@ -824,9 +825,9 @@ insert_segment(const Site& t, Vertex_handle vnear,
|
|||
}
|
||||
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
typename Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::Vertex_handle
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
typename Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::Vertex_handle
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
insert_segment2(const Site_2& t, const Storage_site_2& ss,
|
||||
Vertex_handle vnearest, bool insert_endpoints)
|
||||
{
|
||||
|
|
@ -975,9 +976,9 @@ insert_segment2(const Site_2& t, const Storage_site_2& ss,
|
|||
//--------------------------------------------------------------------
|
||||
// insertion of intersecting site
|
||||
//--------------------------------------------------------------------
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
typename Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::Vertex_handle
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
typename Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::Vertex_handle
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
insert_intersecting_segment(const Storage_site_2& ss,
|
||||
const Site_2& t, Vertex_handle v)
|
||||
{
|
||||
|
|
@ -1112,9 +1113,9 @@ insert_intersecting_segment(const Storage_site_2& ss,
|
|||
// find conflict region
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
void
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
initialize_conflict_region(const Face_handle& f, List& l)
|
||||
{
|
||||
|
||||
|
|
@ -1126,9 +1127,9 @@ initialize_conflict_region(const Face_handle& f, List& l)
|
|||
}
|
||||
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
void
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
expand_conflict_region(const Face_handle& f, const Site& t,
|
||||
const Storage_site_2& ss,
|
||||
List& l, Face_map& fm,
|
||||
|
|
@ -1235,9 +1236,9 @@ expand_conflict_region(const Face_handle& f, const Site& t,
|
|||
// retriangulate conflict region
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
typename Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::Vertex_handle
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
typename Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::Vertex_handle
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
add_bogus_vertex(Edge e, List& l)
|
||||
{
|
||||
Edge esym = sym_edge(e);
|
||||
|
|
@ -1269,88 +1270,43 @@ add_bogus_vertex(Edge e, List& l)
|
|||
return v;
|
||||
}
|
||||
|
||||
#define USE_VECTOR 0
|
||||
#define USE_SET 1
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
typename Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::Vertex_list
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
typename Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::Vertex_list
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
add_bogus_vertices(List& l)
|
||||
{
|
||||
Vertex_list vertex_list;
|
||||
|
||||
#define MK_STATIC static
|
||||
//#define MK_STATIC ;
|
||||
|
||||
#if USE_VECTOR
|
||||
MK_STATIC Edge_vector edge_list;
|
||||
#elif USE_SET
|
||||
MK_STATIC std::set<Edge> edge_list;
|
||||
#else
|
||||
MK_STATIC std::map<Edge,bool> edge_list;
|
||||
#endif
|
||||
static std::set<Edge> edge_list;
|
||||
|
||||
edge_list.clear();
|
||||
|
||||
Edge e_start = l.front();
|
||||
Edge e = e_start;
|
||||
#if USE_VECTOR
|
||||
do {
|
||||
Edge esym = sym_edge(e);
|
||||
if ( l.is_in_list(esym) ) {
|
||||
bool found(false);
|
||||
typename Edge_vector::iterator it;
|
||||
for (it = edge_list.begin(); it != edge_list.end(); ++it) {
|
||||
if ( *it == esym ) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( !found ) { edge_list.push_back(e); }
|
||||
}
|
||||
e = l.next(e);
|
||||
} while ( e != e_start );
|
||||
|
||||
typename Edge_vector::iterator it;
|
||||
#else
|
||||
do {
|
||||
Edge esym = sym_edge(e);
|
||||
if ( l.is_in_list(esym) &&
|
||||
edge_list.find(esym) == edge_list.end() ) {
|
||||
# if USE_SET
|
||||
edge_list.insert(e);
|
||||
# else
|
||||
edge_list[e] = true;
|
||||
# endif
|
||||
}
|
||||
e = l.next(e);
|
||||
} while ( e != e_start );
|
||||
|
||||
# if USE_SET
|
||||
typename std::set<Edge>::iterator it;
|
||||
# else
|
||||
typename std::map<Edge,bool>::iterator it;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
for (it = edge_list.begin(); it != edge_list.end(); ++it) {
|
||||
#if USE_VECTOR
|
||||
e = *it;
|
||||
#elif USE_SET
|
||||
e = *it;
|
||||
#else
|
||||
e = it->first;
|
||||
#endif
|
||||
Vertex_handle v = add_bogus_vertex(e, l);
|
||||
Vertex_handle v = add_bogus_vertex(*it, l);
|
||||
vertex_list.push_back(v);
|
||||
}
|
||||
|
||||
return vertex_list;
|
||||
}
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
void
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
remove_bogus_vertices(Vertex_list& vl)
|
||||
{
|
||||
while ( vl.size() > 0 ) {
|
||||
|
|
@ -1361,9 +1317,9 @@ remove_bogus_vertices(Vertex_list& vl)
|
|||
}
|
||||
|
||||
#if 0
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
std::vector<typename Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::Face*>
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
std::vector<typename Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::Face*>
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
get_faces_for_recycling(Face_map& fm, unsigned int n_wanted)
|
||||
{
|
||||
std::vector<Face*> vf;
|
||||
|
|
@ -1389,9 +1345,9 @@ get_faces_for_recycling(Face_map& fm, unsigned int n_wanted)
|
|||
}
|
||||
#endif
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
void
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
retriangulate_conflict_region(Vertex_handle v, List& l,
|
||||
Face_map& fm)
|
||||
{
|
||||
|
|
@ -1417,17 +1373,16 @@ retriangulate_conflict_region(Vertex_handle v, List& l,
|
|||
} while ( eit != e_start );
|
||||
|
||||
// std::vector<Face*> vf = get_faces_for_recycling(fm, l.size());
|
||||
std::list<Face*> vf;
|
||||
// std::list<Face*> vf;
|
||||
|
||||
// 3. copy the edge list to a vector of edges and clear the in place
|
||||
// 3. copy the edge list to a vector of edges and clear the edge
|
||||
// list
|
||||
typedef typename Svdds::Edge Svdds_edge;
|
||||
std::vector<Svdds_edge> ve;
|
||||
std::vector<Edge> ve;
|
||||
|
||||
Edge efront = l.front();
|
||||
Edge e = efront;
|
||||
do {
|
||||
ve.push_back(Svdds_edge(e.first, e.second));
|
||||
ve.push_back(e);
|
||||
e = l.next(e);
|
||||
} while ( e != efront );
|
||||
|
||||
|
|
@ -1458,9 +1413,9 @@ retriangulate_conflict_region(Vertex_handle v, List& l,
|
|||
//--------------------------------------------------------------------
|
||||
// point location
|
||||
//--------------------------------------------------------------------
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
typename Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::Vertex_handle
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
typename Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::Vertex_handle
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
nearest_neighbor(const Site_2& p,
|
||||
Vertex_handle start_vertex) const
|
||||
{
|
||||
|
|
@ -1541,17 +1496,17 @@ nearest_neighbor(const Site_2& p,
|
|||
//----------------------------------------------------------------------
|
||||
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
inline bool
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
are_same_points(const Site_2& p, const Site_2& q) const
|
||||
{
|
||||
return geom_traits().are_same_points_2_object()(p, q);
|
||||
}
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
inline bool
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
same_segments(const Site_2& t, Vertex_handle v) const
|
||||
{
|
||||
if ( is_infinite(v) ) { return false; }
|
||||
|
|
@ -1559,9 +1514,9 @@ same_segments(const Site_2& t, Vertex_handle v) const
|
|||
return same_segments(t, v->site());
|
||||
}
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
inline bool
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
same_segments(const Site_2& p, const Site_2& q) const
|
||||
{
|
||||
CGAL_precondition( p.is_segment() && q.is_segment() );
|
||||
|
|
@ -1573,9 +1528,9 @@ same_segments(const Site_2& p, const Site_2& q) const
|
|||
are_same_points(p.target_site(), q.source_site()));
|
||||
}
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
inline Oriented_side
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
side_of_bisector(const Site &t1, const Site &t2, const Site &q) const
|
||||
{
|
||||
#if 0
|
||||
|
|
@ -1590,18 +1545,18 @@ side_of_bisector(const Site &t1, const Site &t2, const Site &q) const
|
|||
}
|
||||
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
inline Sign
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
incircle(const Site &t1, const Site &t2,
|
||||
const Site &t3, const Site &q) const
|
||||
{
|
||||
return geom_traits().vertex_conflict_2_object()(t1, t2, t3, q);
|
||||
}
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
inline Sign
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
incircle(const Site &t1, const Site &t2,
|
||||
const Site &q) const
|
||||
{
|
||||
|
|
@ -1610,9 +1565,9 @@ incircle(const Site &t1, const Site &t2,
|
|||
}
|
||||
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
Sign
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
incircle(const Face_handle& f, const Site& q) const
|
||||
{
|
||||
if ( !is_infinite(f) ) {
|
||||
|
|
@ -1633,9 +1588,9 @@ incircle(const Face_handle& f, const Site& q) const
|
|||
}
|
||||
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
inline Sign
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
incircle(const Vertex_handle& v0, const Vertex_handle& v1,
|
||||
const Vertex_handle& v) const
|
||||
{
|
||||
|
|
@ -1645,9 +1600,9 @@ incircle(const Vertex_handle& v0, const Vertex_handle& v1,
|
|||
return incircle( v0->site(), v1->site(), v->site());
|
||||
}
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
Sign
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
incircle(const Vertex_handle& v0, const Vertex_handle& v1,
|
||||
const Vertex_handle& v2, const Vertex_handle& v) const
|
||||
{
|
||||
|
|
@ -1674,9 +1629,9 @@ incircle(const Vertex_handle& v0, const Vertex_handle& v1,
|
|||
}
|
||||
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
inline bool
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
finite_edge_interior(const Site& t1, const Site& t2,
|
||||
const Site& t3, const Site& t4,
|
||||
const Site& q, Sign sgn) const
|
||||
|
|
@ -1685,9 +1640,9 @@ finite_edge_interior(const Site& t1, const Site& t2,
|
|||
geom_traits().finite_edge_interior_conflict_2_object()(t1,t2,t3,t4,q,sgn);
|
||||
}
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
inline bool
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
finite_edge_interior(const Face_handle& f, int i,
|
||||
const Site& q, Sign sgn) const
|
||||
{
|
||||
|
|
@ -1699,9 +1654,9 @@ finite_edge_interior(const Face_handle& f, int i,
|
|||
f->mirror_vertex(i)->site(), q, sgn);
|
||||
}
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
inline bool
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
finite_edge_interior(const Vertex_handle& v1,
|
||||
const Vertex_handle& v2,
|
||||
const Vertex_handle& v3,
|
||||
|
|
@ -1716,9 +1671,9 @@ finite_edge_interior(const Vertex_handle& v1,
|
|||
v->site(), sgn);
|
||||
}
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
inline bool
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
finite_edge_interior_degenerated(const Site& t1, const Site& t2,
|
||||
const Site& t3, const Site& q,
|
||||
Sign sgn) const
|
||||
|
|
@ -1727,9 +1682,9 @@ finite_edge_interior_degenerated(const Site& t1, const Site& t2,
|
|||
geom_traits().finite_edge_interior_conflict_2_object()(t1,t2,t3,q,sgn);
|
||||
}
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
inline bool
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
finite_edge_interior_degenerated(const Site& t1, const Site& t2,
|
||||
const Site& q, Sign sgn) const
|
||||
{
|
||||
|
|
@ -1738,9 +1693,9 @@ finite_edge_interior_degenerated(const Site& t1, const Site& t2,
|
|||
}
|
||||
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
bool
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
finite_edge_interior_degenerated(const Face_handle& f, int i,
|
||||
const Site& q, Sign sgn) const
|
||||
{
|
||||
|
|
@ -1766,9 +1721,9 @@ finite_edge_interior_degenerated(const Face_handle& f, int i,
|
|||
return finite_edge_interior_degenerated(t1, t2, t3, q, sgn);
|
||||
}
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
bool
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
finite_edge_interior_degenerated(const Vertex_handle& v1,
|
||||
const Vertex_handle& v2,
|
||||
const Vertex_handle& v3,
|
||||
|
|
@ -1798,9 +1753,9 @@ finite_edge_interior_degenerated(const Vertex_handle& v1,
|
|||
return finite_edge_interior_degenerated(t1, t2, t3, q, sgn);
|
||||
}
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
inline bool
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
infinite_edge_interior(const Site& t2, const Site& t3,
|
||||
const Site& t4, const Site& q, Sign sgn) const
|
||||
{
|
||||
|
|
@ -1808,9 +1763,9 @@ infinite_edge_interior(const Site& t2, const Site& t3,
|
|||
geom_traits().infinite_edge_interior_conflict_2_object()(t2,t3,t4,q,sgn);
|
||||
}
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
bool
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
infinite_edge_interior(const Face_handle& f, int i,
|
||||
const Site& q, Sign sgn) const
|
||||
{
|
||||
|
|
@ -1832,9 +1787,9 @@ infinite_edge_interior(const Face_handle& f, int i,
|
|||
}
|
||||
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
bool
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
infinite_edge_interior(const Vertex_handle& v1,
|
||||
const Vertex_handle& v2,
|
||||
const Vertex_handle& v3,
|
||||
|
|
@ -1863,9 +1818,9 @@ infinite_edge_interior(const Vertex_handle& v1,
|
|||
|
||||
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
bool
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
edge_interior(const Vertex_handle& v1,
|
||||
const Vertex_handle& v2,
|
||||
const Vertex_handle& v3,
|
||||
|
|
@ -1893,9 +1848,9 @@ edge_interior(const Vertex_handle& v1,
|
|||
}
|
||||
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
bool
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
edge_interior(const Face_handle& f, int i,
|
||||
const Site& q, Sign sgn) const
|
||||
{
|
||||
|
|
@ -1923,9 +1878,9 @@ edge_interior(const Face_handle& f, int i,
|
|||
}
|
||||
|
||||
/*
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
typename Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::Conflict_type
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
typename Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::Conflict_type
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
finite_edge_conflict_type_degenerated(const Weighted_point& p1,
|
||||
const Weighted_point& p2,
|
||||
const Weighted_point& q) const
|
||||
|
|
@ -1961,11 +1916,11 @@ finite_edge_conflict_type_degenerated(const Weighted_point& p1,
|
|||
// methods for disk removal
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
std::pair<
|
||||
typename Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::Vertex_handle,
|
||||
typename Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::Vertex_handle >
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
typename Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::Vertex_handle,
|
||||
typename Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::Vertex_handle >
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
endpoint_vertices(Vertex_handle v) const
|
||||
{
|
||||
CGAL_precondition( v->is_segment() );
|
||||
|
|
@ -1992,9 +1947,9 @@ endpoint_vertices(Vertex_handle v) const
|
|||
return vertices;
|
||||
}
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
bool
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
is_endpoint_of_segment(Vertex_handle v) const
|
||||
{
|
||||
if ( v->is_segment() ) { return false; }
|
||||
|
|
@ -2017,25 +1972,25 @@ is_endpoint_of_segment(Vertex_handle v) const
|
|||
}
|
||||
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
void
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
remove_first(Vertex_handle v)
|
||||
{
|
||||
Delaunay_graph::remove_first(v);
|
||||
}
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
void
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
remove_second(Vertex_handle v)
|
||||
{
|
||||
Delaunay_graph::remove_second(v);
|
||||
}
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
unsigned int
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
remove_third(Vertex_handle v, bool remove_endpoints)
|
||||
{
|
||||
if ( is_endpoint_of_segment(v) ) { return 0; }
|
||||
|
|
@ -2070,9 +2025,9 @@ remove_third(Vertex_handle v, bool remove_endpoints)
|
|||
}
|
||||
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
unsigned int
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
remove(Vertex_handle v, bool remove_endpoints)
|
||||
{
|
||||
CGAL_precondition( v != Vertex_handle(NULL) );
|
||||
|
|
@ -2104,9 +2059,9 @@ remove(Vertex_handle v, bool remove_endpoints)
|
|||
return num_removed;
|
||||
}
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
unsigned int
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
remove_degree_2(Vertex_handle v, bool remove_endpoints)
|
||||
{
|
||||
// segments are at least of degree 4
|
||||
|
|
@ -2119,9 +2074,9 @@ remove_degree_2(Vertex_handle v, bool remove_endpoints)
|
|||
}
|
||||
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
unsigned int
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
remove_degree_3(Vertex_handle v, bool remove_endpoints)
|
||||
{
|
||||
// segments are at least of degree 4
|
||||
|
|
@ -2133,9 +2088,9 @@ remove_degree_3(Vertex_handle v, bool remove_endpoints)
|
|||
return 1;
|
||||
}
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
unsigned int
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
remove_degree_d(Vertex_handle v, bool remove_endpoints)
|
||||
{
|
||||
if ( v->is_segment() && remove_endpoints ) {
|
||||
|
|
@ -2162,7 +2117,7 @@ remove_degree_d(Vertex_handle v, bool remove_endpoints)
|
|||
return remove_degree_2(v, remove_endpoints);
|
||||
}
|
||||
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds> svd_small;
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag> svd_small;
|
||||
|
||||
std::map<Vertex_handle,Vertex_handle> vmap;
|
||||
|
||||
|
|
@ -2273,9 +2228,9 @@ remove_degree_d(Vertex_handle v, bool remove_endpoints)
|
|||
}
|
||||
|
||||
/*
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
void
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
remove_degree_d_vertex(Vertex_handle v)
|
||||
{
|
||||
minimize_degree(v);
|
||||
|
|
@ -2289,7 +2244,7 @@ remove_degree_d_vertex(Vertex_handle v)
|
|||
return;
|
||||
}
|
||||
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds> ag_small;
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag> ag_small;
|
||||
|
||||
std::map<Vertex_handle,Vertex_handle> vmap;
|
||||
|
||||
|
|
@ -2375,9 +2330,9 @@ remove_degree_d_vertex(Vertex_handle v)
|
|||
}
|
||||
*/
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
void
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
minimize_degree(Vertex_handle v)
|
||||
{
|
||||
CGAL_precondition ( v->degree() > 3 );
|
||||
|
|
@ -2416,9 +2371,9 @@ minimize_degree(Vertex_handle v)
|
|||
} while ( found || fc != fc_start );
|
||||
}
|
||||
#if 0
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
void
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
find_conflict_region_remove(const Vertex_handle& v,
|
||||
const Vertex_handle& vnearest,
|
||||
List& l, Face_map& fm,
|
||||
|
|
@ -2490,10 +2445,10 @@ find_conflict_region_remove(const Vertex_handle& v,
|
|||
//----------------------------------------------------------------------
|
||||
|
||||
|
||||
template< class Gt, class PContainer, class Svdds >
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
typename
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::size_type
|
||||
Segment_Voronoi_diagram_2<Gt,PContainer,Svdds>::
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::size_type
|
||||
Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>::
|
||||
number_of_incident_segments(Vertex_handle v) const
|
||||
{
|
||||
CGAL_precondition( v->is_point() );
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@
|
|||
#include <CGAL/edge_list.h>
|
||||
#include <CGAL/Segment_Voronoi_diagram_traits_wrapper_2.h>
|
||||
|
||||
#include <CGAL/Point_container.h>
|
||||
#include <CGAL/Simple_container_wrapper.h>
|
||||
|
||||
/*
|
||||
Conventions:
|
||||
|
|
@ -58,21 +58,53 @@
|
|||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
template< class Gt, class PContainer, class DS >
|
||||
|
||||
namespace CGALi {
|
||||
|
||||
template<typename Edge, typename LTag> struct SVD_which_list;
|
||||
|
||||
// use the in-place edge list
|
||||
template<typename E>
|
||||
struct SVD_which_list<E,Tag_true>
|
||||
{
|
||||
typedef E Edge;
|
||||
typedef In_place_edge_list<Edge> List;
|
||||
};
|
||||
|
||||
// do not use the in-place edge list
|
||||
template<typename E>
|
||||
struct SVD_which_list<E,Tag_false>
|
||||
{
|
||||
typedef E Edge;
|
||||
// change the following to Tag_false in order to use
|
||||
// CGAL's Unique_hash_map
|
||||
typedef Tag_true Use_stl_map_tag;
|
||||
typedef Edge_list<Edge,Use_stl_map_tag> List;
|
||||
};
|
||||
|
||||
|
||||
} // namespace CGALi
|
||||
|
||||
|
||||
|
||||
|
||||
template<class Gt, class PC, class DS, class LTag >
|
||||
class Segment_Voronoi_diagram_hierarchy_2;
|
||||
|
||||
// typename PC = Point_container<typename Gt::Point_2>,
|
||||
// typename PC = Point_container<typename Gt::Point_2>,
|
||||
|
||||
template < class Gt,
|
||||
class PContainer = Point_container<typename Gt::Point_2>,
|
||||
class DS = Segment_Voronoi_diagram_data_structure_2 <
|
||||
Segment_Voronoi_diagram_vertex_base_2<Gt,
|
||||
typename PContainer::Point_handle>,
|
||||
Segment_Voronoi_diagram_face_base_2<Gt> > >
|
||||
template<class Gt,
|
||||
class PC = std::list<typename Gt::Point_2>,
|
||||
class DS = Segment_Voronoi_diagram_data_structure_2 <
|
||||
Segment_Voronoi_diagram_vertex_base_2<Gt,PC>,
|
||||
Segment_Voronoi_diagram_face_base_2<Gt> >,
|
||||
class LTag = Tag_false >
|
||||
class Segment_Voronoi_diagram_2
|
||||
: private Triangulation_2<
|
||||
Segment_Voronoi_diagram_traits_wrapper_2<Gt>, DS >
|
||||
{
|
||||
friend class Segment_Voronoi_diagram_hierarchy_2<Gt,PContainer,DS>;
|
||||
friend class Segment_Voronoi_diagram_hierarchy_2<Gt,PC,DS,LTag>;
|
||||
protected:
|
||||
bool intersection_flag;
|
||||
|
||||
|
|
@ -133,6 +165,8 @@ protected:
|
|||
typedef typename DG::Vertex Vertex;
|
||||
typedef typename DG::Face Face;
|
||||
|
||||
typedef LTag Use_in_place_edge_list_tag;
|
||||
|
||||
public:
|
||||
// TYPES
|
||||
//------
|
||||
|
|
@ -158,17 +192,16 @@ public:
|
|||
typedef typename DG::All_edges_iterator All_edges_iterator;
|
||||
typedef typename DG::Finite_edges_iterator Finite_edges_iterator;
|
||||
|
||||
typedef Point_container<Point> Point_container;
|
||||
typedef typename Point_container::Point_handle Point_handle;
|
||||
typedef Simple_container_wrapper<PC> Point_container;
|
||||
typedef typename Point_container::iterator Point_handle;
|
||||
|
||||
typedef typename DG::size_type size_type;
|
||||
typedef typename DG::size_type size_type;
|
||||
|
||||
protected:
|
||||
// some more local types
|
||||
typedef typename DS::Vertex_base Vertex_base;
|
||||
|
||||
typedef std::map<Face_handle,bool> Face_map;
|
||||
typedef std::map<Face_handle, Face_handle> Face_face_map;
|
||||
typedef std::vector<Edge> Edge_vector;
|
||||
|
||||
typedef std::list<Vertex_handle> Vertex_list;
|
||||
|
|
@ -179,11 +212,8 @@ protected:
|
|||
typename Data_structure::Vertex_base::Storage_site_2 Storage_site_2;
|
||||
|
||||
// the in place edge list
|
||||
#ifdef USE_INPLACE_EDGE_LIST
|
||||
typedef In_place_edge_list<Edge> List;
|
||||
#else
|
||||
typedef Edge_list<Edge> List;
|
||||
#endif
|
||||
typedef typename
|
||||
CGALi::SVD_which_list<Edge,Use_in_place_edge_list_tag>::List List;
|
||||
|
||||
typedef enum { NO_CONFLICT = -1, INTERIOR, LEFT_VERTEX,
|
||||
RIGHT_VERTEX, BOTH_VERTICES, ENTIRE_EDGE }
|
||||
|
|
|
|||
|
|
@ -24,49 +24,69 @@
|
|||
#define CGAL_SEGMENT_VORONOI_DIAGRAM_FACE_BASE_2_H
|
||||
|
||||
#include <CGAL/Triangulation_ds_face_base_2.h>
|
||||
#include <CGAL/Triangulation_face_base_2.h>
|
||||
//#include <CGAL/Triangulation_face_base_with_edges_2.h>
|
||||
#include <CGAL/Apollonius_graph_face_base_2.h>
|
||||
|
||||
#ifdef USE_INPLACE_EDGE_LIST
|
||||
# include <CGAL/Apollonius_graph_face_base_2.h>
|
||||
#endif
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
#ifdef USE_INPLACE_EDGE_LIST
|
||||
template <class Gt,
|
||||
class Fb = Triangulation_ds_face_base_2<> >
|
||||
class Segment_Voronoi_diagram_face_base_2
|
||||
: public Apollonius_graph_face_base_2<Gt,Fb>
|
||||
{};
|
||||
namespace CGALi {
|
||||
|
||||
#else
|
||||
template<class Gt, class Fb, class ADD_EDGES_Tag>
|
||||
struct SVDFB2_Which_base;
|
||||
|
||||
template <class Gt,
|
||||
class Fb = Triangulation_ds_face_base_2<> >
|
||||
|
||||
template<class Gt, class Fb>
|
||||
struct SVDFB2_Which_base<Gt,Fb,Tag_true>
|
||||
{
|
||||
// MK::ERROR: replace the Apollonius_graph_face_base_2 class by the
|
||||
// more generic one: Triangulation_face_base_with_edges_2
|
||||
// typedef Triangulation_face_base_with_edges_2<Gt,Fb> Base;
|
||||
|
||||
typedef Apollonius_graph_face_base_2<Gt,Fb> Base;
|
||||
};
|
||||
|
||||
template<class Gt, class Fb>
|
||||
struct SVDFB2_Which_base<Gt,Fb,Tag_false>
|
||||
{
|
||||
typedef Triangulation_face_base_2<Gt,Fb> Base;
|
||||
};
|
||||
|
||||
} // namespace CGALi
|
||||
|
||||
|
||||
|
||||
template<class Gt,
|
||||
class Fb = Triangulation_ds_face_base_2<>,
|
||||
class ADD_EDGES_Tag = Tag_false>
|
||||
class Segment_Voronoi_diagram_face_base_2
|
||||
: public Fb
|
||||
: public CGALi::SVDFB2_Which_base<Gt,Fb,ADD_EDGES_Tag>::Base
|
||||
{
|
||||
protected:
|
||||
// local types
|
||||
typedef typename Fb::Triangulation_data_structure SVDDS;
|
||||
typedef typename Fb::Triangulation_data_structure DS;
|
||||
|
||||
public:
|
||||
// TYPES
|
||||
//------
|
||||
typedef Gt Geom_traits;
|
||||
typedef Fb Base;
|
||||
typedef typename
|
||||
CGALi::SVDFB2_Which_base<Gt,Fb,ADD_EDGES_Tag>::Base Base;
|
||||
// typedef Fb Base;
|
||||
|
||||
typedef SVDDS Segment_Voronoi_diagram_data_structure_2;
|
||||
typedef DS Segment_Voronoi_diagram_data_structure_2;
|
||||
|
||||
typedef typename SVDDS::Vertex_handle Vertex_handle;
|
||||
typedef typename SVDDS::Face_handle Face_handle;
|
||||
typedef typename SVDDS::Edge Edge;
|
||||
typedef typename DS::Vertex_handle Vertex_handle;
|
||||
typedef typename DS::Face_handle Face_handle;
|
||||
typedef typename DS::Edge Edge;
|
||||
|
||||
|
||||
template <typename SVDDS2>
|
||||
template <typename DS2>
|
||||
struct Rebind_TDS {
|
||||
typedef typename Fb::template Rebind_TDS<SVDDS2>::Other Vb2;
|
||||
typedef Segment_Voronoi_diagram_face_base_2<Gt,Vb2> Other;
|
||||
typedef typename Fb::template Rebind_TDS<DS2>::Other Vb2;
|
||||
typedef Segment_Voronoi_diagram_face_base_2<Gt,Vb2> Other;
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -89,7 +109,6 @@ public:
|
|||
: Base(v0,v1,v2,n0,n1,n2) {}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
CGAL_END_NAMESPACE
|
||||
|
||||
|
|
|
|||
|
|
@ -192,12 +192,9 @@ private:
|
|||
//-------------------------------
|
||||
|
||||
// Predicates for the filtering kernel
|
||||
|
||||
#ifdef USE_KERNEL_PREDICATES
|
||||
typedef typename FK_traits::Compare_x_2 FK_Compare_x_2;
|
||||
typedef typename FK_traits::Compare_y_2 FK_Compare_y_2;
|
||||
typedef typename FK_traits::Orientation_2 FK_Orientation_2;
|
||||
#endif
|
||||
typedef typename FK_traits::Are_same_points_2 FK_Are_same_points_2;
|
||||
typedef typename FK_traits::Are_parallel_2 FK_Are_parallel_2;
|
||||
|
||||
|
|
@ -219,11 +216,9 @@ private:
|
|||
typedef typename FK_traits::Oriented_side_2 FK_Oriented_side_2;
|
||||
|
||||
// Predicates for the exact kernel
|
||||
#ifdef USE_KERNEL_PREDICATES
|
||||
typedef typename EK_traits::Compare_x_2 EK_Compare_x_2;
|
||||
typedef typename EK_traits::Compare_y_2 EK_Compare_y_2;
|
||||
typedef typename EK_traits::Orientation_2 EK_Orientation_2;
|
||||
#endif
|
||||
typedef typename EK_traits::Are_same_points_2 EK_Are_same_points_2;
|
||||
typedef typename EK_traits::Are_parallel_2 EK_Are_parallel_2;
|
||||
|
||||
|
|
@ -249,7 +244,6 @@ private:
|
|||
public:
|
||||
// PREDICATES
|
||||
//-----------
|
||||
#ifdef USE_KERNEL_PREDICATES
|
||||
typedef
|
||||
Filtered_predicate<EK_Compare_x_2, FK_Compare_x_2, C2E, C2F>
|
||||
Compare_x_2;
|
||||
|
|
@ -261,7 +255,7 @@ public:
|
|||
typedef
|
||||
Filtered_predicate<EK_Orientation_2, FK_Orientation_2, C2E, C2F>
|
||||
Orientation_2;
|
||||
#endif
|
||||
|
||||
typedef
|
||||
Filtered_predicate<EK_Are_same_points_2,
|
||||
FK_Are_same_points_2, C2E, C2F>
|
||||
|
|
@ -325,7 +319,6 @@ public:
|
|||
|
||||
// PREDICATES
|
||||
//-----------
|
||||
#ifdef USE_KERNEL_PREDICATES
|
||||
Compare_x_2
|
||||
compare_x_2_object() const {
|
||||
return Compare_x_2();
|
||||
|
|
@ -340,7 +333,7 @@ public:
|
|||
orientation_2_object() const {
|
||||
return Orientation_2();
|
||||
}
|
||||
#endif
|
||||
|
||||
Are_same_points_2
|
||||
are_same_points_2_object() const {
|
||||
return Are_same_points_2();
|
||||
|
|
|
|||
|
|
@ -49,17 +49,17 @@ const unsigned int svd_hierarchy_2__maxlevel = 5;
|
|||
//--------------------------------------------------------------------
|
||||
|
||||
template < class Gt,
|
||||
class PContainer = Point_container<typename Gt::Point_2>,
|
||||
class Tds = Segment_Voronoi_diagram_data_structure_2<
|
||||
Segment_Voronoi_diagram_hierarchy_vertex_base_2<
|
||||
Segment_Voronoi_diagram_vertex_base_2<Gt,
|
||||
typename PContainer::Point_handle> >,
|
||||
Segment_Voronoi_diagram_face_base_2<Gt> > >
|
||||
class PC = std::list<typename Gt::Point_2>,
|
||||
class DS = Segment_Voronoi_diagram_data_structure_2<
|
||||
Segment_Voronoi_diagram_hierarchy_vertex_base_2<
|
||||
Segment_Voronoi_diagram_vertex_base_2<Gt,PC> >,
|
||||
Segment_Voronoi_diagram_face_base_2<Gt> >,
|
||||
class LTag = Tag_false>
|
||||
class Segment_Voronoi_diagram_hierarchy_2
|
||||
: public Segment_Voronoi_diagram_2<Gt,PContainer,Tds>
|
||||
: public Segment_Voronoi_diagram_2<Gt,PC,DS,LTag>
|
||||
{
|
||||
public:
|
||||
typedef Segment_Voronoi_diagram_2<Gt,PContainer,Tds> Base;
|
||||
typedef Segment_Voronoi_diagram_2<Gt,PC,DS,LTag> Base;
|
||||
|
||||
typedef typename Base::Geom_traits Geom_traits;
|
||||
|
||||
|
|
@ -177,14 +177,15 @@ private:
|
|||
int random_level();
|
||||
};
|
||||
|
||||
template<class Gt, class P, class Tds>
|
||||
const int Segment_Voronoi_diagram_hierarchy_2<Gt,P,Tds>::UNDEFINED_LEVEL = -1;
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
const int
|
||||
Segment_Voronoi_diagram_hierarchy_2<Gt,PC,DS,LTag>::UNDEFINED_LEVEL = -1;
|
||||
|
||||
//**************************************************************************
|
||||
//**************************************************************************
|
||||
|
||||
template<class Gt, class P, class Tds>
|
||||
Segment_Voronoi_diagram_hierarchy_2<Gt,P,Tds>::
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
Segment_Voronoi_diagram_hierarchy_2<Gt,PC,DS,LTag>::
|
||||
Segment_Voronoi_diagram_hierarchy_2(const Geom_traits& traits)
|
||||
: Base(traits), random((long)0)
|
||||
{
|
||||
|
|
@ -195,10 +196,10 @@ Segment_Voronoi_diagram_hierarchy_2(const Geom_traits& traits)
|
|||
|
||||
|
||||
// copy constructor duplicates vertices and faces
|
||||
template<class Gt, class P, class Tds>
|
||||
Segment_Voronoi_diagram_hierarchy_2<Gt,P,Tds>::
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
Segment_Voronoi_diagram_hierarchy_2<Gt,PC,DS,LTag>::
|
||||
Segment_Voronoi_diagram_hierarchy_2
|
||||
(const Segment_Voronoi_diagram_hierarchy_2<Gt,P,Tds> &svd)
|
||||
(const Segment_Voronoi_diagram_hierarchy_2<Gt,PC,DS,LTag> &svd)
|
||||
: Base(), random((long)0)
|
||||
{
|
||||
// create an empty triangulation to be able to delete it !
|
||||
|
|
@ -210,20 +211,20 @@ Segment_Voronoi_diagram_hierarchy_2
|
|||
|
||||
|
||||
//Assignement
|
||||
template<class Gt, class P, class Tds>
|
||||
Segment_Voronoi_diagram_hierarchy_2<Gt,P,Tds> &
|
||||
Segment_Voronoi_diagram_hierarchy_2<Gt,P,Tds>::
|
||||
operator=(const Segment_Voronoi_diagram_hierarchy_2<Gt,P,Tds> &svd)
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
Segment_Voronoi_diagram_hierarchy_2<Gt,PC,DS,LTag> &
|
||||
Segment_Voronoi_diagram_hierarchy_2<Gt,PC,DS,LTag>::
|
||||
operator=(const Segment_Voronoi_diagram_hierarchy_2<Gt,PC,DS,LTag> &svd)
|
||||
{
|
||||
copy_triangulation(svd);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<class Gt, class P, class Tds>
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
void
|
||||
Segment_Voronoi_diagram_hierarchy_2<Gt,P,Tds>::
|
||||
Segment_Voronoi_diagram_hierarchy_2<Gt,PC,DS,LTag>::
|
||||
copy_triangulation
|
||||
(const Segment_Voronoi_diagram_hierarchy_2<Gt,P,Tds> &svd)
|
||||
(const Segment_Voronoi_diagram_hierarchy_2<Gt,PC,DS,LTag> &svd)
|
||||
{
|
||||
std::map< Vertex_handle, Vertex_handle > V;
|
||||
{
|
||||
|
|
@ -258,8 +259,8 @@ copy_triangulation
|
|||
hierarchy[0]->pc_ = svd.hierarchy[0]->pc_;
|
||||
}
|
||||
|
||||
template<class Gt, class P, class Tds>
|
||||
Segment_Voronoi_diagram_hierarchy_2<Gt,P,Tds>::
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
Segment_Voronoi_diagram_hierarchy_2<Gt,PC,DS,LTag>::
|
||||
~Segment_Voronoi_diagram_hierarchy_2()
|
||||
{
|
||||
clear();
|
||||
|
|
@ -268,9 +269,9 @@ Segment_Voronoi_diagram_hierarchy_2<Gt,P,Tds>::
|
|||
}
|
||||
}
|
||||
|
||||
template<class Gt, class P, class Tds>
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
void
|
||||
Segment_Voronoi_diagram_hierarchy_2<Gt,P,Tds>::
|
||||
Segment_Voronoi_diagram_hierarchy_2<Gt,PC,DS,LTag>::
|
||||
clear()
|
||||
{
|
||||
for(unsigned int i = 0; i < svd_hierarchy_2__maxlevel; ++i) {
|
||||
|
|
@ -278,19 +279,19 @@ clear()
|
|||
}
|
||||
}
|
||||
|
||||
template<class Gt, class P, class Tds>
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
inline
|
||||
typename Segment_Voronoi_diagram_hierarchy_2<Gt,P,Tds>::Vertex_handle
|
||||
Segment_Voronoi_diagram_hierarchy_2<Gt,P,Tds>::
|
||||
typename Segment_Voronoi_diagram_hierarchy_2<Gt,PC,DS,LTag>::Vertex_handle
|
||||
Segment_Voronoi_diagram_hierarchy_2<Gt,PC,DS,LTag>::
|
||||
insert(const Point& p)
|
||||
{
|
||||
return insert_point(p, UNDEFINED_LEVEL);
|
||||
}
|
||||
|
||||
template<class Gt, class P, class Tds>
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
inline
|
||||
typename Segment_Voronoi_diagram_hierarchy_2<Gt,P,Tds>::Vertex_handle
|
||||
Segment_Voronoi_diagram_hierarchy_2<Gt,P,Tds>::
|
||||
typename Segment_Voronoi_diagram_hierarchy_2<Gt,PC,DS,LTag>::Vertex_handle
|
||||
Segment_Voronoi_diagram_hierarchy_2<Gt,PC,DS,LTag>::
|
||||
insert_point(const Point& p, int level)
|
||||
|
||||
{
|
||||
|
|
@ -305,9 +306,9 @@ insert_point(const Point& p, int level)
|
|||
return vertices[0];
|
||||
}
|
||||
|
||||
template<class Gt, class P, class Tds>
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
void
|
||||
Segment_Voronoi_diagram_hierarchy_2<Gt,P,Tds>::
|
||||
Segment_Voronoi_diagram_hierarchy_2<Gt,PC,DS,LTag>::
|
||||
insert_point(const Point& p, int level, Vertex_handle* vertices)
|
||||
{
|
||||
CGAL_precondition( level != UNDEFINED_LEVEL );
|
||||
|
|
@ -342,19 +343,19 @@ insert_point(const Point& p, int level, Vertex_handle* vertices)
|
|||
}
|
||||
|
||||
|
||||
template<class Gt, class P, class Tds>
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
inline
|
||||
typename Segment_Voronoi_diagram_hierarchy_2<Gt,P,Tds>::Vertex_handle
|
||||
Segment_Voronoi_diagram_hierarchy_2<Gt,P,Tds>::
|
||||
typename Segment_Voronoi_diagram_hierarchy_2<Gt,PC,DS,LTag>::Vertex_handle
|
||||
Segment_Voronoi_diagram_hierarchy_2<Gt,PC,DS,LTag>::
|
||||
insert(const Point& p0, const Point& p1)
|
||||
{
|
||||
return insert_segment(p0, p1, UNDEFINED_LEVEL);
|
||||
}
|
||||
|
||||
|
||||
template<class Gt, class P, class Tds>
|
||||
typename Segment_Voronoi_diagram_hierarchy_2<Gt,P,Tds>::Vertex_handle
|
||||
Segment_Voronoi_diagram_hierarchy_2<Gt,P,Tds>::
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
typename Segment_Voronoi_diagram_hierarchy_2<Gt,PC,DS,LTag>::Vertex_handle
|
||||
Segment_Voronoi_diagram_hierarchy_2<Gt,PC,DS,LTag>::
|
||||
insert_segment(const Point& p0, const Point& p1, int level)
|
||||
{
|
||||
if ( level == UNDEFINED_LEVEL ) {
|
||||
|
|
@ -425,9 +426,9 @@ insert_segment(const Point& p0, const Point& p1, int level)
|
|||
}
|
||||
|
||||
#if 0
|
||||
template<class Gt, class P, class Tds>
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
void
|
||||
Segment_Voronoi_diagram_hierarchy_2<Gt,P,Tds>::
|
||||
Segment_Voronoi_diagram_hierarchy_2<Gt,PC,DS,LTag>::
|
||||
remove(Vertex_handle v, bool remove_endpoints)
|
||||
{
|
||||
void* u = v->up();
|
||||
|
|
@ -442,9 +443,9 @@ remove(Vertex_handle v, bool remove_endpoints)
|
|||
}
|
||||
#endif
|
||||
|
||||
template<class Gt, class P, class Tds>
|
||||
typename Segment_Voronoi_diagram_hierarchy_2<Gt,P,Tds>::Vertex_handle
|
||||
Segment_Voronoi_diagram_hierarchy_2<Gt,P,Tds>::
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
typename Segment_Voronoi_diagram_hierarchy_2<Gt,PC,DS,LTag>::Vertex_handle
|
||||
Segment_Voronoi_diagram_hierarchy_2<Gt,PC,DS,LTag>::
|
||||
nearest_neighbor(const Point& p, bool force_point) const
|
||||
{
|
||||
Vertex_handle vnear[svd_hierarchy_2__maxlevel];
|
||||
|
|
@ -452,9 +453,9 @@ nearest_neighbor(const Point& p, bool force_point) const
|
|||
return vnear[0];
|
||||
}
|
||||
|
||||
template<class Gt, class P, class Tds>
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
void
|
||||
Segment_Voronoi_diagram_hierarchy_2<Gt,P,Tds>::
|
||||
Segment_Voronoi_diagram_hierarchy_2<Gt,PC,DS,LTag>::
|
||||
nearest_neighbor(const Site& p,
|
||||
Vertex_handle vnear[svd_hierarchy_2__maxlevel],
|
||||
bool force_point) const
|
||||
|
|
@ -487,9 +488,9 @@ nearest_neighbor(const Site& p,
|
|||
// at level 0
|
||||
}
|
||||
|
||||
template<class Gt, class P, class Tds>
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
int
|
||||
Segment_Voronoi_diagram_hierarchy_2<Gt,P,Tds>::
|
||||
Segment_Voronoi_diagram_hierarchy_2<Gt,PC,DS,LTag>::
|
||||
random_level()
|
||||
{
|
||||
unsigned int l = 0;
|
||||
|
|
@ -503,9 +504,9 @@ random_level()
|
|||
}
|
||||
|
||||
|
||||
template<class Gt, class P, class Tds>
|
||||
template<class Gt, class PC, class DS, class LTag>
|
||||
bool
|
||||
Segment_Voronoi_diagram_hierarchy_2<Gt,P,Tds>::
|
||||
Segment_Voronoi_diagram_hierarchy_2<Gt,PC,DS,LTag>::
|
||||
is_valid(bool verbose, int level) const
|
||||
{
|
||||
bool result(true);
|
||||
|
|
|
|||
|
|
@ -55,9 +55,91 @@ void debug_info(char msg[], const T& t)
|
|||
//***********************************************************************
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
// are same points
|
||||
// compare x
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
template< class K >
|
||||
class Svd_compare_x_2
|
||||
{
|
||||
public:
|
||||
typedef typename K::Site_2 Site_2;
|
||||
typedef typename K::Point_2 Point_2;
|
||||
|
||||
typedef Comparison_result result_type;
|
||||
|
||||
struct Arity {};
|
||||
|
||||
private:
|
||||
typedef typename K::Compare_x_2 compare_x_2;
|
||||
|
||||
public:
|
||||
|
||||
result_type operator()(const Site_2& p, const Site_2& q) const
|
||||
{
|
||||
CGAL_precondition( p.is_point() && q.is_point() );
|
||||
return compare_x_2()( p.point(), q.point() );
|
||||
}
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
// compare y
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
template< class K >
|
||||
class Svd_compare_y_2
|
||||
{
|
||||
public:
|
||||
typedef typename K::Site_2 Site_2;
|
||||
typedef typename K::Point_2 Point_2;
|
||||
|
||||
typedef Comparison_result result_type;
|
||||
|
||||
struct Arity {};
|
||||
|
||||
private:
|
||||
typedef typename K::Compare_y_2 compare_y_2;
|
||||
|
||||
public:
|
||||
|
||||
result_type operator()(const Site_2& p, const Site_2& q) const
|
||||
{
|
||||
CGAL_precondition( p.is_point() && q.is_point() );
|
||||
return compare_y_2()( p.point(), q.point() );
|
||||
}
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
// orientation
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
template< class K >
|
||||
class Svd_orientation_2
|
||||
{
|
||||
public:
|
||||
typedef typename K::Site_2 Site_2;
|
||||
typedef typename K::Point_2 Point_2;
|
||||
|
||||
typedef Orientation result_type;
|
||||
|
||||
struct Arity {};
|
||||
|
||||
private:
|
||||
typedef typename K::Orientation_2 orientation_2;
|
||||
|
||||
public:
|
||||
|
||||
result_type operator()(const Site_2& p, const Site_2& q,
|
||||
const Site_2& r) const
|
||||
{
|
||||
CGAL_precondition( p.is_point() && q.is_point() && r.is_point() );
|
||||
return orientation_2()( p.point(), q.point(), r.point() );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
// are same points
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
template< class K >
|
||||
class Are_same_points_2
|
||||
|
|
@ -317,8 +399,6 @@ public:
|
|||
};
|
||||
|
||||
|
||||
#define USE_KERNEL_PREDICATES
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
// the Traits class
|
||||
|
|
@ -365,11 +445,9 @@ public:
|
|||
|
||||
// PREDICATES
|
||||
//-----------
|
||||
#ifdef USE_KERNEL_PREDICATES
|
||||
typedef typename Kernel::Compare_x_2 Compare_x_2;
|
||||
typedef typename Kernel::Compare_y_2 Compare_y_2;
|
||||
typedef typename Kernel::Orientation_2 Orientation_2;
|
||||
#endif
|
||||
typedef CGAL::Svd_compare_x_2<K> Compare_x_2;
|
||||
typedef CGAL::Svd_compare_y_2<K> Compare_y_2;
|
||||
typedef CGAL::Svd_orientation_2<K> Orientation_2;
|
||||
typedef CGAL::Are_same_points_2<K> Are_same_points_2;
|
||||
typedef CGAL::Are_parallel_2<K> Are_parallel_2;
|
||||
typedef CGAL::Svd_oriented_side_of_bisector_2<K,MTag>
|
||||
|
|
@ -405,7 +483,6 @@ public:
|
|||
|
||||
// PREDICATES
|
||||
//-----------
|
||||
#ifdef USE_KERNEL_PREDICATES
|
||||
Compare_x_2
|
||||
compare_x_2_object() const {
|
||||
return Compare_x_2();
|
||||
|
|
@ -420,7 +497,7 @@ public:
|
|||
orientation_2_object() const {
|
||||
return Orientation_2();
|
||||
}
|
||||
#endif
|
||||
|
||||
Are_same_points_2
|
||||
are_same_points_2_object() const {
|
||||
return Are_same_points_2();
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
template < class Gt, class PointHandle,
|
||||
template < class Gt, class PC,
|
||||
class Vb = Triangulation_ds_vertex_base_2<> >
|
||||
class Segment_Voronoi_diagram_vertex_base_2
|
||||
: public Vb
|
||||
|
|
@ -40,10 +40,11 @@ private:
|
|||
public:
|
||||
// TYPES
|
||||
//------
|
||||
typedef Gt Geom_traits;
|
||||
typedef PointHandle Point_handle;
|
||||
typedef Vb Base;
|
||||
typedef typename Gt::Site_2 Site_2;
|
||||
typedef Gt Geom_traits;
|
||||
typedef PC Point_container;
|
||||
typedef typename Point_container::iterator Point_handle;
|
||||
typedef Vb Base;
|
||||
typedef typename Gt::Site_2 Site_2;
|
||||
|
||||
typedef
|
||||
Segment_Voronoi_diagram_storage_site_2<Gt,Point_handle>
|
||||
|
|
@ -57,9 +58,8 @@ public:
|
|||
|
||||
template < typename DS2 >
|
||||
struct Rebind_TDS {
|
||||
typedef typename Vb::template Rebind_TDS<DS2>::Other Vb2;
|
||||
typedef
|
||||
Segment_Voronoi_diagram_vertex_base_2<Gt,Point_handle,Vb2> Other;
|
||||
typedef typename Vb::template Rebind_TDS<DS2>::Other Vb2;
|
||||
typedef Segment_Voronoi_diagram_vertex_base_2<Gt,PC,Vb2> Other;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,74 @@
|
|||
// Copyright (c) 2003,2004 INRIA Sophia-Antipolis (France) and
|
||||
// Notre Dame University (U.S.A.). All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org); you may redistribute it under
|
||||
// the terms of the Q Public License version 1.0.
|
||||
// See the file LICENSE.QPL distributed with CGAL.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $Source$
|
||||
// $Revision$ $Date$
|
||||
// $Name$
|
||||
//
|
||||
// Author(s) : Menelaos Karavelas <mkaravel@cse.nd.edu>
|
||||
|
||||
|
||||
#ifndef CGAL_SIMPLE_CONTAINER_WRAPPER_H
|
||||
#define CGAL_SIMPLE_CONTAINER_WRAPPER_H
|
||||
|
||||
#include <CGAL/basic.h>
|
||||
#include <list>
|
||||
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
template<class C>
|
||||
class Simple_container_wrapper
|
||||
{
|
||||
public:
|
||||
typedef C Container;
|
||||
typedef typename Container::value_type value_type;
|
||||
typedef typename Container::iterator iterator;
|
||||
typedef typename Container::size_type size_type;
|
||||
|
||||
private:
|
||||
typedef Simple_container_wrapper<Container> Self;
|
||||
|
||||
public:
|
||||
Simple_container_wrapper() {}
|
||||
|
||||
iterator insert(const value_type& t)
|
||||
{
|
||||
c.push_back(t);
|
||||
return --c.end();
|
||||
}
|
||||
|
||||
void remove(iterator it)
|
||||
{
|
||||
c.erase(it);
|
||||
}
|
||||
|
||||
void swap(const Self& other)
|
||||
{
|
||||
c.swap(other.c);
|
||||
}
|
||||
|
||||
void clear() {
|
||||
c.clear();
|
||||
}
|
||||
|
||||
size_type size() const { return c.size(); }
|
||||
|
||||
private:
|
||||
Container c;
|
||||
};
|
||||
|
||||
|
||||
CGAL_END_NAMESPACE
|
||||
|
||||
#endif // CGAL_SIMPLE_CONTAINER_WRAPPER_H
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
// Copyright (c) 2003 INRIA Sophia-Antipolis (France).
|
||||
// All rights reserved.
|
||||
// Copyright (c) 2003,2004 INRIA Sophia-Antipolis (France) and
|
||||
// Notre Dame University (U.S.A.). All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org); you may redistribute it under
|
||||
// the terms of the Q Public License version 1.0.
|
||||
|
|
@ -28,118 +28,131 @@
|
|||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
#define USE_BF 0
|
||||
#define USE_STD_MAP 1
|
||||
#define USE_INIT 0
|
||||
|
||||
namespace CGALi {
|
||||
|
||||
class Edge_hash_function
|
||||
: public Handle_hash_function
|
||||
{
|
||||
private:
|
||||
typedef Handle_hash_function Base;
|
||||
|
||||
public:
|
||||
typedef Base::result_type result_type;
|
||||
|
||||
template<class Edge>
|
||||
result_type operator()(const Edge& e) const
|
||||
class Edge_hash_function
|
||||
: public Handle_hash_function
|
||||
{
|
||||
return (Base::operator()(e.first)) << e.second;
|
||||
}
|
||||
};
|
||||
private:
|
||||
typedef Handle_hash_function Base;
|
||||
|
||||
public:
|
||||
typedef Base::result_type result_type;
|
||||
|
||||
template<class Edge>
|
||||
result_type operator()(const Edge& e) const
|
||||
{
|
||||
return (Base::operator()(e.first)) << e.second;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template<class Edge>
|
||||
class Edge_list_item
|
||||
{
|
||||
private:
|
||||
typedef typename Edge::first_type Face_handle;
|
||||
typedef Edge_list_item<Edge> Self;
|
||||
|
||||
private:
|
||||
Edge prev_;
|
||||
Edge next_;
|
||||
|
||||
public:
|
||||
// remove the following method and make SENTINEL_EDGE a static const
|
||||
// member of the class.
|
||||
static Edge sentinel_edge() {
|
||||
static Edge SENTINEL_EDGE = Edge(Face_handle(), sentinel_index());
|
||||
return SENTINEL_EDGE;
|
||||
}
|
||||
private:
|
||||
static int sentinel_index() { return -1; }
|
||||
|
||||
private:
|
||||
#if USE_INIT
|
||||
void init() {
|
||||
static Edge SENTINEL_EDGE = sentinel_edge();
|
||||
init( SENTINEL_EDGE, SENTINEL_EDGE );
|
||||
}
|
||||
|
||||
void init(const Edge& prev, const Edge& next) {
|
||||
next_ = next;
|
||||
prev_ = prev;
|
||||
}
|
||||
#endif
|
||||
|
||||
public:
|
||||
#if USE_INIT
|
||||
Edge_list_item() { init(); }
|
||||
Edge_list_item(const Edge& prev, const Edge& next)
|
||||
{ init(prev, next); }
|
||||
#else
|
||||
Edge_list_item()
|
||||
: prev_(sentinel_edge()), next_(sentinel_edge()) {}
|
||||
Edge_list_item(const Edge& prev, const Edge& next)
|
||||
: prev_(prev), next_(next) {}
|
||||
#endif
|
||||
|
||||
bool is_in_list() const
|
||||
template<class Edge_t>
|
||||
class Edge_list_item
|
||||
{
|
||||
return ( next_.second != sentinel_index() ||
|
||||
prev_.second != sentinel_index() );
|
||||
}
|
||||
public:
|
||||
typedef Edge_t Edge;
|
||||
|
||||
void set_next(const Edge& next)
|
||||
private:
|
||||
typedef typename Edge::first_type Face_handle;
|
||||
|
||||
private:
|
||||
Edge prev_;
|
||||
Edge next_;
|
||||
|
||||
public:
|
||||
// remove the following method and make SENTINEL_EDGE a static const
|
||||
// member of the class.
|
||||
static Edge sentinel_edge() {
|
||||
static Edge SENTINEL_EDGE = Edge(Face_handle(), sentinel_index());
|
||||
return SENTINEL_EDGE;
|
||||
}
|
||||
|
||||
private:
|
||||
static int sentinel_index() { return -1; }
|
||||
|
||||
public:
|
||||
Edge_list_item()
|
||||
: prev_(sentinel_edge()), next_(sentinel_edge()) {}
|
||||
Edge_list_item(const Edge& prev, const Edge& next)
|
||||
: prev_(prev), next_(next) {}
|
||||
|
||||
|
||||
bool is_in_list() const
|
||||
{
|
||||
return ( next_.second != sentinel_index() ||
|
||||
prev_.second != sentinel_index() );
|
||||
}
|
||||
|
||||
void set_next(const Edge& next)
|
||||
{
|
||||
next_ = next;
|
||||
}
|
||||
|
||||
void set_previous(const Edge& prev)
|
||||
{
|
||||
prev_ = prev;
|
||||
}
|
||||
|
||||
const Edge& next() const { return next_; }
|
||||
const Edge& previous() const { return prev_; }
|
||||
|
||||
void reset() {
|
||||
Edge SENTINEL_EDGE = sentinel_edge();
|
||||
next_ = prev_ = SENTINEL_EDGE;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
template<class E_t, class ListItem, class USE_STL_MAP_Tag>
|
||||
struct Edge_list_which_map;
|
||||
|
||||
// use STL's map
|
||||
template<class E_t, class ListItem>
|
||||
struct Edge_list_which_map<E_t,ListItem,Tag_true>
|
||||
{
|
||||
next_ = next;
|
||||
}
|
||||
typedef E_t Edge;
|
||||
typedef ListItem List_item;
|
||||
typedef std::map<Edge,List_item> Edge_map;
|
||||
};
|
||||
|
||||
void set_previous(const Edge& prev)
|
||||
// use CGAL's Unique_hash_map
|
||||
template<class E_t, class ListItem>
|
||||
struct Edge_list_which_map<E_t,ListItem,Tag_false>
|
||||
{
|
||||
prev_ = prev;
|
||||
}
|
||||
typedef E_t Edge;
|
||||
typedef ListItem List_item;
|
||||
typedef CGALi::Edge_hash_function Hash_function;
|
||||
|
||||
typedef Unique_hash_map<Edge,List_item,Hash_function> Edge_map;
|
||||
};
|
||||
|
||||
const Edge& next() const { return next_; }
|
||||
const Edge& previous() const { return prev_; }
|
||||
|
||||
void reset() {
|
||||
Edge SENTINEL_EDGE = sentinel_edge();
|
||||
next_ = prev_ = SENTINEL_EDGE;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace CGALi
|
||||
|
||||
template<class Edge>
|
||||
|
||||
|
||||
template<class Edge_t, class USE_STL_MAP_Tag = Tag_true>
|
||||
class Edge_list
|
||||
{
|
||||
private:
|
||||
typedef CGALi::Edge_list_item<Edge> List_item;
|
||||
#if USE_STD_MAP
|
||||
typedef std::map<Edge,List_item> Edge_map;
|
||||
#else
|
||||
typedef
|
||||
Unique_hash_map<Edge,List_item,CGALi::Edge_hash_function> Edge_map;
|
||||
#endif
|
||||
|
||||
public:
|
||||
// TYPES
|
||||
//======
|
||||
typedef std::size_t size_type;
|
||||
typedef std::size_t size_type;
|
||||
typedef Edge_t Edge;
|
||||
typedef USE_STL_MAP_Tag Use_stl_map_tag;
|
||||
|
||||
private:
|
||||
typedef CGALi::Edge_list_item<Edge> List_item;
|
||||
|
||||
typedef
|
||||
CGALi::Edge_list_which_map<Edge,List_item,Use_stl_map_tag>
|
||||
Which_map;
|
||||
|
||||
typedef typename Which_map::Edge_map Edge_map;
|
||||
|
||||
private:
|
||||
// PRIVATE DATA MEMBERS
|
||||
|
|
@ -160,12 +173,6 @@ private:
|
|||
}
|
||||
|
||||
void insert_before_nocheck(const Edge& e, const Edge& new_e) {
|
||||
#if USE_BF
|
||||
Edge old_front = front_;
|
||||
front_ = e;
|
||||
push_back(new_e);
|
||||
front_ = old_front;
|
||||
#else
|
||||
List_item& li_e = emap[e];
|
||||
|
||||
const Edge& prev_e = li_e.previous();
|
||||
|
|
@ -175,7 +182,50 @@ private:
|
|||
li_e.set_previous(new_e);
|
||||
li_prev_e.set_next(new_e);
|
||||
increase_size();
|
||||
#endif
|
||||
}
|
||||
|
||||
// check whether the edge is in the list;
|
||||
// the map used is STL's map
|
||||
bool is_in_list_with_tag(const Edge& e, const Tag_true&) const
|
||||
{
|
||||
if ( emap.find(e) == emap.end() ) { return false; }
|
||||
return emap.find(e)->second.is_in_list();
|
||||
}
|
||||
|
||||
// check whether the edge is in the list;
|
||||
// the map used is CGAL's Unique_hash_map
|
||||
bool is_in_list_with_tag(const Edge& e, const Tag_false&) const
|
||||
{
|
||||
if ( !emap.is_defined(e) ) { return false; }
|
||||
return emap[e].is_in_list();
|
||||
}
|
||||
|
||||
// return the next edge in the list;
|
||||
// the map used is STL's map
|
||||
const Edge& next_with_tag(const Edge& e, const Tag_true&) const
|
||||
{
|
||||
return emap.find(e)->second.next();
|
||||
}
|
||||
|
||||
// return the next edge in the list;
|
||||
// the map used is CGAL's Unique_hash_map
|
||||
const Edge& next_with_tag(const Edge& e, const Tag_false&) const
|
||||
{
|
||||
return emap[e].next();
|
||||
}
|
||||
|
||||
// return the previous edge in the list;
|
||||
// the map used is STL's map
|
||||
const Edge& previous_with_tag(const Edge& e, const Tag_true&) const
|
||||
{
|
||||
return emap.find(e)->second.previous();
|
||||
}
|
||||
|
||||
// return the previous edge in the list;
|
||||
// the map used is CGAL's Unique_hash_map
|
||||
const Edge& previous_with_tag(const Edge& e, const Tag_false&) const
|
||||
{
|
||||
return emap[e].previous();
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
@ -184,23 +234,17 @@ public:
|
|||
Edge_list(const Edge& e = List_item::sentinel_edge() )
|
||||
: emap(), front_(e), size_(0) {}
|
||||
|
||||
public:
|
||||
|
||||
// PREDICATES
|
||||
//===========
|
||||
bool is_valid() const { return true; }
|
||||
|
||||
bool is_in_list(const Edge& e) const {
|
||||
#if USE_STD_MAP
|
||||
if ( emap.find(e) == emap.end() ) { return false; }
|
||||
return emap.find(e)->second.is_in_list();
|
||||
// return li_e.is_in_list();
|
||||
#else
|
||||
if ( !emap.is_defined(e) ) { return false; }
|
||||
return emap[e].is_in_list();
|
||||
#endif
|
||||
static Use_stl_map_tag map_tag;
|
||||
return is_in_list_with_tag(e, map_tag);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// ACCESS METHODS
|
||||
//===============
|
||||
size_type size() const {
|
||||
|
|
@ -209,20 +253,14 @@ public:
|
|||
|
||||
const Edge& next(const Edge& e) const {
|
||||
CGAL_precondition( is_in_list(e) );
|
||||
#if USE_STD_MAP
|
||||
return emap.find(e)->second.next();
|
||||
#else
|
||||
return emap[e].next();
|
||||
#endif
|
||||
static Use_stl_map_tag map_tag;
|
||||
return next_with_tag(e, map_tag);
|
||||
}
|
||||
|
||||
const Edge& previous(const Edge& e) const {
|
||||
CGAL_precondition( is_in_list(e) );
|
||||
#if USE_STD_MAP
|
||||
return emap.find(e)->second.previous();
|
||||
#else
|
||||
return emap[e].previous();
|
||||
#endif
|
||||
static Use_stl_map_tag map_tag;
|
||||
return previous_with_tag(e, map_tag);
|
||||
}
|
||||
|
||||
const Edge& front() const {
|
||||
|
|
@ -235,7 +273,7 @@ public:
|
|||
return previous(front_);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// INSERTION
|
||||
//==========
|
||||
void push_front(const Edge& e) {
|
||||
|
|
@ -253,26 +291,13 @@ public:
|
|||
return;
|
||||
}
|
||||
|
||||
#if USE_BF
|
||||
Edge last_edge = back();
|
||||
emap[e] = List_item(last_edge, front_);
|
||||
emap[last_edge].set_next(e);
|
||||
emap[front_].set_previous(e);
|
||||
increase_size();
|
||||
#else
|
||||
insert_before_nocheck(front_, e);
|
||||
#endif
|
||||
}
|
||||
|
||||
void insert_after(const Edge& e, const Edge& new_e) {
|
||||
CGAL_precondition( is_in_list(e) );
|
||||
CGAL_precondition( !is_in_list(new_e) );
|
||||
#if USE_BF
|
||||
Edge old_front = front_;
|
||||
front_ = emap[e].next();
|
||||
push_front(new_e);
|
||||
front_ = old_front;
|
||||
#else
|
||||
|
||||
List_item& li_e = emap[e];
|
||||
|
||||
const Edge& next_e = li_e.next();
|
||||
|
|
@ -282,7 +307,6 @@ public:
|
|||
li_e.set_next(new_e);
|
||||
li_next_e.set_previous(new_e);
|
||||
increase_size();
|
||||
#endif
|
||||
}
|
||||
|
||||
void insert_before(const Edge& e, const Edge& new_e) {
|
||||
|
|
@ -291,14 +315,10 @@ public:
|
|||
insert_before_nocheck(e, new_e);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// REPLACEMENT
|
||||
//============
|
||||
void replace(const Edge& e, const Edge& new_e) {
|
||||
#if USE_BF
|
||||
insert_before(e, new_e);
|
||||
remove(e);
|
||||
#else
|
||||
CGAL_precondition( is_in_list(e) );
|
||||
CGAL_precondition( !is_in_list(new_e) );
|
||||
|
||||
|
|
@ -310,13 +330,8 @@ public:
|
|||
li_e.reset();
|
||||
}
|
||||
|
||||
#if USE_BF
|
||||
Edge next_e = li_e.next();
|
||||
Edge prev_e = li_e.previous();
|
||||
#else
|
||||
const Edge& next_e = li_e.next();
|
||||
const Edge& prev_e = li_e.previous();
|
||||
#endif
|
||||
|
||||
emap[prev_e].set_next(new_e);
|
||||
emap[next_e].set_previous(new_e);
|
||||
|
|
@ -328,9 +343,9 @@ public:
|
|||
if ( e == front_ ) {
|
||||
front_ = new_e;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
// REMOVAL
|
||||
//========
|
||||
|
||||
|
|
@ -345,19 +360,8 @@ public:
|
|||
}
|
||||
|
||||
List_item& li_e = emap[e];
|
||||
#if USE_BF
|
||||
Edge next_e = li_e.next();
|
||||
Edge prev_e = li_e.previous();
|
||||
#else
|
||||
const Edge& next_e = li_e.next();
|
||||
const Edge& prev_e = li_e.previous();
|
||||
#endif
|
||||
|
||||
// Edge ne = li_e.next();
|
||||
// Edge pe = li_e.previous();
|
||||
|
||||
// emap[pe].set_next(ne);
|
||||
// emap[ne].set_previous(pe);
|
||||
|
||||
emap[prev_e].set_next(next_e);
|
||||
emap[next_e].set_previous(prev_e);
|
||||
|
|
|
|||
Loading…
Reference in New Issue