mirror of https://github.com/CGAL/cgal
Add Compare_xy_2 to TriangulationTraits_2
This enables customization of projection traits for CDT_2s and facilitates unification with the predicates utilized in 3D triangulations.
This commit is contained in:
parent
98f1e53020
commit
e313fdc697
|
|
@ -971,6 +971,7 @@ public:
|
||||||
typedef typename Rp::Construct_triangle_3 Construct_triangle_2;
|
typedef typename Rp::Construct_triangle_3 Construct_triangle_2;
|
||||||
typedef typename Rp::Construct_line_3 Construct_line_2;
|
typedef typename Rp::Construct_line_3 Construct_line_2;
|
||||||
|
|
||||||
|
typedef typename Rp::Compare_xyz_3 Compare_xy_2;
|
||||||
|
|
||||||
struct Less_xy_2 {
|
struct Less_xy_2 {
|
||||||
typedef typename R::Boolean result_type;
|
typedef typename R::Boolean result_type;
|
||||||
|
|
@ -1065,6 +1066,10 @@ public:
|
||||||
less_x_2_object() const
|
less_x_2_object() const
|
||||||
{ return Less_x_2();}
|
{ return Less_x_2();}
|
||||||
|
|
||||||
|
Compare_xy_2
|
||||||
|
compare_xy_2_object() const
|
||||||
|
{ return Compare_xy_2();}
|
||||||
|
|
||||||
Less_xy_2
|
Less_xy_2
|
||||||
less_xy_2_object() const
|
less_xy_2_object() const
|
||||||
{ return Less_xy_2();}
|
{ return Less_xy_2();}
|
||||||
|
|
|
||||||
|
|
@ -426,6 +426,7 @@ public:
|
||||||
typedef typename K::Line_3 Line_2;
|
typedef typename K::Line_3 Line_2;
|
||||||
|
|
||||||
typedef typename K::Angle_3 Angle_2;
|
typedef typename K::Angle_3 Angle_2;
|
||||||
|
typedef typename K::Compare_xyz_3 Compare_xy_2;
|
||||||
|
|
||||||
typedef TriangulationProjectionTraitsCartesianFunctors::
|
typedef TriangulationProjectionTraitsCartesianFunctors::
|
||||||
Compare_along_axis<Self> Compare_x_2;
|
Compare_along_axis<Self> Compare_x_2;
|
||||||
|
|
@ -524,6 +525,9 @@ public:
|
||||||
Angle_2 angle_2_object() const
|
Angle_2 angle_2_object() const
|
||||||
{return Angle_2();}
|
{return Angle_2();}
|
||||||
|
|
||||||
|
Compare_xy_2 compare_xy_2_object() const
|
||||||
|
{return Compare_xy_2();}
|
||||||
|
|
||||||
Construct_point_2 construct_point_2_object() const
|
Construct_point_2 construct_point_2_object() const
|
||||||
{return Construct_point_2();}
|
{return Construct_point_2();}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -144,6 +144,19 @@ according to the
|
||||||
*/
|
*/
|
||||||
typedef unspecified_type Compare_y_2;
|
typedef unspecified_type Compare_y_2;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
A function object that lexicographically compares two points by their Cartesian
|
||||||
|
coordinates.
|
||||||
|
It provides the operator:
|
||||||
|
|
||||||
|
`Comparison_result operator()(Point p, Point q)`
|
||||||
|
|
||||||
|
which returns
|
||||||
|
(`SMALLER, EQUAL` or `LARGER`)
|
||||||
|
according to the lexicographical order of points `p` and `q`.
|
||||||
|
*/
|
||||||
|
typedef unspecified_type Compare_xy_2;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
A function object to compute the orientation of three points.
|
A function object to compute the orientation of three points.
|
||||||
|
|
||||||
|
|
@ -245,6 +258,11 @@ Compare_y_2 compare_y_2_object();
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
||||||
|
*/
|
||||||
|
Compare_xy_2 compare_xy_2_object();
|
||||||
|
|
||||||
|
/*!
|
||||||
|
|
||||||
*/
|
*/
|
||||||
Orientation_2 orientation_2_object();
|
Orientation_2 orientation_2_object();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3671,13 +3671,8 @@ Comparison_result
|
||||||
Triangulation_2<Gt, Tds>::
|
Triangulation_2<Gt, Tds>::
|
||||||
compare_xy(const Point& p, const Point& q) const
|
compare_xy(const Point& p, const Point& q) const
|
||||||
{
|
{
|
||||||
Comparison_result res = geom_traits().compare_x_2_object()(construct_point(p),
|
return geom_traits().compare_xy_2_object()(construct_point(p),
|
||||||
construct_point(q));
|
construct_point(q));
|
||||||
if(res == EQUAL){
|
|
||||||
return geom_traits().compare_y_2_object()(construct_point(p),
|
|
||||||
construct_point(q));
|
|
||||||
}
|
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Gt, class Tds >
|
template <class Gt, class Tds >
|
||||||
|
|
|
||||||
|
|
@ -188,6 +188,19 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class Triangulation_test_Compare_xy_2{
|
||||||
|
public:
|
||||||
|
typedef Triangulation_test_point Point;
|
||||||
|
CGAL::Comparison_result operator()( const Point& p, const Point& q) const
|
||||||
|
{
|
||||||
|
if (p.test_x() < q.test_x()) return CGAL::SMALLER;
|
||||||
|
if (p.test_x() > q.test_x()) return CGAL::LARGER;
|
||||||
|
if (p.test_y() < q.test_y()) return CGAL::SMALLER;
|
||||||
|
if (p.test_y() > q.test_y()) return CGAL::LARGER;
|
||||||
|
else return CGAL::EQUAL;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
class Triangulation_test_Orientation_2
|
class Triangulation_test_Orientation_2
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -416,6 +429,7 @@ public:
|
||||||
typedef Triangulation_test_Less_y_2 Less_y_2;
|
typedef Triangulation_test_Less_y_2 Less_y_2;
|
||||||
typedef Triangulation_test_Compare_x_2 Compare_x_2;
|
typedef Triangulation_test_Compare_x_2 Compare_x_2;
|
||||||
typedef Triangulation_test_Compare_y_2 Compare_y_2;
|
typedef Triangulation_test_Compare_y_2 Compare_y_2;
|
||||||
|
typedef Triangulation_test_Compare_xy_2 Compare_xy_2;
|
||||||
typedef Triangulation_test_Orientation_2 Orientation_2;
|
typedef Triangulation_test_Orientation_2 Orientation_2;
|
||||||
typedef Triangulation_test_Side_of_oriented_circle_2
|
typedef Triangulation_test_Side_of_oriented_circle_2
|
||||||
Side_of_oriented_circle_2;
|
Side_of_oriented_circle_2;
|
||||||
|
|
@ -450,6 +464,10 @@ public:
|
||||||
compare_y_2_object() const
|
compare_y_2_object() const
|
||||||
{ return Compare_y_2();}
|
{ return Compare_y_2();}
|
||||||
|
|
||||||
|
Compare_xy_2
|
||||||
|
compare_xy_2_object() const
|
||||||
|
{ return Compare_xy_2();}
|
||||||
|
|
||||||
Orientation_2
|
Orientation_2
|
||||||
orientation_2_object() const
|
orientation_2_object() const
|
||||||
{ return Orientation_2();}
|
{ return Orientation_2();}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue