- Gather function objects in Kernel/function_objects.h.

This commit is contained in:
Sylvain Pion 2002-01-24 15:40:07 +00:00
parent 275374310a
commit 60009b704c
10 changed files with 59 additions and 548 deletions

View File

@ -1,3 +1,6 @@
3.79 (?? January 2002)
- Gather function objects in Kernel/function_objects.h.
3.78 (18 January 2002)
- Fix previous patch.

View File

@ -1312,6 +1312,27 @@ class Call_collinear_has_on
{ return c.collinear_has_on(a1); }
};
template <class Point>
struct p_Orientation
{
typedef Orientation result_type;
Orientation operator()(const Point& p, const Point& q, const Point& r) const
{ return orientation(p,q,r); }
Orientation operator()(const Point& p, const Point& q, const Point& r,
const Point& s) const
{ return orientation(p,q,r,s); }
};
template <class Point>
struct p_Less_dist_to_point
{
typedef bool result_type;
typedef Arity_tag< 3 > Arity;
bool operator()(const Point& p0, const Point& p1, const Point& p2) const
{ return has_smaller_dist_to_point(p0, p1, p2); }
};
} // end namespace CGALi
CGAL_END_NAMESPACE

View File

@ -242,7 +242,7 @@ CGAL_Kernel_pred(CGALi::Compare_distance<Point_2>,
CGAL_Kernel_pred(CGALi::Compare_slope,
Compare_slope_2,
compare_slope_2_object)
CGAL_Kernel_pred(CGAL ::p_Less_dist_to_point<Point_2>,
CGAL_Kernel_pred(CGALi::p_Less_dist_to_point<Point_2>,
Less_distance_to_point_2,
less_distance_to_point_2_object)
CGAL_Kernel_pred(CGAL ::p_Less_dist_to_line_2<Point_2>,
@ -271,7 +271,7 @@ CGAL_Kernel_pred(CGALi::p_Angle,
CGAL_Kernel_pred(CGALi::Collinear,
Collinear_2,
collinear_2_object)
CGAL_Kernel_pred(CGAL ::p_Orientation<Point_2>,
CGAL_Kernel_pred(CGALi::p_Orientation<Point_2>,
Orientation_2,
orientation_2_object)
CGAL_Kernel_pred(CGALi::Side_of_oriented_circle,
@ -550,7 +550,7 @@ CGAL_Kernel_pred(CGALi::Compare_xyz,
CGAL_Kernel_pred(CGALi::Compare_distance<Point_3>,
Compare_distance_3,
compare_distance_3_object)
CGAL_Kernel_pred(CGAL ::p_Less_dist_to_point<Point_3>,
CGAL_Kernel_pred(CGALi::p_Less_dist_to_point<Point_3>,
Less_distance_to_point_3,
less_distance_to_point_3_object)
CGAL_Kernel_pred2(CGALi::Less_signed_distance_to_plane<Plane_3, Point_3>,
@ -571,7 +571,7 @@ CGAL_Kernel_pred(CGALi::Coplanar_orientation,
CGAL_Kernel_pred(CGALi::Coplanar_side_of_bounded_circle,
Coplanar_side_of_bounded_circle_3,
coplanar_side_of_bounded_circle_3_object)
CGAL_Kernel_pred(CGAL ::p_Orientation<Point_3>,
CGAL_Kernel_pred(CGALi::p_Orientation<Point_3>,
Orientation_3,
orientation_3_object)
CGAL_Kernel_pred(CGALi::Call_is_degenerate,

View File

@ -19,75 +19,11 @@
// coordinator : MPI, Saarbruecken
// ======================================================================
#ifndef CGAL_PREDICATE_OBJECTS_ON_POINTS_2_H
#define CGAL_PREDICATE_OBJECTS_ON_POINTS_2_H
#include <CGAL/user_classes.h>
CGAL_BEGIN_NAMESPACE
template <class Point>
class p_Left_of_line_2p
{
public:
typedef bool result_type;
typedef Arity_tag< 1 > Arity;
p_Left_of_line_2p(const Point& a, const Point& b)
: p_a(a), p_b(b)
{}
bool operator()(const Point& c) const
{ return left_turn( p_a, p_b, c ); }
private:
Point p_a;
Point p_b;
};
template <class Point>
class p_Right_of_line_2p
{
public:
typedef bool result_type;
typedef Arity_tag< 1 > Arity;
p_Right_of_line_2p(const Point& a, const Point& b)
: p_a(a), p_b(b)
{}
bool operator()(const Point& c) const
{ return right_turn( p_a, p_b, c ); }
private:
Point p_a;
Point p_b;
};
template <class Point>
class p_Left_of_line_2p_safer
{
public:
typedef bool result_type;
typedef Arity_tag< 1 > Arity;
p_Left_of_line_2p_safer(const Point& a, const Point& b)
: p_a(a), p_b(b)
{}
bool operator()(const Point& c) const
{
if ( (c == p_a) || ( c == p_b ) ) return false;
return left_turn( p_a, p_b, c );
}
private:
Point p_a;
Point p_b;
};
template <class Point>
struct p_Less_xy
{
@ -98,16 +34,6 @@ struct p_Less_xy
{ return lexicographically_xy_smaller( p1, p2); }
};
template <class Point>
struct p_Greater_xy
{
typedef bool result_type;
typedef Arity_tag< 2 > Arity;
bool operator()( const Point& p1, const Point& p2) const
{ return lexicographically_xy_larger( p1, p2); }
};
template <class Point>
struct p_Less_yx
{
@ -118,16 +44,6 @@ struct p_Less_yx
{ return lexicographically_yx_smaller( p1, p2); }
};
template <class Point>
struct p_Greater_yx
{
typedef bool result_type;
typedef Arity_tag< 2 > Arity;
bool operator()( const Point& p1, const Point& p2) const
{ return lexicographically_yx_larger( p1, p2); }
};
template <class Point>
class p_Less_dist_to_line_2p
{
@ -190,40 +106,6 @@ public:
};
template <class Point>
class p_Less_negative_dist_to_line_2p
{
public:
typedef bool result_type;
typedef Arity_tag< 2 > Arity;
p_Less_negative_dist_to_line_2p(const Point& a, const Point& b)
: p_a(a), p_b(b)
{}
bool operator()(const Point& c, const Point& d) const
{
Comparison_result
res = compare_signed_distance_to_line( p_a, p_b, c, d);
if ( res == LARGER )
{
return true;
}
else if ( res == SMALLER )
{
return false;
}
else
{
return lexicographically_xy_smaller( c, d );
}
}
private:
Point p_a;
Point p_b;
};
template <class Point>
class p_Less_rotate_ccw
{
@ -252,182 +134,6 @@ public:
}
};
template <class Point>
class p_Less_rotate_ccw_safer
{
public:
typedef bool result_type;
typedef Arity_tag< 2 > Arity;
p_Less_rotate_ccw_safer(const Point& p) : rot_point(p)
{}
bool operator()(const Point& p, const Point& q) const
{
if (p == rot_point) return false;
if (q == rot_point) return true;
if (p == q) return false;
Orientation ori = orientation(rot_point, p, q);
if ( ori == LEFTTURN )
{
return true;
}
else if ( ori == RIGHTTURN )
{
return false;
}
else
{
return collinear_are_ordered_along_line( rot_point, q, p);
}
}
void set_rotation_center( const Point& p)
{ rot_point = p; }
private:
Point rot_point;
};
template <class Point>
class p_Less_rotate_ccw_E
{
public:
typedef bool result_type;
typedef Arity_tag< 2 > Arity;
p_Less_rotate_ccw_E(const Point& p) : rot_point(p)
{}
bool operator()(const Point& p, const Point& q) const
{
Orientation ori = orientation(rot_point, p, q);
if ( ori == LEFTTURN )
{
return true;
}
else if ( ori == RIGHTTURN )
{
return false;
}
else
{
return has_larger_dist_to_point( rot_point, p, q) ;
}
}
void set_rotation_center( const Point& p)
{ rot_point = p; }
private:
Point rot_point;
};
template <class R>
class r_Right_of_line
{
public:
typedef bool result_type;
typedef Arity_tag< 1 > Arity;
typedef typename R::Point_2 Point;
typedef typename R::Line_2 Line;
r_Right_of_line(const Point& a, const Point& b) : l_ab( a, b )
{}
bool operator()(const Point& c) const
{
if ( l_ab.is_degenerate() ) return false;
return (l_ab.oriented_side(c) == ON_NEGATIVE_SIDE);
}
private:
Line l_ab;
};
template <class R>
class r_Left_of_line
{
public:
typedef bool result_type;
typedef Arity_tag< 3 > Arity;
typedef typename R::Point_2 Point;
typedef typename R::Line_2 Line;
r_Left_of_line(): line_constructed(false)
{}
bool operator()(const Point& a, const Point& b, const Point& c) const
{
if (!line_constructed)
{
line_constructed = true;
l_ab = Line(a,b);
is_deg = a == b;
}
return ( !is_deg && (l_ab.oriented_side(c) == ON_POSITIVE_SIDE));
}
private:
mutable bool line_constructed;
mutable Line l_ab;
mutable bool is_deg;
};
template <class Point>
class p_Less_dist_to_point
{
public:
typedef bool result_type;
typedef Arity_tag< 3 > Arity;
p_Less_dist_to_point( )
{}
bool operator()( const Point& p0, const Point& p1, const Point& p2) const
{ return has_smaller_dist_to_point(p0, p1, p2); }
};
template <class R>
class r_Less_negative_dist_to_line
{
public:
typedef bool result_type;
typedef Arity_tag< 2 > Arity;
typedef typename R::Point_2 Point;
typedef typename R::Line_2 Line;
r_Less_negative_dist_to_line(const Point& a, const Point& b) :
l_ab( a, b )
{}
bool operator()(const Point& c, const Point& d) const
{
Comparison_result res = compare_signed_distance_to_line(l_ab, c, d);
if ( res == SMALLER )
{
return false;
}
else if ( res == EQUAL )
{
return lexicographically_xy_smaller( c, d );
}
else
{
return true;
}
}
private:
Line l_ab;
};
template <class R>
class r_Less_dist_to_line
{
@ -469,43 +175,6 @@ private:
mutable Line l_ab;
};
template <class R>
class r_Less_in_direction
{
public:
typedef bool result_type;
typedef Arity_tag< 2 > Arity;
typedef typename R::RT RT;
typedef typename R::Direction_2 Direction;
typedef typename R::Point_2 Point;
typedef typename R::Line_2 Line;
r_Less_in_direction( const Direction& dir ) : l(Point(RT(0) , RT(0)),
Direction(-(dir.dy()), dir.dx() ))
{}
bool operator()(const Point& c, const Point& d) const
{
Comparison_result res = compare_signed_distance_to_line(l, c, d);
if ( res == LARGER )
{
return true;
}
else if ( res == EQUAL )
{
return lexicographically_xy_smaller( c, d) ;
}
else
{
return false;
}
}
private:
Line l;
};
template <class Point>
struct p_Left_turn
{
@ -516,51 +185,6 @@ struct p_Left_turn
{ return left_turn(p,q,r); }
};
template <class Point>
struct p_Right_turn
{
typedef bool result_type;
typedef Arity_tag< 3 > Arity;
bool operator()(const Point& p, const Point& q, const Point& r) const
{ return right_turn(p,q,r); }
};
#ifndef CGAL_NO_DEPRECATED_CODE
template <class Point>
struct p_Leftturn
{
typedef bool result_type;
typedef Arity_tag< 3 > Arity;
bool operator()(const Point& p, const Point& q, const Point& r) const
{ return left_turn(p,q,r); }
};
template <class Point>
struct p_Rightturn
{
typedef bool result_type;
typedef Arity_tag< 3 > Arity;
bool operator()(const Point& p, const Point& q, const Point& r) const
{ return right_turn(p,q,r); }
};
#endif // CGAL_NO_DEPRECATED_CODE
template <class Point>
struct p_Orientation
{
typedef Orientation result_type;
Orientation
operator()(const Point& p, const Point& q, const Point& r) const
{ return orientation(p,q,r); }
Orientation
operator()(const Point& p, const Point& q, const Point& r,
const Point& s) const
{ return orientation(p,q,r,s); }
};
CGAL_END_NAMESPACE
#endif // CGAL_PREDICATE_OBJECTS_ON_POINTS_2_H

View File

@ -17,18 +17,16 @@
// revision_date : $Date$
// author(s) : Stefan Schirra
//
//
// coordinator : MPI, Saarbruecken (<Stefan.Schirra@mpi-sb.mpg.de>)
// coordinator : MPI, Saarbruecken
// ======================================================================
#ifndef CGAL_REPRESENTATION_TAGS_H
#define CGAL_REPRESENTATION_TAGS_H
CGAL_BEGIN_NAMESPACE
class Cartesian_tag {};
class Homogeneous_tag {};
class Old_style_tag {};
CGAL_END_NAMESPACE

View File

@ -18,89 +18,12 @@
// author(s) : Andreas Fabri
// Stefan Schirra
//
// coordinator : MPI, Saarbruecken (<Stefan.Schirra@mpi-sb.mpg.de>)
// coordinator : MPI, Saarbruecken
// ======================================================================
#ifndef CGAL_USER_CLASSES_H
#define CGAL_USER_CLASSES_H
CGAL_BEGIN_NAMESPACE
template < class R >
class Point_2;
template < class R >
class Vector_2;
template < class R >
class Direction_2;
template < class R >
class Line_2;
template < class R >
class Ray_2;
template < class R >
class Segment_2;
template < class R >
class Triangle_2;
template < class R >
class Iso_rectangle_2;
template < class R >
class Circle_2;
template < class R >
class Conic_2;
template < class R >
class Aff_transformation_base_2;
template < class R >
class Aff_transformation_2;
template < class R >
class Aff_transformation_3;
template < class R >
class Plane_3;
template < class R >
class Point_3;
template < class R >
class Vector_3;
template < class R >
class Direction_3;
template < class R >
class Line_3;
template < class R >
class Ray_3;
template < class R >
class Segment_3;
template < class R >
class Triangle_3;
template < class R >
class Tetrahedron_3;
template < class R >
class Iso_cuboid_3;
template < class R >
class Sphere_3;
CGAL_END_NAMESPACE
#include <CGAL/Point_2.h>
#include <CGAL/Vector_2.h>
#include <CGAL/Direction_2.h>

View File

@ -1312,6 +1312,27 @@ class Call_collinear_has_on
{ return c.collinear_has_on(a1); }
};
template <class Point>
struct p_Orientation
{
typedef Orientation result_type;
Orientation operator()(const Point& p, const Point& q, const Point& r) const
{ return orientation(p,q,r); }
Orientation operator()(const Point& p, const Point& q, const Point& r,
const Point& s) const
{ return orientation(p,q,r,s); }
};
template <class Point>
struct p_Less_dist_to_point
{
typedef bool result_type;
typedef Arity_tag< 3 > Arity;
bool operator()(const Point& p0, const Point& p1, const Point& p2) const
{ return has_smaller_dist_to_point(p0, p1, p2); }
};
} // end namespace CGALi
CGAL_END_NAMESPACE

View File

@ -242,7 +242,7 @@ CGAL_Kernel_pred(CGALi::Compare_distance<Point_2>,
CGAL_Kernel_pred(CGALi::Compare_slope,
Compare_slope_2,
compare_slope_2_object)
CGAL_Kernel_pred(CGAL ::p_Less_dist_to_point<Point_2>,
CGAL_Kernel_pred(CGALi::p_Less_dist_to_point<Point_2>,
Less_distance_to_point_2,
less_distance_to_point_2_object)
CGAL_Kernel_pred(CGAL ::p_Less_dist_to_line_2<Point_2>,
@ -271,7 +271,7 @@ CGAL_Kernel_pred(CGALi::p_Angle,
CGAL_Kernel_pred(CGALi::Collinear,
Collinear_2,
collinear_2_object)
CGAL_Kernel_pred(CGAL ::p_Orientation<Point_2>,
CGAL_Kernel_pred(CGALi::p_Orientation<Point_2>,
Orientation_2,
orientation_2_object)
CGAL_Kernel_pred(CGALi::Side_of_oriented_circle,
@ -550,7 +550,7 @@ CGAL_Kernel_pred(CGALi::Compare_xyz,
CGAL_Kernel_pred(CGALi::Compare_distance<Point_3>,
Compare_distance_3,
compare_distance_3_object)
CGAL_Kernel_pred(CGAL ::p_Less_dist_to_point<Point_3>,
CGAL_Kernel_pred(CGALi::p_Less_dist_to_point<Point_3>,
Less_distance_to_point_3,
less_distance_to_point_3_object)
CGAL_Kernel_pred2(CGALi::Less_signed_distance_to_plane<Plane_3, Point_3>,
@ -571,7 +571,7 @@ CGAL_Kernel_pred(CGALi::Coplanar_orientation,
CGAL_Kernel_pred(CGALi::Coplanar_side_of_bounded_circle,
Coplanar_side_of_bounded_circle_3,
coplanar_side_of_bounded_circle_3_object)
CGAL_Kernel_pred(CGAL ::p_Orientation<Point_3>,
CGAL_Kernel_pred(CGALi::p_Orientation<Point_3>,
Orientation_3,
orientation_3_object)
CGAL_Kernel_pred(CGALi::Call_is_degenerate,

View File

@ -17,18 +17,16 @@
// revision_date : $Date$
// author(s) : Stefan Schirra
//
//
// coordinator : MPI, Saarbruecken (<Stefan.Schirra@mpi-sb.mpg.de>)
// coordinator : MPI, Saarbruecken
// ======================================================================
#ifndef CGAL_REPRESENTATION_TAGS_H
#define CGAL_REPRESENTATION_TAGS_H
CGAL_BEGIN_NAMESPACE
class Cartesian_tag {};
class Homogeneous_tag {};
class Old_style_tag {};
CGAL_END_NAMESPACE

View File

@ -18,89 +18,12 @@
// author(s) : Andreas Fabri
// Stefan Schirra
//
// coordinator : MPI, Saarbruecken (<Stefan.Schirra@mpi-sb.mpg.de>)
// coordinator : MPI, Saarbruecken
// ======================================================================
#ifndef CGAL_USER_CLASSES_H
#define CGAL_USER_CLASSES_H
CGAL_BEGIN_NAMESPACE
template < class R >
class Point_2;
template < class R >
class Vector_2;
template < class R >
class Direction_2;
template < class R >
class Line_2;
template < class R >
class Ray_2;
template < class R >
class Segment_2;
template < class R >
class Triangle_2;
template < class R >
class Iso_rectangle_2;
template < class R >
class Circle_2;
template < class R >
class Conic_2;
template < class R >
class Aff_transformation_base_2;
template < class R >
class Aff_transformation_2;
template < class R >
class Aff_transformation_3;
template < class R >
class Plane_3;
template < class R >
class Point_3;
template < class R >
class Vector_3;
template < class R >
class Direction_3;
template < class R >
class Line_3;
template < class R >
class Ray_3;
template < class R >
class Segment_3;
template < class R >
class Triangle_3;
template < class R >
class Tetrahedron_3;
template < class R >
class Iso_cuboid_3;
template < class R >
class Sphere_3;
CGAL_END_NAMESPACE
#include <CGAL/Point_2.h>
#include <CGAL/Vector_2.h>
#include <CGAL/Direction_2.h>