A few modif related to the traits (end of kernel traits compatibility).

This commit is contained in:
Mariette Yvinec 2000-07-28 15:04:56 +00:00
parent 4e469f4944
commit 03e27c08e9
11 changed files with 236 additions and 86 deletions

View File

@ -26,21 +26,27 @@ has to provide a predicate type \ccc{Side_of_oriented_circle_2}
to implement the \ccc{side_of_oriented_circle} test.
This test test is the basic test used to maintain the
empty circle property and actually defines the triangulation.
Some additional geometric types (\ccc{Line}, \ccc{Ray})
and constructors types (\ccc{Construct_circumcenter_2},
\ccc{Construct_bisector_2} and \ccc{Construct_midpoint})
are required if functions related to the dual Voronoi diagram
are called.
The additional types \ccc{Line_2}, \ccc{Direction_2} and
and \ccc{Ray_2} and the constructor objects
\ccc{Construct_direction_2}, \ccc{Construct_ray_2}
\ccc{Construct_circumcenter_2}, \ccc{Construct_bisector_2},
\ccc{Construct_midpoint}
are used to build the dual Voronoi diagram
and are required only if the dual functions are called.
The additional predicate type \ccc{Less_distance_to_point_2} is o
required if calls to
\ccc{nearest_vertex(..)} are issued.
\ccTypes
\ccNestedType{Line_2}{}
\ccThree{Oriented_side}{xxxxxx}{}
\ccThreeToTwo
\ccNestedType{Line_2}{The line type.}
\ccGlue
\ccNestedType{Ray_2}{Must have a constructor which takes two points as
arguments : the origin of the ray and another point on the ray.}
\ccNestedType{Direction_2}{The direction of a line.}
\ccGlue
\ccNestedType{Ray_2}{The type for ray.}
@ -77,12 +83,14 @@ bisector line of points \ccc{p} and \ccc{q}.
This type is required only if functions
relative to the dual Voronoi diagram are called.}
\ccGlue
\ccNestedType{Construct_midpoint} {Constructor object. Provides
the operator
\ccc{ Point_2 operator()(Point_2 p, Point_2 q)} which constructs the
the midpoint of \ccc{p} and \ccc{q}.
This type is required only if functions
relative to the dual Voronoi diagram are called.}
\ccNestedType{Construct_direction_of_line_2}{Constructor object to build
the direction of a line. Must provide
\ccc{Direction_2 operator()(Line_2 l);}.
\ccGlue
\ccNestedType{Construct_ray_2}{A constructor object to build
a ray from a point and a direction. Must provide
\ccc{Ray_2 operator() ( Point_2 p, Direction_2 d);}}
\ccCreation
\ccCreationVariable{traits} %% choose variable name
@ -115,9 +123,9 @@ relative to the dual Voronoi diagram are called.}
{Required only if functions
relative to the dual Voronoi diagram are called.}
\ccGlue
\ccMethod{Construct_midpoint construct_midpoint_object();}
{Required only if functions
relative to the dual Voronoi diagram are called.}
\ccMethod{Construct_direction_of_line_2 construct_direction_of_line_2_object();} {}
\ccGlue
\ccMethod{Construct_ray_2 construct_ray_2_object();} {}
\ccHasModels

View File

@ -31,11 +31,19 @@ for the required predicates on those primitives.
\ccNestedType{Point_2}{The type must provide
a copy constructor and assignment operator.}
\ccGlue
\ccNestedType{Segment_2}{The type must provide a constructor that takes
two points as argument.}
\ccNestedType{Segment_2}{The segment type. Must provide a constructor that takes
two points as arguments.}
\ccGlue
\ccNestedType{Triangle_2}{The type must provide a constructor that takes
three points as argument.}
\ccNestedType{Triangle_2}{The triangle type. Must provide a constructor
that takes three points as arguments.}
\ccNestedType{Construct_segment_2} {A constructor object for
\ccc{Segment_2}.Must provide Segment_2 operator()(Point_2 p,Point_2
q), which constructs a segment from two points.}
\ccGlue
\ccNestedType{Construct_triangle_2} {A constructor object for
\ccc{Triangle_2}.Must provide Triangle_2 operator()(Point_2 p,Point_2
q,Point_2 r ), which constructs a triangle from three points.}
\ccNestedType{Compare_x_2}{Predicate object. Must proveide
the operator
@ -98,7 +106,11 @@ can be provided.
\ccHeading{Predicate functions}
The following functions give access to the predicate
and constructor objects.
\ccThree{Comparison_result}{gt.compare_x(Point p0, Point p1)x}{}
\ccThree{Construct_segment_2}{gt.compare_x(Point p0, Point p1)x}{}
\ccMethod{Construct_segment_2 construct_segment_2_object();}{}
\ccGlue
\ccMethod{Construct_triangle_2 construct_triangle_2_object();}{}
\ccGlue
\ccMethod{Comparison_x_2 compare_x_2_object();}{} \ccGlue
\ccMethod{Comparison_y_2 compare_y_2_object();}{}
\ccGlue

View File

@ -26,21 +26,27 @@ has to provide a predicate type \ccc{Side_of_oriented_circle_2}
to implement the \ccc{side_of_oriented_circle} test.
This test test is the basic test used to maintain the
empty circle property and actually defines the triangulation.
Some additional geometric types (\ccc{Line}, \ccc{Ray})
and constructors types (\ccc{Construct_circumcenter_2},
\ccc{Construct_bisector_2} and \ccc{Construct_midpoint})
are required if functions related to the dual Voronoi diagram
are called.
The additional types \ccc{Line_2}, \ccc{Direction_2} and
and \ccc{Ray_2} and the constructor objects
\ccc{Construct_direction_2}, \ccc{Construct_ray_2}
\ccc{Construct_circumcenter_2}, \ccc{Construct_bisector_2},
\ccc{Construct_midpoint}
are used to build the dual Voronoi diagram
and are required only if the dual functions are called.
The additional predicate type \ccc{Less_distance_to_point_2} is o
required if calls to
\ccc{nearest_vertex(..)} are issued.
\ccTypes
\ccNestedType{Line_2}{}
\ccThree{Oriented_side}{xxxxxx}{}
\ccThreeToTwo
\ccNestedType{Line_2}{The line type.}
\ccGlue
\ccNestedType{Ray_2}{Must have a constructor which takes two points as
arguments : the origin of the ray and another point on the ray.}
\ccNestedType{Direction_2}{The direction of a line.}
\ccGlue
\ccNestedType{Ray_2}{The type for ray.}
@ -77,12 +83,14 @@ bisector line of points \ccc{p} and \ccc{q}.
This type is required only if functions
relative to the dual Voronoi diagram are called.}
\ccGlue
\ccNestedType{Construct_midpoint} {Constructor object. Provides
the operator
\ccc{ Point_2 operator()(Point_2 p, Point_2 q)} which constructs the
the midpoint of \ccc{p} and \ccc{q}.
This type is required only if functions
relative to the dual Voronoi diagram are called.}
\ccNestedType{Construct_direction_of_line_2}{Constructor object to build
the direction of a line. Must provide
\ccc{Direction_2 operator()(Line_2 l);}.
\ccGlue
\ccNestedType{Construct_ray_2}{A constructor object to build
a ray from a point and a direction. Must provide
\ccc{Ray_2 operator() ( Point_2 p, Direction_2 d);}}
\ccCreation
\ccCreationVariable{traits} %% choose variable name
@ -115,9 +123,9 @@ relative to the dual Voronoi diagram are called.}
{Required only if functions
relative to the dual Voronoi diagram are called.}
\ccGlue
\ccMethod{Construct_midpoint construct_midpoint_object();}
{Required only if functions
relative to the dual Voronoi diagram are called.}
\ccMethod{Construct_direction_of_line_2 construct_direction_of_line_2_object();} {}
\ccGlue
\ccMethod{Construct_ray_2 construct_ray_2_object();} {}
\ccHasModels

View File

@ -31,11 +31,19 @@ for the required predicates on those primitives.
\ccNestedType{Point_2}{The type must provide
a copy constructor and assignment operator.}
\ccGlue
\ccNestedType{Segment_2}{The type must provide a constructor that takes
two points as argument.}
\ccNestedType{Segment_2}{The segment type. Must provide a constructor that takes
two points as arguments.}
\ccGlue
\ccNestedType{Triangle_2}{The type must provide a constructor that takes
three points as argument.}
\ccNestedType{Triangle_2}{The triangle type. Must provide a constructor
that takes three points as arguments.}
\ccNestedType{Construct_segment_2} {A constructor object for
\ccc{Segment_2}.Must provide Segment_2 operator()(Point_2 p,Point_2
q), which constructs a segment from two points.}
\ccGlue
\ccNestedType{Construct_triangle_2} {A constructor object for
\ccc{Triangle_2}.Must provide Triangle_2 operator()(Point_2 p,Point_2
q,Point_2 r ), which constructs a triangle from three points.}
\ccNestedType{Compare_x_2}{Predicate object. Must proveide
the operator
@ -98,7 +106,11 @@ can be provided.
\ccHeading{Predicate functions}
The following functions give access to the predicate
and constructor objects.
\ccThree{Comparison_result}{gt.compare_x(Point p0, Point p1)x}{}
\ccThree{Construct_segment_2}{gt.compare_x(Point p0, Point p1)x}{}
\ccMethod{Construct_segment_2 construct_segment_2_object();}{}
\ccGlue
\ccMethod{Construct_triangle_2 construct_triangle_2_object();}{}
\ccGlue
\ccMethod{Comparison_x_2 compare_x_2_object();}{} \ccGlue
\ccMethod{Comparison_y_2 compare_y_2_object();}{}
\ccGlue

View File

@ -272,7 +272,7 @@ dual(const Edge &e) const
typedef typename Geom_traits::Line_2 Line;
typedef typename Geom_traits::Ray_2 Ray;
typedef typename Geom_traits::Direction_2 Direction;
CGAL_triangulation_precondition (!is_infinite(e));
if( dimension()== 1 ){
Point p = (e.first)->vertex(cw(e.second))->point();
@ -284,7 +284,8 @@ dual(const Edge &e) const
// dimension==2
if( (!is_infinite(e.first)) &&
(!is_infinite(e.first->neighbor(e.second))) ) {
Segment s(dual(e.first),dual(e.first->neighbor(e.second)));
Segment s = geom_traits().construct_segment_2_object()
(dual(e.first),dual(e.first->neighbor(e.second)));
return Object(new Wrapper< Segment >(s));
}
// one of the adjacent face is infinite
@ -297,11 +298,9 @@ dual(const Edge &e) const
}
Point p = f->vertex(cw(i))->point();
Point q = f->vertex(ccw(i))->point();
//Point midpoint = geom_traits().construct_midpoint_object()(p,q);
// Ray r(dual(f), midpoint);
Line l = geom_traits().construct_bisector_2_object()(p,q);
Direction d = geom_traits().construct_direction_of_line_2_object()(l);
Ray r = Ray(dual(f), d);
Ray r = geom_traits().construct_ray_2_object()(dual(f), d);
return Object(new Wrapper< Ray >(r));
}

View File

@ -651,9 +651,11 @@ Triangulation_2<Gt, Tds>::
triangle(const Face_handle& f) const
{
CGAL_triangulation_precondition( ! is_infinite(f) );
return Triangle(f->vertex(0)->point(),
f->vertex(1)->point(),
f->vertex(2)->point());
typename Gt::Construct_triangle_2
construct_triangle = geom_traits().construct_triangle_2_object();
return construct_triangle(f->vertex(0)->point(),
f->vertex(1)->point(),
f->vertex(2)->point());
}
template <class Gt, class Tds >
@ -662,8 +664,10 @@ Triangulation_2<Gt, Tds>::
segment(const Face_handle& f, int i) const
{
CGAL_triangulation_precondition( ! is_infinite(f,i));
return Segment(f->vertex(ccw(i))->point(),
f->vertex(cw(i))->point());
typename Gt::Construct_segment_2
construct_segment = geom_traits().construct_segment_2_object();
return construct_segment(f->vertex(ccw(i))->point(),
f->vertex(cw(i))->point());
}
template <class Gt, class Tds >
@ -671,9 +675,11 @@ Triangulation_2<Gt, Tds>::Segment
Triangulation_2<Gt, Tds>::
segment(const Edge& e) const
{
CGAL_triangulation_precondition(! is_infinite(e));
return Segment(e.first->vertex(ccw(e.second))->point(),
e.first->vertex( cw(e.second))->point());
CGAL_triangulation_precondition(! is_infinite(e));
typename Gt::Construct_segment_2
construct_segment = geom_traits().construct_segment_2_object();
return construct_segment(e.first->vertex(ccw(e.second))->point(),
e.first->vertex( cw(e.second))->point());
}
template <class Gt, class Tds >

View File

@ -57,10 +57,14 @@ public:
typedef typename R::Side_of_oriented_circle_2 Side_of_oriented_circle_2;
typedef typename R::Construct_circumcenter_2 Construct_circumcenter_2;
typedef typename R::Construct_bisector_2 Construct_bisector_2;
typedef typename R::Construct_midpoint Construct_midpoint;
//typedef typename R::Construct_midpoint Construct_midpoint;
typedef typename R::Less_distance_to_point_2 Less_distance_to_point_2;
typedef typename R::Construct_segment_2 Construct_segment_2;
typedef typename R::Construct_triangle_2 Construct_triangle_2;
//typedef typename R::Construct_direction_2 Construct_direction_2;
typedef typename R::Construct_ray_2 Construct_ray_2;
typedef typename R::Construct_direction_of_line_2
Construct_direction_of_line_2;
Construct_direction_of_line_2;
// for compatibility with previous versions
typedef Point_2 Point;
@ -100,9 +104,9 @@ public:
construct_bisector_2_object() const
{return Construct_bisector_2();}
Construct_midpoint
construct_midpoint_object() const
{return Construct_midpoint();}
// Construct_midpoint
// construct_midpoint_object() const
// {return Construct_midpoint();}
Less_distance_to_point_2
@ -113,6 +117,18 @@ public:
construct_direction_of_line_2_object() const
{return Construct_direction_of_line_2();}
Construct_segment_2 construct_segment_2_object() const
{return Construct_segment_2();}
Construct_triangle_2 construct_triangle_2_object() const
{return Construct_triangle_2();}
// Construct_direction_2 construct_direction_2_object() const
// {return Construct_direction_2();}
Construct_ray_2 construct_ray_2_object() const
{return Construct_ray_2();}
};
CGAL_END_NAMESPACE

View File

@ -86,6 +86,8 @@ public:
typedef typename Rp::Compare_y_3 Compare_y_2;
typedef Orientation_xy_3<Rp> Orientation_2;
typedef Side_of_oriented_circle_xy_3<Rp> Side_of_oriented_circle_2;
typedef typename Rp::Construct_segment_3 Construct_segment_2;
typedef typename Rp::Construct_triangle_3 Construct_triangle_2;
// for compatibility with previous versions
typedef Point_2 Point;
@ -118,6 +120,12 @@ public:
side_of_oriented_circle_2_object() const
{return Side_of_oriented_circle_2();}
Construct_segment_2 construct_segment_2_object() const
{return Construct_segment_2();}
Construct_triangle_2 construct_triangle_2_object() const
{return Construct_triangle_2();}
};

View File

@ -84,6 +84,8 @@ public:
typedef typename Rp::Compare_z_3 Compare_y_2;
typedef Orientation_xz_3<Rp> Orientation_2;
typedef Side_of_oriented_circle_xz_3<Rp> Side_of_oriented_circle_2;
typedef typename Rp::Construct_segment_3 Construct_segment_2;
typedef typename Rp::Construct_triangle_3 Construct_triangle_2;
// for compatibility with previous versions
typedef Point_2 Point;
@ -114,6 +116,12 @@ public:
Side_of_oriented_circle_2
side_of_oriented_circle_2_object() const
{return Side_of_oriented_circle_2();}
Construct_segment_2 construct_segment_2_object() const
{return Construct_segment_2();}
Construct_triangle_2 construct_triangle_2_object() const
{return Construct_triangle_2();}
};
CGAL_END_NAMESPACE

View File

@ -84,6 +84,8 @@ public:
typedef typename Rp::Compare_z_3 Compare_y_2;
typedef Orientation_yz_3<Rp> Orientation_2;
typedef Side_of_oriented_circle_yz_3<Rp> Side_of_oriented_circle_2;
typedef typename Rp::Construct_segment_3 Construct_segment_2;
typedef typename Rp::Construct_triangle_3 Construct_triangle_2;
// for compatibility with previous versions
typedef Point_2 Point;
@ -116,6 +118,11 @@ public:
side_of_oriented_circle_2_object() const
{return Side_of_oriented_circle_2();}
Construct_segment_2 construct_segment_2_object() const
{return Construct_segment_2();}
Construct_triangle_2 construct_triangle_2_object() const
{return Construct_triangle_2();}
};

View File

@ -65,22 +65,6 @@ class Triangulation_test_segment {
};
class Triangulation_test_direction {
public:
typedef Triangulation_test_point Point;
protected:
Point _p, _q;
public:
Triangulation_test_direction() {}
Triangulation_test_direction(const Point &p, const Point &q)
: _p(p), _q(q) {}
Triangulation_test_direction perpendicular(const CGAL::Orientation &) const {
return *this;
}
void test_set(const Point &p, const Point &q) { _p=p; _q=q; }
};
class Triangulation_test_line {
public:
typedef Triangulation_test_point Point;
@ -91,15 +75,37 @@ class Triangulation_test_line {
Triangulation_test_line(const Point &p, const Point &q)
: _p(p), _q(q) {}
Triangulation_test_direction direction() {
return Triangulation_test_direction(_p,_q);
}
Triangulation_test_line opposite() {
return Triangulation_test_line(_q, _p);
}
void test_set(const Point &p, const Point &q) { _p=p; _q=q; }
Point first_point() const {return _p;}
Point second_point() const {return _q;}
// Triangulation_test_direction direction() {
// return Triangulation_test_direction(_p,_q);
// }
// Triangulation_test_line opposite() {
// return Triangulation_test_line(_q, _p);
// }
// void test_set(const Point &p, const Point &q) { _p=p; _q=q; }
};
class Triangulation_test_direction {
public:
typedef Triangulation_test_point Point;
typedef Triangulation_test_line Line;
protected:
Point _p, _q;
public:
Triangulation_test_direction() {}
Triangulation_test_direction(const Point &p, const Point &q)
: _p(p), _q(q) {}
Triangulation_test_direction(const Line &l)
: _p(l.first_point()), _q(l.second_point()) {}
// Triangulation_test_direction perpendicular(const CGAL::Orientation &) const {
// return *this;
// }
// void test_set(const Point &p, const Point &q) { _p=p; _q=q; }
};
class Triangulation_test_ray {
public:
typedef Triangulation_test_point Point;
@ -269,6 +275,45 @@ public:
}
};
class Triangulation_test_Construct_segment_2
{
public:
typedef Triangulation_test_point Point;
typedef Triangulation_test_segment Segment;
Segment operator()(const Point &p, const Point &q)
{
return Segment(p,q);
}
};
class Triangulation_test_Construct_triangle_2
{
public:
typedef Triangulation_test_point Point;
typedef Triangulation_test_triangle Triangle;
Triangle operator()(const Point &p, const Point &q, const Point& r)
{
return Triangle(p,q,r);
}
};
// class Triangulation_test_Construct_direction_2
// {
// public:
// typedef Triangulation_test_line Line;
// typedef Triangulation_test_direction Direction;
// Direction operator()(const Line &l) { return Direction(l);}
// };
class Triangulation_test_Construct_ray_2
{
public:
typedef Triangulation_test_point Point;
typedef Triangulation_test_ray Ray;
typedef Triangulation_test_direction Direction;
Ray operator()(const Point &p, const Direction& d) {return Ray(p,d);}
};
class Triangulation_test_Less_distance_to_point_2
{
@ -300,7 +345,7 @@ public:
Triangulation_test_Construct_direction_of_line_2(){}
typedef Triangulation_test_direction Direction;
typedef Triangulation_test_line Line;
Direction operator()(Line l) { return l.direction();}
Direction operator()(Line l) { return Direction(l);}
};
class _Triangulation_test_traits {
@ -327,6 +372,11 @@ public:
Less_distance_to_point_2;
typedef Triangulation_test_Construct_direction_of_line_2
Construct_direction_of_line_2;
typedef Triangulation_test_Construct_segment_2 Construct_segment_2;
typedef Triangulation_test_Construct_triangle_2 Construct_triangle_2;
//typedef Triangulation_test_Construct_direction_2 Construct_direction_2;
typedef Triangulation_test_Construct_ray_2 Construct_ray_2;
// typedef Triangulation_test_distance Distance;
@ -370,6 +420,22 @@ public:
Construct_direction_of_line_2
construct_direction_of_line_2_object() const
{ return Construct_direction_of_line_2();}
Construct_segment_2
construct_segment_2_object() const
{return Construct_segment_2();}
Construct_triangle_2
construct_triangle_2_object() const
{return Construct_triangle_2();}
// Construct_direction_2
// construct_direction_2_object() const
// {return Construct_direction_2();}
Construct_ray_2
construct_ray_2_object() const
{return Construct_ray_2();}
};