fixed problems related to the change from Less_distance_to_point_2

to Compare_distance_2
added std:: in front of iterator_traits< >
This commit is contained in:
Mariette Yvinec 2001-06-14 15:06:48 +00:00
parent 8843150e34
commit 10e7e0b039
9 changed files with 42 additions and 40 deletions

View File

@ -61,9 +61,9 @@ and $r$.}
\ccGlue
\ccNestedType{Compare_distance_2} {Predicate type. Must provide
the operator
\ccc{bool operator()(Point_2 p, Point_2 q, Point_2 r)}
which returns \ccc{true}
iff the distance between p and q is smaller
\ccc{Comparison_result operator()(Point_2 p, Point_2 q, Point_2 r)}
which returns \ccc{SMALLER}, \ccc{EQUAL} or \ccc{LARGER}
iff the distance between p and q is smaller, equal or larger
than the distance between p and r. This type is only require if
\ccc{nearest_vertex} queries are issued.}

View File

@ -61,9 +61,9 @@ and $r$.}
\ccGlue
\ccNestedType{Compare_distance_2} {Predicate type. Must provide
the operator
\ccc{bool operator()(Point_2 p, Point_2 q, Point_2 r)}
which returns \ccc{true}
iff the distance between p and q is smaller
\ccc{Comparison_result operator()(Point_2 p, Point_2 q, Point_2 r)}
which returns \ccc{SMALLER}, \ccc{EQUAL} or \ccc{LARGER}
iff the distance between p and q is smaller, equal or larger
than the distance between p and r. This type is only require if
\ccc{nearest_vertex} queries are issued.}

View File

@ -314,15 +314,15 @@ nearest_vertex_2D(const Point& p, Face_handle f) const
CGAL_triangulation_precondition(oriented_side(f,p)!=ON_NEGATIVE_SIDE);
typename Geom_traits::Compare_distance_2
closer = geom_traits().compare_distance_2_object(p);
closer = geom_traits().compare_distance_2_object();
Vertex_handle nn = !is_infinite(f->vertex(0)) ? f->vertex(0):f->vertex(1);
if ( !is_infinite(f->vertex(1)) && closer(p,
f->vertex(1)->point(),
nn->point()))
nn->point()) == SMALLER)
nn=f->vertex(1);
if ( !is_infinite(f->vertex(2)) && closer(p,
f->vertex(2)->point(),
nn->point()))
nn->point()) == SMALLER)
nn=f->vertex(2);
look_nearest_neighbor(p,f,0,nn);
@ -363,7 +363,9 @@ look_nearest_neighbor(const Point& p,
closer = geom_traits().compare_distance_2_object();
i = ni->index(f);
if ( !is_infinite(ni->vertex(i)) &&
closer(p, ni->vertex(i)->point(), nn->point()) ) nn=ni->vertex(i);
closer(p,
ni->vertex(i)->point(),
nn->point()) == SMALLER) nn=ni->vertex(i);
// recursive exploration of triangles whose circumcircle contains p
look_nearest_neighbor(p, ni, ccw(i), nn);

View File

@ -110,7 +110,7 @@ public:
Compare_distance_2
Compare_distance_2_object() const
compare_distance_2_object() const
{return Compare_distance_2();}
Construct_direction_of_line_2

View File

@ -414,7 +414,7 @@ locate(const Point& p,
nearest = position->vertex(0);
else if ( closer(p,
position->vertex(0)->point(),
position->vertex(1)->point()))
position->vertex(1)->point()) == SMALLER)
nearest = position->vertex(0);
else
nearest = position->vertex(1);
@ -422,7 +422,7 @@ locate(const Point& p,
if ( ! hierarchy[level]->is_infinite(position->vertex(2)))
if ( closer( p,
position->vertex(2)->point(),
nearest->point()))
nearest->point()) == SMALLER)
nearest = position->vertex(2);
// go at the same vertex on level below
nearest = (Vertex*)( nearest->down() );

View File

@ -243,7 +243,7 @@ public:
class To_tds_edge_iterator : public It {
public:
typedef TdsEdge Tds_Edge;
typedef typename iterator_traits<It>::value_type Edge;
typedef typename std::iterator_traits<It>::value_type Edge;
To_tds_edge_iterator() {}
To_tds_edge_iterator(It i) : It(i) {}
Tds_Edge operator*() {

View File

@ -6,7 +6,7 @@
#
#CGAL_MAKEFILE = /0/prisme_util/CGAL/CGAL-I/make/makefile_i686_Linux-2.2.18_g++-2.95.3_LEDA
CGAL_MAKEFILE = /0/prisme_util/CGAL/CGAL-I/make/makefile_i686_Linux-2.2.18_g++-2.95.3_LEDA
include $(CGAL_MAKEFILE)

View File

@ -87,12 +87,12 @@ _test_cls_delaunay_geom_traits(Point p[34], const Traits & )
Traits gt;
// Distance
typedef typename Traits::Less_distance_to_point_2 Less_distance_to_point_2;
Less_distance_to_point_2 closer = gt.less_distance_to_point_2_object(p[0]);
assert( closer(p[1],p[2]));
assert( !closer(p[2],p[1]));
assert( !closer(p[1],p[1]));
assert( !closer(p[0],p[0]));
typedef typename Traits::Compare_distance_2 Compare_distance_2;
Compare_distance_2 closer = gt.compare_distance_2_object();
assert( closer(p[0],p[1],p[2]) == CGAL::SMALLER);
assert( closer(p[0],p[2],p[1]) == CGAL::LARGER);
assert( closer(p[0],p[1],p[1]) == CGAL::EQUAL);
assert( closer(p[0],p[0],p[0]) == CGAL::EQUAL);
// Test circumcenter()

View File

@ -23,6 +23,7 @@
#include <CGAL/determinant.h>
#include <CGAL/_test_types.h>
#include <CGAL/enum.h>
CGAL_BEGIN_NAMESPACE
@ -315,27 +316,26 @@ class Triangulation_test_Construct_ray_2
};
class Triangulation_test_Less_distance_to_point_2
class Triangulation_test_Compare_distance_2
{
public:
typedef Triangulation_test_point Point;
typedef Triangulation_test_Less_distance_to_point_2
Less_distance_to_point_2;
private:
Point _p;
typedef Triangulation_test_Compare_distance_2 Compare_distance_2;
public:
Triangulation_test_Less_distance_to_point_2() {}
Triangulation_test_Less_distance_to_point_2(const Point& p)
: _p(p) {}
Triangulation_test_Compare_distance_2() {}
Point::TESTFT sqr(const Point::TESTFT x) const { return x*x; }
bool operator() ( const Point& q, const Point& r) const
CGAL::Comparison_result
operator() ( const Point& p, const Point& q, const Point& r) const
{
Point::TESTFT dq = sqr(_p.test_x()-q.test_x())
+ sqr(_p.test_y()-q.test_y());
Point::TESTFT dr = sqr(_p.test_x()-r.test_x())
+ sqr(_p.test_y()-r.test_y());
return dq < dr ;
Point::TESTFT dq = sqr(p.test_x()-q.test_x())
+ sqr(p.test_y()-q.test_y());
Point::TESTFT dr = sqr(p.test_x()-r.test_x())
+ sqr(p.test_y()-r.test_y());
if( dq < dr) return CGAL::SMALLER ;
else if (dq == dr) return CGAL::EQUAL;
return CGAL::LARGER;
}
};
@ -368,8 +368,8 @@ public:
Construct_bisector_2;
typedef Triangulation_test_Construct_midpoint
Construct_midpoint;
typedef Triangulation_test_Less_distance_to_point_2
Less_distance_to_point_2;
typedef Triangulation_test_Compare_distance_2
Compare_distance_2;
typedef Triangulation_test_Construct_direction_of_line_2
Construct_direction_of_line_2;
typedef Triangulation_test_Construct_segment_2 Construct_segment_2;
@ -413,9 +413,9 @@ public:
construct_midpoint_object() const
{return Construct_midpoint();}
Less_distance_to_point_2
less_distance_to_point_2_object(const Point_2& p) const
{return Less_distance_to_point_2(p);}
Compare_distance_2
compare_distance_2_object() const
{return Compare_distance_2();}
Construct_direction_of_line_2
construct_direction_of_line_2_object() const