mirror of https://github.com/CGAL/cgal
*** empty log message ***
This commit is contained in:
parent
55e6d3f3dc
commit
c7a89005fa
|
|
@ -1,3 +1,7 @@
|
|||
0.9.3 some kernel extensions were included
|
||||
(Do_intersect_to_right_2 and Do_intersect_to_left_2)
|
||||
changes in the predicate templates for VC
|
||||
|
||||
0.9.2 faster segment intersection
|
||||
small fixes
|
||||
most LEDA kernel functors are now templates
|
||||
|
|
|
|||
|
|
@ -0,0 +1,339 @@
|
|||
#ifndef CEP_LEDA_RAT_EXTENSION_PREDICATES_2_H
|
||||
#define CEP_LEDA_RAT_EXTENSION_PREDICATES_2_H
|
||||
|
||||
#include <CGAL/Origin.h>
|
||||
#include <CGAL/enum.h>
|
||||
#include <CGAL/Object.h>
|
||||
#include <CGAL/Quotient.h>
|
||||
#include <CGAL/functional_base.h>
|
||||
|
||||
#include <LEDA/rat_point.h>
|
||||
#include <LEDA/rat_segment.h>
|
||||
#include <LEDA/floatf.h>
|
||||
#include <cmath>
|
||||
|
||||
#if !defined(LEDA_NAMESPACE_NAME)
|
||||
#define LEDA_NAMESPACE_NAME
|
||||
#endif
|
||||
|
||||
// this file includes some special
|
||||
// predicates not present in the CGAL kernel
|
||||
// they are useful for instance for Planar_maps/Arrangements
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
template<class K>
|
||||
class Predicate_leda_rat_do_intersect_to_right_2 {
|
||||
|
||||
typedef typename K::Point_2 __My_Point_2;
|
||||
typedef typename K::Segment_2 __My_Segment_2;
|
||||
|
||||
public:
|
||||
|
||||
bool operator()(const __My_Segment_2& s1, const __My_Segment_2& s2,
|
||||
const __My_Point_2& p) const
|
||||
{
|
||||
if ( s1.is_trivial() ) { // s1 is a point ...
|
||||
// first compare the potential intersection point with p, this is cheaper ...
|
||||
return ( (__My_Point_2::cmp_xy(s1.start(), p) == 1) && s2.contains(s1.source()) );
|
||||
}
|
||||
if ( s2.is_trivial() ) { // s2 is a point ...
|
||||
// first compare the potential intersection point with p, this is cheaper ...
|
||||
return ( (__My_Point_2::cmp_xy(s2.start(), p) == 1) && s1.contains(s2.source()) );
|
||||
}
|
||||
|
||||
__My_Point_2 a = s1.source();
|
||||
__My_Point_2 b = s1.target();
|
||||
__My_Point_2 c = s2.source();
|
||||
__My_Point_2 d = s2.target();
|
||||
|
||||
// add check ?
|
||||
// is p in or left from the x_range of both segments s1, s2 ???
|
||||
|
||||
// do we have an intersection ?
|
||||
int o1 = s1.orientation(c);
|
||||
int o2 = s1.orientation(d);
|
||||
|
||||
if (o1 == o2 && o1 != 0) return false; // we have no intersection point ...
|
||||
|
||||
int o3 = s2.orientation(a);
|
||||
int o4 = s2.orientation(b);
|
||||
|
||||
if (o3 == o4 && o3 != 0) return false; // we have no intersection point ...
|
||||
|
||||
if ( o1 == 0 && o2 == 0 ) {
|
||||
bool b1 = s2.contains(a);
|
||||
if (b1) if (__My_Point_2::cmp_xy(a, p) == 1) return true;
|
||||
bool b2 = s2.contains(b);
|
||||
if (b2) if (__My_Point_2::cmp_xy(b, p) == 1) return true;
|
||||
bool b3 = s1.contains(c);
|
||||
if (b3) if (__My_Point_2::cmp_xy(c, p) == 1) return true;
|
||||
bool b4 = s1.contains(d);
|
||||
if (b4) if (__My_Point_2::cmp_xy(d, p) == 1) return true;
|
||||
}
|
||||
else {
|
||||
if (o1 != o2 && o3 != o4) { // segment intersection !!!
|
||||
|
||||
// double evaluation stage ...
|
||||
// first compute the expression Ed
|
||||
|
||||
double s1_dyD = s1.dyD();
|
||||
double s1_dxD = s1.dxD();
|
||||
double s2_dxD = s2.dxD();
|
||||
double s2_dyD = s2.dyD();
|
||||
double axd = a.XD();
|
||||
double bxd = b.XD();
|
||||
double cxd = c.XD();
|
||||
double dxd = d.XD();
|
||||
double ayd = a.YD();
|
||||
double byd = b.YD();
|
||||
double cyd = c.YD();
|
||||
double dyd = d.YD();
|
||||
|
||||
double pxd = p.XD();
|
||||
double pwd = p.WD();
|
||||
|
||||
// for index computation see LEDA book page 613 ff
|
||||
//
|
||||
// all indices of input values of the expression
|
||||
// get a start index 1 (this is a bit too pessimistic)
|
||||
// rules: ind(A +/- B) = 1+ max(ind(A),ind(B))*s
|
||||
// ind(A * B) = 1+ ind(A)*s + ind(B)*s^2
|
||||
// we don't have division and we have only "float integers" -> no underflow
|
||||
// with s = 1+machine_eps0
|
||||
//
|
||||
// ind(s1_dyD*s2_dxD) < 3.5
|
||||
// ind(s2_dyD*s1_dxD) < 3.5
|
||||
// ...
|
||||
// ind(c2d * s1_dxD) < 7.5
|
||||
// ind(c1d * s2_dxD) < 7.5
|
||||
// ind(xd) < 9
|
||||
//
|
||||
// ind(xd*pwd) < 12
|
||||
// ind(pxd*wd) < 9
|
||||
// -> ind(E) < 14
|
||||
|
||||
double wd = s1_dyD*s2_dxD - s2_dyD*s1_dxD; // ind < 5
|
||||
double c1d = bxd*ayd - axd*byd; // ind < 5
|
||||
double c2d = dxd*cyd - cxd*dyd; // ind < 5
|
||||
|
||||
double xd = c2d * s1_dxD - c1d * s2_dxD; // ind < 9
|
||||
|
||||
// toggle signs if w is negative ...
|
||||
if (wd < 0) { xd = -xd; wd = -wd; }
|
||||
|
||||
double Ed = xd*pwd - pxd*wd; // ind < 14
|
||||
|
||||
// we could add s static test (with upper bound for eps)
|
||||
// if (Ed > +eps_static) return true;
|
||||
// if (Ed < -eps_static) return false;
|
||||
|
||||
// fabs the values ...
|
||||
s1_dyD = std::fabs(s1_dyD); s1_dxD = std::fabs(s1_dxD);
|
||||
s2_dyD = std::fabs(s2_dyD); s2_dxD = std::fabs(s2_dxD);
|
||||
axd = std::fabs(axd); bxd = std::fabs(bxd);
|
||||
cxd = std::fabs(cxd); dxd = std::fabs(dxd);
|
||||
ayd = std::fabs(ayd); byd = std::fabs(byd);
|
||||
cyd = std::fabs(cyd); dyd = std::fabs(dyd);
|
||||
pxd = std::fabs(pxd); // pwd always positive ...
|
||||
|
||||
// compute mes; do this by "fabsing" the possibly negative
|
||||
// input values and by replacing - with +
|
||||
|
||||
double bwd = s1_dyD*s2_dxD + s2_dyD*s1_dxD;
|
||||
double bc1d = bxd*ayd + axd*byd;
|
||||
double bc2d = dxd*cyd + cxd*dyd;
|
||||
|
||||
double bound_xd = bc2d * s1_dxD + bc1d * s2_dxD;
|
||||
|
||||
// eps = ind*mes*eps0
|
||||
double eps = 14*(bound_xd*pwd + pxd*bwd)* LEDA_NAMESPACE_NAME::eps0;
|
||||
|
||||
// compare the result of the expression (Ed) with the error bound (eps)
|
||||
if (Ed > +eps) return true;
|
||||
if (Ed < -eps) return false;
|
||||
|
||||
// we could add double eval. of y-coords, but this will occur
|
||||
// not so often in typical applications, so we don't do it
|
||||
|
||||
// exact evaluation stage ...
|
||||
|
||||
bool toggle = false;
|
||||
|
||||
leda_integer w = s1.dy()*s2.dx() - s2.dy()*s1.dx();
|
||||
leda_integer c1 = b.X()*a.Y() - a.X()*b.Y();
|
||||
leda_integer c2 = d.X()*c.Y() - c.X()*d.Y();
|
||||
|
||||
leda_integer xi = c2* s1.dx() - c1* s2.dx();
|
||||
|
||||
if (w < 0) { w= -w; xi= -xi; toggle = true; }
|
||||
|
||||
// compare x - coord with point ...
|
||||
leda_integer Ei = xi*p.W() - p.X()*w;
|
||||
|
||||
if (Ei > 0) return true;
|
||||
if (Ei < 0) return false;
|
||||
|
||||
// Ei == 0; use y instead ...
|
||||
|
||||
leda_integer yi = c2* s1.dy() - c1* s2.dy();
|
||||
if (toggle) yi = -yi;
|
||||
|
||||
if (p.Y()*w < yi*p.W()) return true;
|
||||
|
||||
// lex. comparison returns false ...
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
template<class K>
|
||||
class Predicate_leda_rat_do_intersect_to_left_2 {
|
||||
|
||||
typedef typename K::Point_2 __My_Point_2;
|
||||
typedef typename K::Segment_2 __My_Segment_2;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
bool operator()(const __My_Segment_2& s1, const __My_Segment_2& s2,
|
||||
const __My_Point_2& p) const
|
||||
{
|
||||
if ( s1.is_trivial() ) { // s1 is a point ...
|
||||
// first compare the potential intersection point with p, this is cheaper ...
|
||||
return ( (__My_Point_2::cmp_xy(s1.start(), p) == -1) && s2.contains(s1.source()) );
|
||||
}
|
||||
if ( s2.is_trivial() ) { // s2 is a point ...
|
||||
// first compare the potential intersection point with p, this is cheaper ...
|
||||
return ( (__My_Point_2::cmp_xy(s2.start(), p) == -1) && s1.contains(s2.source()) );
|
||||
}
|
||||
|
||||
__My_Point_2 a = s1.source();
|
||||
__My_Point_2 b = s1.target();
|
||||
__My_Point_2 c = s2.source();
|
||||
__My_Point_2 d = s2.target();
|
||||
|
||||
// add check ?
|
||||
// is p in or left from the x_range of both segments s1, s2 ???
|
||||
// do we have an intersection ?
|
||||
|
||||
int o1 = s1.orientation(c);
|
||||
int o2 = s1.orientation(d);
|
||||
|
||||
if (o1 == o2 && o1 != 0) return false; // we have no intersection point ...
|
||||
|
||||
int o3 = s2.orientation(a);
|
||||
int o4 = s2.orientation(b);
|
||||
|
||||
if (o3 == o4 && o3 != 0) return false; // we have no intersection point ...
|
||||
|
||||
if ( o1 == 0 && o2 == 0 ) {
|
||||
bool b1 = s2.contains(a);
|
||||
if (b1) if (__My_Point_2::cmp_xy(a, p) == -1) return true;
|
||||
bool b2 = s2.contains(b);
|
||||
if (b2) if (__My_Point_2::cmp_xy(b, p) == -1) return true;
|
||||
bool b3 = s1.contains(c);
|
||||
if (b3) if (__My_Point_2::cmp_xy(c, p) == -1) return true;
|
||||
bool b4 = s1.contains(d);
|
||||
if (b4) if (__My_Point_2::cmp_xy(d, p) == -1) return true;
|
||||
}
|
||||
else {
|
||||
if (o1 != o2 && o3 != o4) { // segment intersection !!!
|
||||
|
||||
// double evaluation stage ...
|
||||
// first compute the expression Ed
|
||||
double s1_dyD = s1.dyD();
|
||||
double s1_dxD = s1.dxD();
|
||||
double s2_dxD = s2.dxD();
|
||||
double s2_dyD = s2.dyD();
|
||||
double axd = a.XD();
|
||||
double bxd = b.XD();
|
||||
double cxd = c.XD();
|
||||
double dxd = d.XD();
|
||||
double ayd = a.YD();
|
||||
double byd = b.YD();
|
||||
double cyd = c.YD();
|
||||
double dyd = d.YD();
|
||||
|
||||
double pxd = p.XD();
|
||||
double pwd = p.WD();
|
||||
|
||||
// for index computation see LEDA book page 613 ff
|
||||
// and do_intersect_to_right predicate
|
||||
// (there's a short explanation of the index computation)
|
||||
|
||||
double wd = s1_dyD*s2_dxD - s2_dyD*s1_dxD; // ind < 5
|
||||
double c1d = bxd*ayd - axd*byd; // ind < 5
|
||||
double c2d = dxd*cyd - cxd*dyd; // ind < 5
|
||||
|
||||
double xd = c2d * s1_dxD - c1d * s2_dxD; // ind < 9
|
||||
|
||||
// toggle signs if w is negative ...
|
||||
if (wd < 0) { xd = -xd; wd = -wd; }
|
||||
|
||||
double Ed = xd*pwd - pxd*wd; // ind < 14
|
||||
|
||||
// fabs the values ...
|
||||
s1_dyD = std::fabs(s1_dyD); s1_dxD = std::fabs(s1_dxD);
|
||||
s2_dyD = std::fabs(s2_dyD); s2_dxD = std::fabs(s2_dxD);
|
||||
axd = std::fabs(axd); bxd = std::fabs(bxd);
|
||||
cxd = std::fabs(cxd); dxd = std::fabs(dxd);
|
||||
ayd = std::fabs(ayd); byd = std::fabs(byd);
|
||||
cyd = std::fabs(cyd); dyd = std::fabs(dyd);
|
||||
pxd = std::fabs(pxd); // pwd always positive ...
|
||||
|
||||
double bwd = s1_dyD*s2_dxD + s2_dyD*s1_dxD;
|
||||
double bc1d = bxd*ayd + axd*byd;
|
||||
double bc2d = dxd*cyd + cxd*dyd;
|
||||
|
||||
double bound_xd = bc2d * s1_dxD + bc1d * s2_dxD;
|
||||
|
||||
// eps = ind*mes*eps0
|
||||
|
||||
double eps = 14*(bound_xd*pwd + pxd*bwd)* LEDA_NAMESPACE_NAME::eps0;
|
||||
|
||||
if (Ed > +eps) return false;
|
||||
if (Ed < -eps) return true;
|
||||
|
||||
// we could add double eval. of y-coords, but this will occur
|
||||
// not so often in typical applications, so we don't do it
|
||||
|
||||
// exact evaluation stage ...
|
||||
bool toggle = false;
|
||||
|
||||
leda_integer w = s1.dy()*s2.dx() - s2.dy()*s1.dx();
|
||||
leda_integer c1 = b.X()*a.Y() - a.X()*b.Y();
|
||||
leda_integer c2 = d.X()*c.Y() - c.X()*d.Y();
|
||||
|
||||
leda_integer xi = c2* s1.dx() - c1* s2.dx();
|
||||
|
||||
if (w < 0) { w= -w; xi= -xi; toggle = true; }
|
||||
|
||||
// compare x - coord with point ...
|
||||
leda_integer Ei = xi*p.W() - p.X()*w;
|
||||
|
||||
if (Ei > 0) return false;
|
||||
if (Ei < 0) return true;
|
||||
|
||||
// Ei == 0; use y instead ...
|
||||
|
||||
leda_integer yi = c2* s1.dy() - c1* s2.dy();
|
||||
if (toggle) yi = -yi;
|
||||
|
||||
if (p.Y()*w > yi*p.W()) return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
CGAL_END_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
|
@ -225,6 +225,7 @@ template<class K> CGAL::event Predicate_leda_rat_equal_2<K>::ev_leda_rat_rectan
|
|||
template<class K>
|
||||
class Predicate_leda_rat_less_xy_2 {
|
||||
typedef typename K::Point_2 Point_2;
|
||||
typedef typename K::Point_2 __My_Point_2;
|
||||
|
||||
public:
|
||||
typedef Arity_tag< 2 > Arity;
|
||||
|
|
@ -239,7 +240,7 @@ public:
|
|||
#if defined(CGAL_GEOMETRY_EVENTS)
|
||||
CGAL::occur<const Point_2&,const Point_2&>(Predicate_leda_rat_less_xy_2::ev_leda_rat_point, p1, p2);
|
||||
#endif
|
||||
return ( Point_2::cmp_xy(p1,p2) < 0 );
|
||||
return ( __My_Point_2::cmp_xy(p1,p2) < 0 );
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -253,6 +254,7 @@ template<class K>
|
|||
class Predicate_leda_rat_less_yx_2 {
|
||||
|
||||
typedef typename K::Point_2 Point_2;
|
||||
typedef typename K::Point_2 __My_Point_2;
|
||||
|
||||
public:
|
||||
typedef Arity_tag< 2 > Arity;
|
||||
|
|
@ -267,7 +269,7 @@ public:
|
|||
#if defined(CGAL_GEOMETRY_EVENTS)
|
||||
CGAL::occur<const Point_2&,const Point_2&>(Predicate_leda_rat_less_yx_2::ev_leda_rat_point, p1, p2);
|
||||
#endif
|
||||
return ( Point_2::cmp_yx(p1,p2) < 0 );
|
||||
return ( __My_Point_2::cmp_yx(p1,p2) < 0 );
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -280,6 +282,7 @@ template<class K> CGAL::event Predicate_leda_rat_less_yx_2<K>::ev_leda_rat_poin
|
|||
template<class K>
|
||||
class Predicate_leda_rat_equal_x_2 {
|
||||
typedef typename K::Point_2 Point_2;
|
||||
typedef typename K::Point_2 __My_Point_2;
|
||||
|
||||
public:
|
||||
typedef Arity_tag< 2 > Arity;
|
||||
|
|
@ -294,7 +297,7 @@ public:
|
|||
#if defined(CGAL_GEOMETRY_EVENTS)
|
||||
CGAL::occur<const Point_2&,const Point_2&>(Predicate_leda_rat_equal_x_2::ev_leda_rat_point, p1, p2);
|
||||
#endif
|
||||
return (Point_2::cmp_x(p1,p2) == 0);
|
||||
return (__My_Point_2::cmp_x(p1,p2) == 0);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -307,6 +310,7 @@ template<class K> CGAL::event Predicate_leda_rat_equal_x_2<K>::ev_leda_rat_poin
|
|||
template<class K>
|
||||
class Predicate_leda_rat_equal_y_2 {
|
||||
typedef typename K::Point_2 Point_2;
|
||||
typedef typename K::Point_2 __My_Point_2;
|
||||
|
||||
public:
|
||||
typedef Arity_tag< 2 > Arity;
|
||||
|
|
@ -321,7 +325,7 @@ public:
|
|||
#if defined(CGAL_GEOMETRY_EVENTS)
|
||||
CGAL::occur<const Point_2&,const Point_2&>(Predicate_leda_rat_equal_y_2::ev_leda_rat_point, p1, p2);
|
||||
#endif
|
||||
return (Point_2::cmp_y(p1,p2) == 0);
|
||||
return (__My_Point_2::cmp_y(p1,p2) == 0);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -334,6 +338,7 @@ template<class K> CGAL::event Predicate_leda_rat_equal_y_2<K>::ev_leda_rat_poin
|
|||
template<class K>
|
||||
class Predicate_leda_rat_equal_xy_2 {
|
||||
typedef typename K::Point_2 Point_2;
|
||||
typedef typename K::Point_2 __My_Point_2;
|
||||
|
||||
public:
|
||||
typedef Arity_tag< 2 > Arity;
|
||||
|
|
@ -348,7 +353,7 @@ public:
|
|||
#if defined(CGAL_GEOMETRY_EVENTS)
|
||||
CGAL::occur<const Point_2&,const Point_2&>(Predicate_leda_rat_equal_xy_2::ev_leda_rat_point, p1, p2);
|
||||
#endif
|
||||
return (Point_2::cmp_xy(p1,p2) == 0);
|
||||
return (__My_Point_2::cmp_xy(p1,p2) == 0);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -362,6 +367,7 @@ template<class K>
|
|||
class Predicate_leda_rat_less_x_2 {
|
||||
|
||||
typedef typename K::Point_2 Point_2;
|
||||
typedef typename K::Point_2 __My_Point_2;
|
||||
|
||||
public:
|
||||
typedef Arity_tag< 2 > Arity;
|
||||
|
|
@ -377,7 +383,7 @@ public:
|
|||
CGAL::occur<const Point_2&,const Point_2&>(Predicate_leda_rat_less_x_2::ev_leda_rat_point, p1, p2);
|
||||
#endif
|
||||
if (LEDA_NAMESPACE_NAME::identical(p1,p2)) return false;
|
||||
return (Point_2::cmp_x(p1,p2) < 0);
|
||||
return (__My_Point_2::cmp_x(p1,p2) < 0);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -391,6 +397,7 @@ template<class K>
|
|||
class Predicate_leda_rat_less_y_2 {
|
||||
|
||||
typedef typename K::Point_2 Point_2;
|
||||
typedef typename K::Point_2 __My_Point_2;
|
||||
|
||||
public:
|
||||
typedef Arity_tag< 2 > Arity;
|
||||
|
|
@ -406,7 +413,7 @@ public:
|
|||
CGAL::occur<const Point_2&,const Point_2&>(Predicate_leda_rat_less_y_2::ev_leda_rat_point, p1, p2);
|
||||
#endif
|
||||
if (LEDA_NAMESPACE_NAME::identical(p1,p2)) return false;
|
||||
return (Point_2::cmp_y(p1,p2) < 0);
|
||||
return (__My_Point_2::cmp_y(p1,p2) < 0);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -421,6 +428,8 @@ class Predicate_leda_rat_compare_x_2 {
|
|||
|
||||
typedef typename K::Point_2 Point_2;
|
||||
typedef typename K::Line_2 Line_2;
|
||||
|
||||
typedef typename K::Point_2 __My_Point_2;
|
||||
|
||||
public:
|
||||
|
||||
|
|
@ -440,7 +449,7 @@ public:
|
|||
CGAL::occur<const Point_2&,const Point_2&>(Predicate_leda_rat_compare_x_2::ev_leda_rat_point, p1, p2);
|
||||
#endif
|
||||
if (LEDA_NAMESPACE_NAME::identical(p1,p2)) return EQUAL;
|
||||
return ( (Comparison_result) Point_2::cmp_x(p1,p2));
|
||||
return ( (Comparison_result) __My_Point_2::cmp_x(p1,p2));
|
||||
}
|
||||
|
||||
Comparison_result operator()(const Point_2& p, const Line_2& l1, const Line_2& l2) const
|
||||
|
|
@ -453,7 +462,7 @@ public:
|
|||
|
||||
l1.intersection(l2,inter);
|
||||
|
||||
return ( (Comparison_result) Point_2::cmp_x(p,inter));
|
||||
return ( (Comparison_result) __My_Point_2::cmp_x(p,inter));
|
||||
}
|
||||
|
||||
Comparison_result operator()(const Line_2& l1, const Line_2& l2, const Line_2& l3) const
|
||||
|
|
@ -468,7 +477,7 @@ public:
|
|||
l1.intersection(l2, p1);
|
||||
l1.intersection(l3, p2);
|
||||
|
||||
return ( (Comparison_result) Point_2::cmp_x(p1,p2));
|
||||
return ( (Comparison_result) __My_Point_2::cmp_x(p1,p2));
|
||||
}
|
||||
|
||||
Comparison_result operator()(const Line_2& l1, const Line_2& l2,
|
||||
|
|
@ -484,7 +493,7 @@ public:
|
|||
l1.intersection(l2, p1);
|
||||
l3.intersection(l4, p2);
|
||||
|
||||
return ( (Comparison_result) Point_2::cmp_x(p1,p2));
|
||||
return ( (Comparison_result) __My_Point_2::cmp_x(p1,p2));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -503,6 +512,8 @@ class Predicate_leda_rat_compare_x_at_y_2 {
|
|||
typedef typename K::Point_2 Point_2;
|
||||
typedef typename K::Line_2 Line_2;
|
||||
typedef typename K::Segment_2 Segment_2;
|
||||
|
||||
typedef typename K::Point_2 __My_Point_2;
|
||||
|
||||
public:
|
||||
typedef Comparison_result result_type;
|
||||
|
|
@ -525,7 +536,7 @@ public:
|
|||
int ori = - l.side_of(p);
|
||||
|
||||
// has point1 larger y - coord than point2 ????
|
||||
if (Point_2::cmp_y(l.point1(),l.point2()) == 1) ori = -ori;
|
||||
if (__My_Point_2::cmp_y(l.point1(),l.point2()) == 1) ori = -ori;
|
||||
return ((Comparison_result) ori);
|
||||
}
|
||||
|
||||
|
|
@ -564,7 +575,7 @@ public:
|
|||
int ori = - h.side_of(inter);
|
||||
|
||||
// has point1 larger y - coord than point2 ????
|
||||
if (Point_2::cmp_y(h.point1(),h.point2()) == 1) ori = -ori;
|
||||
if (__My_Point_2::cmp_y(h.point1(),h.point2()) == 1) ori = -ori;
|
||||
return ((Comparison_result) ori);
|
||||
}
|
||||
|
||||
|
|
@ -609,6 +620,8 @@ class Predicate_leda_rat_compare_y_2 {
|
|||
|
||||
typedef typename K::Point_2 Point_2;
|
||||
typedef typename K::Line_2 Line_2;
|
||||
|
||||
typedef typename K::Point_2 __My_Point_2;
|
||||
|
||||
public:
|
||||
typedef Comparison_result result_type;
|
||||
|
|
@ -627,7 +640,7 @@ public:
|
|||
CGAL::occur<const Point_2&,const Point_2&>(Predicate_leda_rat_compare_y_2::ev_leda_rat_point, p1, p2);
|
||||
#endif
|
||||
if (LEDA_NAMESPACE_NAME::identical(p1,p2)) return EQUAL;
|
||||
return ( (Comparison_result) Point_2::cmp_y(p1,p2));
|
||||
return ( (Comparison_result) __My_Point_2::cmp_y(p1,p2));
|
||||
}
|
||||
|
||||
Comparison_result operator()(const Point_2& p, const Line_2& l1, const Line_2& l2) const
|
||||
|
|
@ -640,7 +653,7 @@ public:
|
|||
|
||||
l1.intersection(l2,inter);
|
||||
|
||||
return ( (Comparison_result) Point_2::cmp_y(p,inter));
|
||||
return ( (Comparison_result) __My_Point_2::cmp_y(p,inter));
|
||||
}
|
||||
|
||||
Comparison_result operator()(const Line_2& l1, const Line_2& l2, const Line_2& l3) const
|
||||
|
|
@ -656,7 +669,7 @@ public:
|
|||
l1.intersection(l2, p1);
|
||||
l1.intersection(l3, p2);
|
||||
|
||||
return ( (Comparison_result) Point_2::cmp_y(p1,p2));
|
||||
return ( (Comparison_result) __My_Point_2::cmp_y(p1,p2));
|
||||
}
|
||||
|
||||
Comparison_result operator()(const Line_2& l1, const Line_2& l2,
|
||||
|
|
@ -673,7 +686,7 @@ public:
|
|||
l1.intersection(l2, p1);
|
||||
l3.intersection(l4, p2);
|
||||
|
||||
return ( (Comparison_result) Point_2::cmp_y(p1,p2));
|
||||
return ( (Comparison_result) __My_Point_2::cmp_y(p1,p2));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -690,6 +703,8 @@ template<class K>
|
|||
class Predicate_leda_rat_compare_xy_2 {
|
||||
|
||||
typedef typename K::Point_2 Point_2;
|
||||
|
||||
typedef typename K::Point_2 __My_Point_2;
|
||||
|
||||
public:
|
||||
typedef Arity_tag< 2 > Arity;
|
||||
|
|
@ -705,7 +720,7 @@ public:
|
|||
CGAL::occur<const Point_2&,const Point_2&>(Predicate_leda_rat_compare_xy_2::ev_leda_rat_point, p1, p2);
|
||||
#endif
|
||||
if (LEDA_NAMESPACE_NAME::identical(p1,p2)) return EQUAL;
|
||||
return ( (Comparison_result) Point_2::cmp_xy(p1,p2));
|
||||
return ( (Comparison_result) __My_Point_2::cmp_xy(p1,p2));
|
||||
}
|
||||
|
||||
};
|
||||
|
|
@ -722,6 +737,8 @@ class Predicate_leda_rat_compare_y_at_x_2 {
|
|||
typedef typename K::Point_2 Point_2;
|
||||
typedef typename K::Segment_2 Segment_2;
|
||||
typedef typename K::Line_2 Line_2;
|
||||
|
||||
typedef typename K::Point_2 __My_Point_2;
|
||||
|
||||
public:
|
||||
typedef Comparison_result result_type;
|
||||
|
|
@ -742,15 +759,15 @@ public:
|
|||
bool curve_is_in_x_range(const Segment_2 & cv, const Point_2 & p) const
|
||||
{
|
||||
return
|
||||
!(((Point_2::cmp_x(p, cv.source()) < 0) && (Point_2::cmp_x(p, cv.target()) < 0)) ||
|
||||
((Point_2::cmp_x(p, cv.source()) > 0) && (Point_2::cmp_x(p, cv.target()) > 0)));
|
||||
!(((__My_Point_2::cmp_x(p, cv.source()) < 0) && (__My_Point_2::cmp_x(p, cv.target()) < 0)) ||
|
||||
((__My_Point_2::cmp_x(p, cv.source()) > 0) && (__My_Point_2::cmp_x(p, cv.target()) > 0)));
|
||||
}
|
||||
|
||||
bool curve_is_in_y_range(const Segment_2 & cv, const Point_2 & p) const
|
||||
{
|
||||
return
|
||||
!(((Point_2::cmp_y(p, cv.source()) < 0) && (Point_2::cmp_y(p, cv.target()) < 0)) ||
|
||||
((Point_2::cmp_y(p, cv.source()) > 0) && (Point_2::cmp_y(p, cv.target()) > 0)));
|
||||
!(((__My_Point_2::cmp_y(p, cv.source()) < 0) && (__My_Point_2::cmp_y(p, cv.target()) < 0)) ||
|
||||
((__My_Point_2::cmp_y(p, cv.source()) > 0) && (__My_Point_2::cmp_y(p, cv.target()) > 0)));
|
||||
}
|
||||
|
||||
Comparison_result operator()(const Point_2 & q,
|
||||
|
|
@ -766,9 +783,9 @@ public:
|
|||
|
||||
Segment_2 cv1_ = cv1;
|
||||
Segment_2 cv2_ = cv2;
|
||||
if (Point_2::cmp_xy(cv1.source(), cv1.target()) > 0)
|
||||
if (__My_Point_2::cmp_xy(cv1.source(), cv1.target()) > 0)
|
||||
cv1_ = cv1.reversal();
|
||||
if (Point_2::cmp_xy(cv2.source(), cv2.target()) > 0)
|
||||
if (__My_Point_2::cmp_xy(cv2.source(), cv2.target()) > 0)
|
||||
cv2_ = cv2.reversal();
|
||||
|
||||
// vertical curves ...
|
||||
|
|
@ -776,7 +793,7 @@ public:
|
|||
if (cv1_.is_vertical()) {
|
||||
if (cv2_.is_vertical()) {
|
||||
// both cv1 and cv2 are vertical
|
||||
int res = Point_2::cmp_y(cv1_.target(), cv2_.source());
|
||||
int res = __My_Point_2::cmp_y(cv1_.target(), cv2_.source());
|
||||
return ((res < 0) ? CGAL::SMALLER : ((res > 0) ? CGAL::LARGER : CGAL::EQUAL));
|
||||
}
|
||||
|
||||
|
|
@ -816,14 +833,14 @@ public:
|
|||
|
||||
// this handles trivial segments as well ...
|
||||
if (s.is_vertical()) {
|
||||
if ((Point_2::cmp_y(p, s.source()) < 0) && (Point_2::cmp_y(p, s.target()) < 0)) return CGAL::SMALLER;
|
||||
if ((Point_2::cmp_y(p, s.source()) > 0) && (Point_2::cmp_y(p, s.target()) > 0)) return CGAL::LARGER;
|
||||
if ((__My_Point_2::cmp_y(p, s.source()) < 0) && (__My_Point_2::cmp_y(p, s.target()) < 0)) return CGAL::SMALLER;
|
||||
if ((__My_Point_2::cmp_y(p, s.source()) > 0) && (__My_Point_2::cmp_y(p, s.target()) > 0)) return CGAL::LARGER;
|
||||
return CGAL::EQUAL;
|
||||
}
|
||||
|
||||
int ori = 0;
|
||||
|
||||
if (Point_2::cmp_x(s.source(), s.target()) < 0){
|
||||
if (__My_Point_2::cmp_x(s.source(), s.target()) < 0){
|
||||
ori = LEDA_NAMESPACE_NAME::orientation(s.source(), s.target(), p);
|
||||
}
|
||||
else ori = LEDA_NAMESPACE_NAME::orientation(s.target(), s.source(), p);
|
||||
|
|
@ -848,7 +865,7 @@ public:
|
|||
int ori = l.side_of(p);
|
||||
|
||||
// has point1 larger x - coord than point2 ????
|
||||
if (Point_2::cmp_x(l.point1(),l.point2()) == 1) ori = -ori;
|
||||
if (__My_Point_2::cmp_x(l.point1(),l.point2()) == 1) ori = -ori;
|
||||
return ((Comparison_result) ori);
|
||||
}
|
||||
|
||||
|
|
@ -880,7 +897,7 @@ public:
|
|||
int ori = l3.side_of(p);
|
||||
|
||||
// has point1 larger x - coord than point2 ????
|
||||
if (Point_2::cmp_x(l3.point1(),l3.point2()) == 1) ori = -ori;
|
||||
if (__My_Point_2::cmp_x(l3.point1(),l3.point2()) == 1) ori = -ori;
|
||||
return ((Comparison_result) ori);
|
||||
}
|
||||
|
||||
|
|
@ -1027,6 +1044,8 @@ template<class K>
|
|||
class Predicate_leda_rat_less_distance_to_point_2 {
|
||||
|
||||
typedef typename K::Point_2 Point_2;
|
||||
|
||||
typedef typename K::Point_2 __My_Point_2;
|
||||
|
||||
public:
|
||||
typedef Arity_tag< 3 > Arity;
|
||||
|
|
@ -1349,6 +1368,8 @@ class Predicate_leda_rat_is_in_x_range_2 {
|
|||
|
||||
typedef typename K::Point_2 Point_2;
|
||||
typedef typename K::Segment_2 Segment_2;
|
||||
|
||||
typedef typename K::Point_2 __My_Point_2;
|
||||
|
||||
public:
|
||||
typedef Arity_tag< 2 > Arity;
|
||||
|
|
@ -1365,9 +1386,9 @@ public:
|
|||
(Predicate_leda_rat_is_in_x_range_2::ev_leda_rat_point_segment, p, s);
|
||||
#endif
|
||||
// two compare operations ...
|
||||
int res1 = Point_2::cmp_x(s.start(), p);
|
||||
int res1 = __My_Point_2::cmp_x(s.start(), p);
|
||||
if (res1 == 0) return true;
|
||||
int res2 = Point_2::cmp_x(s.end(), p);
|
||||
int res2 = __My_Point_2::cmp_x(s.end(), p);
|
||||
if (res2 == 0 || res1 != res2) return true;
|
||||
|
||||
return false;
|
||||
|
|
@ -2341,8 +2362,10 @@ class Predicate_leda_rat_do_intersect_2 {
|
|||
typedef typename K::Line_2 Line_2;
|
||||
typedef typename K::Ray_2 Ray_2;
|
||||
typedef typename K::Triangle_2 Triangle_2;
|
||||
typedef typename K::Iso_rectangle_2 Iso_rectangle_2;
|
||||
|
||||
typedef typename K::Iso_rectangle_2 Iso_rectangle_2;
|
||||
|
||||
typedef typename K::Point_2 __My_Point_2;
|
||||
|
||||
public:
|
||||
typedef Arity_tag< 2 > Arity;
|
||||
typedef bool result_type;
|
||||
|
|
@ -2350,7 +2373,7 @@ public:
|
|||
// points ...
|
||||
|
||||
bool operator()(const Point_2& p, const Point_2& p2) const
|
||||
{ return (Point_2::cmp_xy(p,p2)==0); }
|
||||
{ return (__My_Point_2::cmp_xy(p,p2)==0); }
|
||||
|
||||
bool operator()(const Point_2& p, const Line_2& l) const
|
||||
{ return l.contains(p); }
|
||||
|
|
|
|||
|
|
@ -194,6 +194,7 @@ template<class K>
|
|||
class Predicate_leda_d3_rat_equal_x {
|
||||
|
||||
typedef typename K::Point_3 Point_3;
|
||||
typedef typename K::Point_3 __My_Point_3;
|
||||
|
||||
public:
|
||||
typedef Arity_tag< 2 > Arity;
|
||||
|
|
@ -202,7 +203,7 @@ public:
|
|||
bool operator()(const Point_3& p1, const Point_3& p2) const
|
||||
{
|
||||
if (LEDA_NAMESPACE_NAME::identical(p1,p2)) return true;
|
||||
if (Point_3::cmp_x(p1,p2) == 0) return true;
|
||||
if (__My_Point_3::cmp_x(p1,p2) == 0) return true;
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
|
@ -211,6 +212,7 @@ template<class K>
|
|||
class Predicate_leda_d3_rat_equal_y {
|
||||
|
||||
typedef typename K::Point_3 Point_3;
|
||||
typedef typename K::Point_3 __My_Point_3;
|
||||
|
||||
public:
|
||||
typedef Arity_tag< 2 > Arity;
|
||||
|
|
@ -219,7 +221,7 @@ public:
|
|||
bool operator()(const Point_3& p1, const Point_3& p2) const
|
||||
{
|
||||
if (LEDA_NAMESPACE_NAME::identical(p1,p2)) return true;
|
||||
if (Point_3::cmp_y(p1,p2) == 0) return true;
|
||||
if (__My_Point_3::cmp_y(p1,p2) == 0) return true;
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
|
@ -228,6 +230,7 @@ template<class K>
|
|||
class Predicate_leda_d3_rat_equal_z {
|
||||
|
||||
typedef typename K::Point_3 Point_3;
|
||||
typedef typename K::Point_3 __My_Point_3;
|
||||
|
||||
public:
|
||||
typedef Arity_tag< 2 > Arity;
|
||||
|
|
@ -236,7 +239,7 @@ public:
|
|||
bool operator()(const Point_3& p1, const Point_3& p2) const
|
||||
{
|
||||
if (LEDA_NAMESPACE_NAME::identical(p1,p2)) return true;
|
||||
if (Point_3::cmp_z(p1,p2) == 0) return true;
|
||||
if (__My_Point_3::cmp_z(p1,p2) == 0) return true;
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
|
@ -245,6 +248,7 @@ template<class K>
|
|||
class Predicate_leda_d3_rat_equal_xy {
|
||||
|
||||
typedef typename K::Point_3 Point_3;
|
||||
typedef typename K::Point_3 __My_Point_3;
|
||||
|
||||
public:
|
||||
typedef Arity_tag< 2 > Arity;
|
||||
|
|
@ -253,7 +257,7 @@ public:
|
|||
bool operator()(const Point_3& p1, const Point_3& p2) const
|
||||
{
|
||||
if (LEDA_NAMESPACE_NAME::identical(p1,p2)) return true;
|
||||
if (Point_3::cmp_x(p1,p2) == 0 && Point_3::cmp_y(p1,p2) == 0) return true;
|
||||
if (__My_Point_3::cmp_x(p1,p2) == 0 && __My_Point_3::cmp_y(p1,p2) == 0) return true;
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
|
@ -262,6 +266,7 @@ template<class K>
|
|||
class Predicate_leda_d3_rat_equal_xyz {
|
||||
|
||||
typedef typename K::Point_3 Point_3;
|
||||
typedef typename K::Point_3 __My_Point_3;
|
||||
|
||||
public:
|
||||
typedef Arity_tag< 2 > Arity;
|
||||
|
|
@ -270,7 +275,7 @@ public:
|
|||
bool operator()(const Point_3& p1, const Point_3& p2) const
|
||||
{
|
||||
if (LEDA_NAMESPACE_NAME::identical(p1,p2)) return true;
|
||||
if (Point_3::cmp_xyz(p1,p2) == 0) return true;
|
||||
if (__My_Point_3::cmp_xyz(p1,p2) == 0) return true;
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
|
@ -279,6 +284,7 @@ template<class K>
|
|||
class Predicate_leda_d3_rat_less_x {
|
||||
|
||||
typedef typename K::Point_3 Point_3;
|
||||
typedef typename K::Point_3 __My_Point_3;
|
||||
|
||||
public:
|
||||
typedef Arity_tag< 2 > Arity;
|
||||
|
|
@ -286,7 +292,7 @@ public:
|
|||
|
||||
bool operator()(const Point_3& p1, const Point_3& p2) const
|
||||
{
|
||||
if (Point_3::cmp_x(p1,p2) == -1) return true;
|
||||
if (__My_Point_3::cmp_x(p1,p2) == -1) return true;
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
|
@ -295,6 +301,7 @@ template<class K>
|
|||
class Predicate_leda_d3_rat_less_y {
|
||||
|
||||
typedef typename K::Point_3 Point_3;
|
||||
typedef typename K::Point_3 __My_Point_3;
|
||||
|
||||
public:
|
||||
typedef Arity_tag< 2 > Arity;
|
||||
|
|
@ -302,7 +309,7 @@ public:
|
|||
|
||||
bool operator()(const Point_3& p1, const Point_3& p2) const
|
||||
{
|
||||
if (Point_3::cmp_y(p1,p2) == -1) return true;
|
||||
if (__My_Point_3::cmp_y(p1,p2) == -1) return true;
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
|
@ -311,6 +318,7 @@ template<class K>
|
|||
class Predicate_leda_d3_rat_less_z {
|
||||
|
||||
typedef typename K::Point_3 Point_3;
|
||||
typedef typename K::Point_3 __My_Point_3;
|
||||
|
||||
public:
|
||||
typedef Arity_tag< 2 > Arity;
|
||||
|
|
@ -318,7 +326,7 @@ public:
|
|||
|
||||
bool operator()(const Point_3& p1, const Point_3& p2) const
|
||||
{
|
||||
if (Point_3::cmp_z(p1,p2) == -1) return true;
|
||||
if (__My_Point_3::cmp_z(p1,p2) == -1) return true;
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
|
@ -327,6 +335,7 @@ template<class K>
|
|||
class Predicate_leda_d3_rat_less_xy {
|
||||
|
||||
typedef typename K::Point_3 Point_3;
|
||||
typedef typename K::Point_3 __My_Point_3;
|
||||
|
||||
public:
|
||||
typedef Arity_tag< 2 > Arity;
|
||||
|
|
@ -334,11 +343,11 @@ public:
|
|||
|
||||
bool operator()(const Point_3& p1, const Point_3& p2) const
|
||||
{
|
||||
int cmx = Point_3::cmp_x(p1,p2);
|
||||
int cmx = __My_Point_3::cmp_x(p1,p2);
|
||||
|
||||
if (cmx == -1) return true;
|
||||
else {
|
||||
if (cmx==0 && Point_3::cmp_y(p1,p2) == -1) return true;
|
||||
if (cmx==0 && __My_Point_3::cmp_y(p1,p2) == -1) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -348,6 +357,7 @@ template<class K>
|
|||
class Predicate_leda_d3_rat_less_xyz {
|
||||
|
||||
typedef typename K::Point_3 Point_3;
|
||||
typedef typename K::Point_3 __My_Point_3;
|
||||
|
||||
public:
|
||||
typedef Arity_tag< 2 > Arity;
|
||||
|
|
@ -355,7 +365,7 @@ public:
|
|||
|
||||
bool operator()(const Point_3& p1, const Point_3& p2) const
|
||||
{
|
||||
if (Point_3::cmp_xyz(p1,p2) == -1) return true;
|
||||
if (__My_Point_3::cmp_xyz(p1,p2) == -1) return true;
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
|
@ -364,6 +374,7 @@ template<class K>
|
|||
class Predicate_leda_d3_rat_compare_x {
|
||||
|
||||
typedef typename K::Point_3 Point_3;
|
||||
typedef typename K::Point_3 __My_Point_3;
|
||||
|
||||
public:
|
||||
typedef Arity_tag< 2 > Arity;
|
||||
|
|
@ -371,7 +382,7 @@ public:
|
|||
|
||||
Comparison_result operator()(const Point_3& p1, const Point_3& p2) const
|
||||
{
|
||||
return ( (Comparison_result) Point_3::cmp_x(p1,p2));
|
||||
return ( (Comparison_result) __My_Point_3::cmp_x(p1,p2));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -379,6 +390,7 @@ template<class K>
|
|||
class Predicate_leda_d3_rat_compare_y {
|
||||
|
||||
typedef typename K::Point_3 Point_3;
|
||||
typedef typename K::Point_3 __My_Point_3;
|
||||
|
||||
public:
|
||||
typedef Arity_tag< 2 > Arity;
|
||||
|
|
@ -386,7 +398,7 @@ public:
|
|||
|
||||
Comparison_result operator()(const Point_3& p1, const Point_3& p2) const
|
||||
{
|
||||
return ( (Comparison_result) Point_3::cmp_y(p1,p2));
|
||||
return ( (Comparison_result) __My_Point_3::cmp_y(p1,p2));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -394,6 +406,7 @@ template<class K>
|
|||
class Predicate_leda_d3_rat_compare_z {
|
||||
|
||||
typedef typename K::Point_3 Point_3;
|
||||
typedef typename K::Point_3 __My_Point_3;
|
||||
|
||||
public:
|
||||
typedef Arity_tag< 2 > Arity;
|
||||
|
|
@ -401,7 +414,7 @@ public:
|
|||
|
||||
Comparison_result operator()(const Point_3& p1, const Point_3& p2) const
|
||||
{
|
||||
return ( (Comparison_result) Point_3::cmp_z(p1,p2));
|
||||
return ( (Comparison_result) __My_Point_3::cmp_z(p1,p2));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -409,6 +422,7 @@ template<class K>
|
|||
class Predicate_leda_d3_rat_compare_xy {
|
||||
|
||||
typedef typename K::Point_3 Point_3;
|
||||
typedef typename K::Point_3 __My_Point_3;
|
||||
|
||||
public:
|
||||
typedef Arity_tag< 2 > Arity;
|
||||
|
|
@ -416,9 +430,9 @@ public:
|
|||
|
||||
Comparison_result operator()(const Point_3& p1, const Point_3& p2) const
|
||||
{
|
||||
int cmx = Point_3::cmp_x(p1,p2);
|
||||
int cmx = __My_Point_3::cmp_x(p1,p2);
|
||||
if (cmx != 0) return ((Comparison_result) cmx);
|
||||
int cmy = Point_3::cmp_y(p1,p2);
|
||||
int cmy = __My_Point_3::cmp_y(p1,p2);
|
||||
|
||||
return ( (Comparison_result) cmy);
|
||||
}
|
||||
|
|
@ -428,6 +442,7 @@ template<class K>
|
|||
class Predicate_leda_d3_rat_compare_xyz {
|
||||
|
||||
typedef typename K::Point_3 Point_3;
|
||||
typedef typename K::Point_3 __My_Point_3;
|
||||
|
||||
public:
|
||||
typedef Arity_tag< 2 > Arity;
|
||||
|
|
@ -435,7 +450,7 @@ public:
|
|||
|
||||
Comparison_result operator()(const Point_3& p1, const Point_3& p2) const
|
||||
{
|
||||
return ( (Comparison_result) Point_3::cmp_xyz(p1,p2));
|
||||
return ( (Comparison_result) __My_Point_3::cmp_xyz(p1,p2));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -554,6 +569,7 @@ template<class K>
|
|||
class Predicate_leda_d3_rat_coplanar_orientation {
|
||||
|
||||
typedef typename K::Point_3 Point_3;
|
||||
typedef typename K::Point_3 __My_Point_3;
|
||||
|
||||
public:
|
||||
typedef Orientation result_type;
|
||||
|
|
@ -591,7 +607,7 @@ public:
|
|||
|
||||
// we have to project onto another plane :
|
||||
|
||||
if ((Point_3::cmp_x(p1,p2) != 0) || (Point_3::cmp_x(p1,p3) != 0))
|
||||
if ((__My_Point_3::cmp_x(p1,p2) != 0) || (__My_Point_3::cmp_x(p1,p3) != 0))
|
||||
{
|
||||
// projection into (x,z)-plane is ok
|
||||
return Orientation ( LEDA_NAMESPACE_NAME::orientation_xz(p1,p2,p3) *
|
||||
|
|
@ -861,6 +877,8 @@ class Predicate_leda_d3_rat_has_on_bounded_side {
|
|||
typedef typename K::Iso_cuboid_3 Iso_cuboid_3;
|
||||
typedef typename K::FT FT;
|
||||
|
||||
typedef typename K::Point_3 __My_Point_3;
|
||||
|
||||
public:
|
||||
typedef Arity_tag< 2 > Arity;
|
||||
typedef bool result_type;
|
||||
|
|
@ -908,9 +926,9 @@ public:
|
|||
Point_3 max = ic.vertex(7);
|
||||
|
||||
// compare with x/y/z coordinates ...
|
||||
if (Point_3::cmp_x(p,min) != 1 || Point_3::cmp_x(p,max) != -1) return false;
|
||||
if (Point_3::cmp_y(p,min) != 1 || Point_3::cmp_y(p,max) != -1) return false;
|
||||
if (Point_3::cmp_z(p,min) != 1 || Point_3::cmp_z(p,max) != -1) return false;
|
||||
if (__My_Point_3::cmp_x(p,min) != 1 || __My_Point_3::cmp_x(p,max) != -1) return false;
|
||||
if (__My_Point_3::cmp_y(p,min) != 1 || __My_Point_3::cmp_y(p,max) != -1) return false;
|
||||
if (__My_Point_3::cmp_z(p,min) != 1 || __My_Point_3::cmp_z(p,max) != -1) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -923,6 +941,8 @@ class Predicate_leda_d3_rat_has_on_unbounded_side {
|
|||
typedef typename K::Tetrahedron_3 Tetrahedron_3;
|
||||
typedef typename K::Iso_cuboid_3 Iso_cuboid_3;
|
||||
typedef typename K::FT FT;
|
||||
|
||||
typedef typename K::Point_3 __My_Point_3;
|
||||
|
||||
public:
|
||||
typedef Arity_tag< 2 > Arity;
|
||||
|
|
@ -969,9 +989,9 @@ public:
|
|||
Point_3 max = ic.vertex(7);
|
||||
|
||||
// compare with x/y/z coordinates ...
|
||||
if (Point_3::cmp_x(p,min) != 1 || Point_3::cmp_x(p,max) != -1) return true;
|
||||
if (Point_3::cmp_y(p,min) != 1 || Point_3::cmp_y(p,max) != -1) return true;
|
||||
if (Point_3::cmp_z(p,min) != 1 || Point_3::cmp_z(p,max) != -1) return true;
|
||||
if (__My_Point_3::cmp_x(p,min) != 1 || __My_Point_3::cmp_x(p,max) != -1) return true;
|
||||
if (__My_Point_3::cmp_y(p,min) != 1 || __My_Point_3::cmp_y(p,max) != -1) return true;
|
||||
if (__My_Point_3::cmp_z(p,min) != 1 || __My_Point_3::cmp_z(p,max) != -1) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
@ -985,6 +1005,8 @@ class Predicate_leda_d3_rat_has_on_boundary {
|
|||
typedef typename K::Tetrahedron_3 Tetrahedron_3;
|
||||
typedef typename K::Iso_cuboid_3 Iso_cuboid_3;
|
||||
typedef typename K::FT FT;
|
||||
|
||||
typedef typename K::Point_3 __My_Point_3;
|
||||
|
||||
public:
|
||||
typedef Arity_tag< 2 > Arity;
|
||||
|
|
@ -1039,18 +1061,18 @@ public:
|
|||
|
||||
// compare with x/y/z coordinates ...
|
||||
// we need at least one zero in the cmp results;
|
||||
int res1 = Point_3::cmp_x(p,min);
|
||||
int res2 = Point_3::cmp_x(p,max);
|
||||
int res1 = __My_Point_3::cmp_x(p,min);
|
||||
int res2 = __My_Point_3::cmp_x(p,max);
|
||||
|
||||
if (res1 == -1 || res2 == 1) return false;
|
||||
|
||||
int res3 = Point_3::cmp_y(p,min);
|
||||
int res4 = Point_3::cmp_y(p,max);
|
||||
int res3 = __My_Point_3::cmp_y(p,min);
|
||||
int res4 = __My_Point_3::cmp_y(p,max);
|
||||
|
||||
if (res3 == -1 || res4 == 1) return false;
|
||||
|
||||
int res5 = Point_3::cmp_z(p,min);
|
||||
int res6 = Point_3::cmp_z(p,max);
|
||||
int res5 = __My_Point_3::cmp_z(p,min);
|
||||
int res6 = __My_Point_3::cmp_z(p,max);
|
||||
|
||||
if (res5 == -1 || res6 == 1) return false;
|
||||
|
||||
|
|
@ -1267,6 +1289,8 @@ class Predicate_leda_d3_rat_bounded_side {
|
|||
typedef typename K::Tetrahedron_3 Tetrahedron_3;
|
||||
typedef typename K::Iso_cuboid_3 Iso_cuboid_3;
|
||||
typedef typename K::FT FT;
|
||||
|
||||
typedef typename K::Point_3 __My_Point_3;
|
||||
|
||||
public:
|
||||
typedef Arity_tag< 2 > Arity;
|
||||
|
|
@ -1324,18 +1348,18 @@ public:
|
|||
|
||||
// compare with x/y/z coordinates ...
|
||||
// we need at least one zero in the cmp results;
|
||||
int res1 = Point_3::cmp_x(p,min);
|
||||
int res2 = Point_3::cmp_x(p,max);
|
||||
int res1 = __My_Point_3::cmp_x(p,min);
|
||||
int res2 = __My_Point_3::cmp_x(p,max);
|
||||
|
||||
if (res1 == -1 || res2 == 1) return CGAL::ON_UNBOUNDED_SIDE;
|
||||
|
||||
int res3 = Point_3::cmp_y(p,min);
|
||||
int res4 = Point_3::cmp_y(p,max);
|
||||
int res3 = __My_Point_3::cmp_y(p,min);
|
||||
int res4 = __My_Point_3::cmp_y(p,max);
|
||||
|
||||
if (res3 == -1 || res4 == 1) return CGAL::ON_UNBOUNDED_SIDE;
|
||||
|
||||
int res5 = Point_3::cmp_z(p,min);
|
||||
int res6 = Point_3::cmp_z(p,max);
|
||||
int res5 = __My_Point_3::cmp_z(p,min);
|
||||
int res6 = __My_Point_3::cmp_z(p,max);
|
||||
|
||||
if (res5 == -1 || res6 == 1) return CGAL::ON_UNBOUNDED_SIDE;
|
||||
|
||||
|
|
|
|||
|
|
@ -96,6 +96,7 @@ int log(const leda_integer& i)
|
|||
#include <CEP/Leda_rat_kernel/LEDA_RATKERNEL/intersections_2.h>
|
||||
#include <CEP/Leda_rat_kernel/LEDA_RATKERNEL/computations_2.h>
|
||||
#include <CEP/Leda_rat_kernel/LEDA_RATKERNEL/generalized_predicates_2.h>
|
||||
#include <CEP/Leda_rat_kernel/LEDA_RATKERNEL/extension_predicates_2.h>
|
||||
|
||||
// -------------------------------------------------
|
||||
// ..... 3d kernel .....
|
||||
|
|
@ -298,6 +299,9 @@ public:
|
|||
typedef Predicate_leda_rat_counterclockwise_in_between_2<Self> Counterclockwise_in_between_2;
|
||||
typedef Predicate_leda_rat_do_intersect_2<Self> Do_intersect_2;
|
||||
|
||||
// a number of extensions ...
|
||||
typedef Predicate_leda_rat_do_intersect_to_right_2<Self> Do_intersect_to_right_2;
|
||||
typedef Predicate_leda_rat_do_intersect_to_left_2<Self> Do_intersect_to_left_2;
|
||||
|
||||
// -----------------------------------------------------------
|
||||
// support for 3d kernel traits ...
|
||||
|
|
@ -765,6 +769,16 @@ public:
|
|||
do_intersect_2_object() const
|
||||
{ return Do_intersect_2(); }
|
||||
|
||||
// extensions ...
|
||||
Do_intersect_to_right_2
|
||||
do_intersect_to_right_2_object() const
|
||||
{ return Do_intersect_to_right_2(); }
|
||||
|
||||
Do_intersect_to_left_2
|
||||
do_intersect_to_left_2_object() const
|
||||
{ return Do_intersect_to_left_2(); }
|
||||
|
||||
|
||||
// -----------------------------------------------------------
|
||||
// support for 3d kernel traits ...
|
||||
#if defined(CGAL_PROVIDE_LEDA_RAT_KERNEL_TRAITS_3)
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@ touch $ERRORFILE
|
|||
compile_and_run convex_hull_2
|
||||
compile_and_run delaunay_2
|
||||
compile_and_run delaunay_3
|
||||
compile_and_run extensions_2
|
||||
compile_and_run test_leda_kernelC2
|
||||
compile_and_run test_leda_kernelC3
|
||||
compile_and_run triangulation_2
|
||||
|
|
|
|||
|
|
@ -0,0 +1,120 @@
|
|||
// test 2d extensions ...
|
||||
|
||||
#include <CGAL/basic.h>
|
||||
#include <CGAL/convex_hull_2.h>
|
||||
#include <CEP/Leda_rat_kernel/leda_rat_kernel_traits.h>
|
||||
#include <LEDA/random_rat_point.h>
|
||||
#include <iostream>
|
||||
|
||||
#if defined(LEDA_NAMESPACE)
|
||||
using namespace leda;
|
||||
#endif
|
||||
|
||||
typedef CGAL::leda_rat_kernel_traits K;
|
||||
typedef K::Point_2 Point;
|
||||
typedef K::Do_intersect_to_right_2 Do_intersect_to_right_2;
|
||||
typedef K::Do_intersect_to_left_2 Do_intersect_to_left_2;
|
||||
|
||||
|
||||
bool cgal_do_intersect_to_right(const leda_rat_segment& c1, const leda_rat_segment& c2,
|
||||
const leda_rat_point& pt)
|
||||
{
|
||||
leda_rat_segment seg;
|
||||
bool res = c1.intersection(c2, seg);
|
||||
|
||||
if (! res) return false;
|
||||
|
||||
if (seg.start() == seg.end()) { // point ...
|
||||
return (leda_rat_point::cmp_xy(seg.start(), pt) == 1);
|
||||
}
|
||||
|
||||
// intersection result is a segment ...
|
||||
return ( (leda_rat_point::cmp_xy(seg.start(), pt) == 1) || (leda_rat_point::cmp_xy(seg.end(), pt) == 1) );
|
||||
}
|
||||
|
||||
|
||||
bool cgal_do_intersect_to_left(const leda_rat_segment& c1, const leda_rat_segment& c2,
|
||||
const leda_rat_point& pt)
|
||||
{
|
||||
leda_rat_segment seg;
|
||||
bool res = c1.intersection(c2, seg);
|
||||
|
||||
if (! res) return false;
|
||||
|
||||
if (seg.start() == seg.end()) { // point ...
|
||||
return (leda_rat_point::cmp_xy(seg.start(), pt) == -1);
|
||||
}
|
||||
|
||||
// intersection result is a segment ...
|
||||
return ( (leda_rat_point::cmp_xy(seg.start(), pt) == -1) || (leda_rat_point::cmp_xy(seg.end(), pt) == -1) );
|
||||
}
|
||||
|
||||
void my_random_point_in_square(rat_point& p, int maxc)
|
||||
{
|
||||
random_point_in_square(p, maxc);
|
||||
|
||||
// generate w value ...
|
||||
leda_random_source S(1,10);
|
||||
|
||||
int w;
|
||||
S >> w;
|
||||
p = leda_rat_point(p.X()*w,p.Y()*w,p.W()*w);
|
||||
}
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
int number_of_tests = 100000, i;
|
||||
|
||||
std::cout << "test intersection to right ...\n";
|
||||
|
||||
Do_intersect_to_right_2 do_intersect_to_right;
|
||||
Do_intersect_to_left_2 do_intersect_to_left;
|
||||
|
||||
for(i=0; i<number_of_tests;i++){
|
||||
rat_point p1,p2,p3,p4, pt;
|
||||
|
||||
my_random_point_in_square(p1, 10000);
|
||||
my_random_point_in_square(p2, 10000);
|
||||
my_random_point_in_square(p3, 10000);
|
||||
my_random_point_in_square(p4, 10000);
|
||||
my_random_point_in_square(pt, 10000);
|
||||
|
||||
leda_rat_segment s1(p1,p2), s2(p3,p4);
|
||||
|
||||
bool res1 = cgal_do_intersect_to_right(s1,s2,pt);
|
||||
bool res2 = do_intersect_to_right(s1,s2,pt);
|
||||
|
||||
if (res1 != res2){
|
||||
std::cout << "error !\n";
|
||||
std::cout << "res1/res2:" << res1 << " " << res2 << "\n";
|
||||
std::cout << "arguments: s1- " << s1 << " s2- " << s2 << " pt- " << pt << "\n";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
std::cout << "test intersection to left ...\n";
|
||||
|
||||
for(i=0; i<number_of_tests;i++){
|
||||
rat_point p1,p2,p3,p4, pt;
|
||||
|
||||
my_random_point_in_square(p1, 10000);
|
||||
my_random_point_in_square(p2, 10000);
|
||||
my_random_point_in_square(p3, 10000);
|
||||
my_random_point_in_square(p4, 10000);
|
||||
my_random_point_in_square(pt, 10000);
|
||||
|
||||
leda_rat_segment s1(p1,p2), s2(p3,p4);
|
||||
|
||||
bool res1 = cgal_do_intersect_to_left(s1,s2,pt);
|
||||
bool res2 = do_intersect_to_left(s1,s2,pt);
|
||||
|
||||
if (res1 != res2){
|
||||
std::cout << "error !\n";
|
||||
std::cout << "res1/res2:" << res1 << " " << res2 << "\n";
|
||||
std::cout << "arguments: s1- " << s1 << " s2- " << s2 << " pt- " << pt << "\n";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -40,7 +40,8 @@ all: \
|
|||
triangulation_2 \
|
||||
delaunay_3 \
|
||||
triangulation_3 \
|
||||
convex_hull_2
|
||||
convex_hull_2 \
|
||||
extensions_2
|
||||
|
||||
|
||||
test_leda_kernelC2$(EXE_EXT): test_leda_kernelC2$(OBJ_EXT)
|
||||
|
|
@ -55,6 +56,9 @@ convex_hull_2$(EXE_EXT): convex_hull_2$(OBJ_EXT)
|
|||
delaunay_2$(EXE_EXT): delaunay_2$(OBJ_EXT)
|
||||
$(CGAL_CXX) $(LIBPATH) $(EXE_OPT)delaunay_2 delaunay_2$(OBJ_EXT) $(LDFLAGS)
|
||||
|
||||
extensions_2$(EXE_EXT): extensions_2$(OBJ_EXT)
|
||||
$(CGAL_CXX) $(LIBPATH) $(EXE_OPT)extensions_2 extensions_2$(OBJ_EXT) $(LDFLAGS)
|
||||
|
||||
triangulation_2$(EXE_EXT): triangulation_2$(OBJ_EXT)
|
||||
$(CGAL_CXX) $(LIBPATH) $(EXE_OPT)triangulation_2 triangulation_2$(OBJ_EXT) $(LDFLAGS)
|
||||
|
||||
|
|
@ -71,7 +75,8 @@ clean: \
|
|||
triangulation_2.clean \
|
||||
delaunay_3.clean \
|
||||
triangulation_3.clean \
|
||||
convex_hull_2.clean
|
||||
convex_hull_2.clean \
|
||||
extensions_2.clean
|
||||
|
||||
|
||||
#---------------------------------------------------------------------#
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
0.9.2 (20 Nov 2002)
|
||||
0.9.3 (22 Nov 2002)
|
||||
|
|
|
|||
Loading…
Reference in New Issue