mirror of https://github.com/CGAL/cgal
moved functors from predicate_objects_on_points.h to Kernel/function_objects
and put them in namespace CGALi
This commit is contained in:
parent
2fed0cccb8
commit
3e0681bcbc
|
|
@ -1334,6 +1334,93 @@ struct p_Less_dist_to_point
|
|||
{ return has_smaller_dist_to_point(p0, p1, p2); }
|
||||
};
|
||||
|
||||
template <class Point>
|
||||
struct p_Less_xy
|
||||
{
|
||||
typedef bool result_type;
|
||||
typedef Arity_tag< 2 > Arity;
|
||||
|
||||
bool operator()( const Point& p1, const Point& p2) const
|
||||
{ return lexicographically_xy_smaller( p1, p2); }
|
||||
};
|
||||
|
||||
template <class Point>
|
||||
struct p_Less_yx
|
||||
{
|
||||
typedef bool result_type;
|
||||
typedef Arity_tag< 2 > Arity;
|
||||
|
||||
bool operator()( const Point& p1, const Point& p2) const
|
||||
{ return lexicographically_yx_smaller( p1, p2); }
|
||||
};
|
||||
|
||||
template <class Point>
|
||||
class p_Less_dist_to_line_2
|
||||
{
|
||||
public:
|
||||
typedef bool result_type;
|
||||
typedef Arity_tag< 4 > Arity;
|
||||
|
||||
bool operator()(const Point&a, const Point& b,
|
||||
const Point& c, const Point& d) const
|
||||
{
|
||||
Comparison_result
|
||||
res = compare_signed_distance_to_line( a, b, c, d);
|
||||
if ( res == LARGER )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if ( res == SMALLER )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return lexicographically_xy_smaller( c, d );
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
template <class Point>
|
||||
class p_Less_rotate_ccw
|
||||
{
|
||||
public:
|
||||
typedef bool result_type;
|
||||
typedef Arity_tag< 3 > Arity;
|
||||
|
||||
bool operator()(const Point& r, const Point& p, const Point& q) const
|
||||
{
|
||||
Orientation ori = orientation(r, p, q);
|
||||
if ( ori == LEFTTURN )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if ( ori == RIGHTTURN )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (p == r) return false;
|
||||
if (q == r) return true;
|
||||
if (p == q) return false;
|
||||
return collinear_are_ordered_along_line( r, q, p);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <class Point>
|
||||
struct p_Left_turn
|
||||
{
|
||||
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); }
|
||||
};
|
||||
|
||||
|
||||
} // end namespace CGALi
|
||||
CGAL_END_NAMESPACE
|
||||
|
||||
|
|
|
|||
|
|
@ -215,10 +215,10 @@ CGAL_Kernel_pred(CGALi::Less_x,
|
|||
CGAL_Kernel_pred(CGALi::Less_y,
|
||||
Less_y_2,
|
||||
less_y_2_object)
|
||||
CGAL_Kernel_pred(CGAL::p_Less_xy<Point_2>,
|
||||
CGAL_Kernel_pred(CGALi::p_Less_xy<Point_2>,
|
||||
Less_xy_2,
|
||||
less_xy_2_object)
|
||||
CGAL_Kernel_pred(CGAL::p_Less_yx<Point_2>,
|
||||
CGAL_Kernel_pred(CGALi::p_Less_yx<Point_2>,
|
||||
Less_yx_2,
|
||||
less_yx_2_object)
|
||||
CGAL_Kernel_pred(CGALi::Compare_x,
|
||||
|
|
@ -245,10 +245,10 @@ CGAL_Kernel_pred(CGALi::Compare_slope,
|
|||
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>,
|
||||
CGAL_Kernel_pred(CGALi::p_Less_dist_to_line_2<Point_2>,
|
||||
Less_signed_distance_to_line_2,
|
||||
less_signed_distance_to_line_2_object)
|
||||
CGAL_Kernel_pred(CGAL ::p_Less_rotate_ccw<Point_2>,
|
||||
CGAL_Kernel_pred(CGALi::p_Less_rotate_ccw<Point_2>,
|
||||
Less_rotate_ccw_2,
|
||||
less_rotate_ccw_2_object)
|
||||
CGAL_Kernel_pred(CGALi::Compare_angle_with_x_axis<Direction_2>,
|
||||
|
|
@ -257,11 +257,11 @@ CGAL_Kernel_pred(CGALi::Compare_angle_with_x_axis<Direction_2>,
|
|||
CGAL_Kernel_pred(CGALi::Counterclockwise_in_between,
|
||||
Counterclockwise_in_between_2,
|
||||
counterclockwise_in_between_2_object)
|
||||
CGAL_Kernel_pred(CGAL ::p_Left_turn<Point_2>,
|
||||
CGAL_Kernel_pred(CGALi::p_Left_turn<Point_2>,
|
||||
Left_turn_2,
|
||||
left_turn_2_object)
|
||||
#ifndef CGAL_NO_DEPRECATED_CODE
|
||||
CGAL_Kernel_pred(CGAL ::p_Left_turn<Point_2>,
|
||||
CGAL_Kernel_pred(CGALi::p_Left_turn<Point_2>,
|
||||
Leftturn_2,
|
||||
leftturn_2_object)
|
||||
#endif // CGAL_NO_DEPRECATED_CODE
|
||||
|
|
|
|||
|
|
@ -1,190 +0,0 @@
|
|||
// ======================================================================
|
||||
//
|
||||
// Copyright (c) 1999 The CGAL Consortium
|
||||
//
|
||||
// This software and related documentation is part of an INTERNAL release
|
||||
// of the Computational Geometry Algorithms Library (CGAL). It is not
|
||||
// intended for general use.
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// release :
|
||||
// release_date :
|
||||
//
|
||||
// file : include/CGAL/predicate_objects_on_points_2.h
|
||||
// package : Kernel_basic
|
||||
// revision : $Revision$
|
||||
// revision_date : $Date$
|
||||
// author(s) : Stefan Schirra
|
||||
//
|
||||
// coordinator : MPI, Saarbruecken
|
||||
// ======================================================================
|
||||
|
||||
#ifndef CGAL_PREDICATE_OBJECTS_ON_POINTS_2_H
|
||||
#define CGAL_PREDICATE_OBJECTS_ON_POINTS_2_H
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
template <class Point>
|
||||
struct p_Less_xy
|
||||
{
|
||||
typedef bool result_type;
|
||||
typedef Arity_tag< 2 > Arity;
|
||||
|
||||
bool operator()( const Point& p1, const Point& p2) const
|
||||
{ return lexicographically_xy_smaller( p1, p2); }
|
||||
};
|
||||
|
||||
template <class Point>
|
||||
struct p_Less_yx
|
||||
{
|
||||
typedef bool result_type;
|
||||
typedef Arity_tag< 2 > Arity;
|
||||
|
||||
bool operator()( const Point& p1, const Point& p2) const
|
||||
{ return lexicographically_yx_smaller( p1, p2); }
|
||||
};
|
||||
|
||||
template <class Point>
|
||||
class p_Less_dist_to_line_2p
|
||||
{
|
||||
public:
|
||||
typedef bool result_type;
|
||||
typedef Arity_tag< 2 > Arity;
|
||||
|
||||
p_Less_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 false;
|
||||
}
|
||||
else if ( res == SMALLER )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return lexicographically_xy_smaller( c, d );
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
Point p_a;
|
||||
Point p_b;
|
||||
};
|
||||
|
||||
template <class Point>
|
||||
class p_Less_dist_to_line_2
|
||||
{
|
||||
public:
|
||||
typedef bool result_type;
|
||||
typedef Arity_tag< 4 > Arity;
|
||||
|
||||
bool operator()(const Point&a, const Point& b,
|
||||
const Point& c, const Point& d) const
|
||||
{
|
||||
Comparison_result
|
||||
res = compare_signed_distance_to_line( a, b, c, d);
|
||||
if ( res == LARGER )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if ( res == SMALLER )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return lexicographically_xy_smaller( c, d );
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
template <class Point>
|
||||
class p_Less_rotate_ccw
|
||||
{
|
||||
public:
|
||||
typedef bool result_type;
|
||||
typedef Arity_tag< 3 > Arity;
|
||||
|
||||
bool operator()(const Point& r, const Point& p, const Point& q) const
|
||||
{
|
||||
Orientation ori = orientation(r, p, q);
|
||||
if ( ori == LEFTTURN )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if ( ori == RIGHTTURN )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (p == r) return false;
|
||||
if (q == r) return true;
|
||||
if (p == q) return false;
|
||||
return collinear_are_ordered_along_line( r, q, p);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <class R>
|
||||
class r_Less_dist_to_line
|
||||
{
|
||||
public:
|
||||
typedef bool result_type;
|
||||
typedef Arity_tag< 4 > Arity;
|
||||
|
||||
typedef typename R::Point_2 Point;
|
||||
typedef typename R::Line_2 Line;
|
||||
|
||||
r_Less_dist_to_line() : line_constructed( false )
|
||||
{ }
|
||||
|
||||
bool operator()(const Point& a, const Point& b,
|
||||
const Point& c, const Point& d) const
|
||||
{
|
||||
if (!line_constructed)
|
||||
{
|
||||
line_constructed = true;
|
||||
l_ab = Line(a,b);
|
||||
}
|
||||
Comparison_result res = compare_signed_distance_to_line(l_ab, c, d);
|
||||
if ( res == SMALLER )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if ( res == EQUAL )
|
||||
{
|
||||
return lexicographically_xy_smaller( c, d );
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
mutable bool line_constructed;
|
||||
mutable Line l_ab;
|
||||
};
|
||||
|
||||
template <class Point>
|
||||
struct p_Left_turn
|
||||
{
|
||||
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); }
|
||||
};
|
||||
|
||||
CGAL_END_NAMESPACE
|
||||
|
||||
#endif // CGAL_PREDICATE_OBJECTS_ON_POINTS_2_H
|
||||
|
|
@ -1334,6 +1334,93 @@ struct p_Less_dist_to_point
|
|||
{ return has_smaller_dist_to_point(p0, p1, p2); }
|
||||
};
|
||||
|
||||
template <class Point>
|
||||
struct p_Less_xy
|
||||
{
|
||||
typedef bool result_type;
|
||||
typedef Arity_tag< 2 > Arity;
|
||||
|
||||
bool operator()( const Point& p1, const Point& p2) const
|
||||
{ return lexicographically_xy_smaller( p1, p2); }
|
||||
};
|
||||
|
||||
template <class Point>
|
||||
struct p_Less_yx
|
||||
{
|
||||
typedef bool result_type;
|
||||
typedef Arity_tag< 2 > Arity;
|
||||
|
||||
bool operator()( const Point& p1, const Point& p2) const
|
||||
{ return lexicographically_yx_smaller( p1, p2); }
|
||||
};
|
||||
|
||||
template <class Point>
|
||||
class p_Less_dist_to_line_2
|
||||
{
|
||||
public:
|
||||
typedef bool result_type;
|
||||
typedef Arity_tag< 4 > Arity;
|
||||
|
||||
bool operator()(const Point&a, const Point& b,
|
||||
const Point& c, const Point& d) const
|
||||
{
|
||||
Comparison_result
|
||||
res = compare_signed_distance_to_line( a, b, c, d);
|
||||
if ( res == LARGER )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if ( res == SMALLER )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return lexicographically_xy_smaller( c, d );
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
template <class Point>
|
||||
class p_Less_rotate_ccw
|
||||
{
|
||||
public:
|
||||
typedef bool result_type;
|
||||
typedef Arity_tag< 3 > Arity;
|
||||
|
||||
bool operator()(const Point& r, const Point& p, const Point& q) const
|
||||
{
|
||||
Orientation ori = orientation(r, p, q);
|
||||
if ( ori == LEFTTURN )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if ( ori == RIGHTTURN )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (p == r) return false;
|
||||
if (q == r) return true;
|
||||
if (p == q) return false;
|
||||
return collinear_are_ordered_along_line( r, q, p);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <class Point>
|
||||
struct p_Left_turn
|
||||
{
|
||||
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); }
|
||||
};
|
||||
|
||||
|
||||
} // end namespace CGALi
|
||||
CGAL_END_NAMESPACE
|
||||
|
||||
|
|
|
|||
|
|
@ -215,10 +215,10 @@ CGAL_Kernel_pred(CGALi::Less_x,
|
|||
CGAL_Kernel_pred(CGALi::Less_y,
|
||||
Less_y_2,
|
||||
less_y_2_object)
|
||||
CGAL_Kernel_pred(CGAL::p_Less_xy<Point_2>,
|
||||
CGAL_Kernel_pred(CGALi::p_Less_xy<Point_2>,
|
||||
Less_xy_2,
|
||||
less_xy_2_object)
|
||||
CGAL_Kernel_pred(CGAL::p_Less_yx<Point_2>,
|
||||
CGAL_Kernel_pred(CGALi::p_Less_yx<Point_2>,
|
||||
Less_yx_2,
|
||||
less_yx_2_object)
|
||||
CGAL_Kernel_pred(CGALi::Compare_x,
|
||||
|
|
@ -245,10 +245,10 @@ CGAL_Kernel_pred(CGALi::Compare_slope,
|
|||
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>,
|
||||
CGAL_Kernel_pred(CGALi::p_Less_dist_to_line_2<Point_2>,
|
||||
Less_signed_distance_to_line_2,
|
||||
less_signed_distance_to_line_2_object)
|
||||
CGAL_Kernel_pred(CGAL ::p_Less_rotate_ccw<Point_2>,
|
||||
CGAL_Kernel_pred(CGALi::p_Less_rotate_ccw<Point_2>,
|
||||
Less_rotate_ccw_2,
|
||||
less_rotate_ccw_2_object)
|
||||
CGAL_Kernel_pred(CGALi::Compare_angle_with_x_axis<Direction_2>,
|
||||
|
|
@ -257,11 +257,11 @@ CGAL_Kernel_pred(CGALi::Compare_angle_with_x_axis<Direction_2>,
|
|||
CGAL_Kernel_pred(CGALi::Counterclockwise_in_between,
|
||||
Counterclockwise_in_between_2,
|
||||
counterclockwise_in_between_2_object)
|
||||
CGAL_Kernel_pred(CGAL ::p_Left_turn<Point_2>,
|
||||
CGAL_Kernel_pred(CGALi::p_Left_turn<Point_2>,
|
||||
Left_turn_2,
|
||||
left_turn_2_object)
|
||||
#ifndef CGAL_NO_DEPRECATED_CODE
|
||||
CGAL_Kernel_pred(CGAL ::p_Left_turn<Point_2>,
|
||||
CGAL_Kernel_pred(CGALi::p_Left_turn<Point_2>,
|
||||
Leftturn_2,
|
||||
leftturn_2_object)
|
||||
#endif // CGAL_NO_DEPRECATED_CODE
|
||||
|
|
|
|||
Loading…
Reference in New Issue