fixed bugs for data with all points/segments on a single line; the code

needs some clean-up
This commit is contained in:
Menelaos Karavelas 2004-02-23 18:19:31 +00:00
parent 66e8e5635e
commit 3e1522a611
3 changed files with 128 additions and 9 deletions

View File

@ -649,16 +649,44 @@ public:
bool operator()(const Site_2& p, const Site_2& q, const Site_2& t,
Sign sgn) const
{
#if 1
std::cout << "inside finite edge interior top "
<< "level operator()" << std::endl;
std::cout << "p: " << p << std::endl;
std::cout << "q: " << q << std::endl;
std::cout << "t: " << t << std::endl;
std::cout << "sgn: " << sgn << std::endl;
#endif
#if 0
// MK::ERROR: NEW STUFF; but not necessary ?
if ( p.is_point() && q.is_point() && t.is_point() ) {
if ( sgn == NEGATIVE ) { return true; }
RT dtpx = p.point().x() - t.point().x();
RT minus_dtpy = -p.point().y() + t.point().y();
RT dtqx = q.point().x() - t.point().x();
RT dtqy = q.point().y() - t.point().y();
Sign s1 = sign_of_determinant2x2(dtpx, minus_dtpy, dtqy, dtqx);
std::cout << "s1: " << int(s1) << std::endl;
CGAL_assertion( s1 != ZERO );
return ( s1 == NEGATIVE );
}
#endif
#if 0
if ( sgn != ZERO ) {
return false;
}
#endif
if ( p.is_segment() || q.is_segment()) {
return false;
}
// both p and q are points
if ( t.is_point() ) {
RT dtpx = p.point().x() - t.point().x();
RT minus_dtpy = -p.point().y() + t.point().y();
@ -667,12 +695,12 @@ public:
Sign s1 = sign_of_determinant2x2(dtpx, minus_dtpy, dtqy, dtqx);
std::cout << "s1: " << int(s1) << std::endl;
CGAL_assertion( s1 != ZERO );
return ( s1 == NEGATIVE );
}
// bool bp = ( (p.point() == t.source()) || (p.point() == t.target()) );
// bool bq = ( (q.point() == t.source()) || (q.point() == t.target()) );
bool bp =
are_same(p, t.source_site()) || are_same(p, t.target_site());
bool bq =

View File

@ -164,7 +164,9 @@ private:
if ( !filtered ) {
// MK::ERROR: here I should call a kernel object, not a
// function...
// function...; actually here (and everywhere in this class)
// use the orientation predicate for sites; it does some
// geometric filtering...
o = orientation(pp, qp, tp);
}
@ -369,6 +371,14 @@ public:
}
}
#endif
#if 1
std::cout << "+++++++++++++++++++++++++++++++++++++" << std::endl;
std::cout << "inside vertex conflict top "
<< "level operator()" << std::endl;
std::cout << "p: " << p << " exact? " << p.is_exact() << std::endl;
std::cout << "q: " << q << " exact? " << q.is_exact() << std::endl;
std::cout << "t: " << t << " exact? " << t.is_exact() << std::endl;
#endif
CGAL_assertion( !(p.is_segment() && q.is_segment()) );
@ -383,9 +393,18 @@ public:
}
if ( t.is_point() ) {
#if 1
std::cout << "incircle: " << incircle_p(p, q, t) << std::endl;
std::cout << "-------------------------------------" << std::endl;
#endif
return incircle_p(p, q, t);
}
#if 1
std::cout << "incircle: " << incircle_s(p, q, t) << std::endl;
std::cout << "-------------------------------------" << std::endl;
#endif
// MK::ERROR: do geometric filtering when orientation is called.
return incircle_s(p, q, t);
}

View File

@ -24,7 +24,7 @@
#include <CGAL/predicates/Svd_basic_predicates_C2.h>
#include <CGAL/predicates/Segment_Voronoi_diagram_vertex_2.h>
#include <CGAL/predicates/Svd_are_same_points_C2.h>
CGAL_BEGIN_NAMESPACE
@ -32,30 +32,102 @@ CGAL_BEGIN_NAMESPACE
template<class R, class Method_tag>
template<class K, class Method_tag>
class Svd_infinite_edge_interior_2
{
public:
typedef typename R::Site_2 Site_2;
typedef typename K::Site_2 Site_2;
typedef typename K::RT RT;
typedef Svd_are_same_points_C2<K> Are_same_points_2;
private:
Are_same_points_2 are_same;
bool same_segments(const Site_2& p, const Site_2& q) const
{
CGAL_precondition( p.is_segment() && q.is_segment() );
return
( are_same(p.source_site(), q.source_site()) &&
are_same(p.target_site(), q.target_site()) ) ||
( are_same(p.source_site(), q.target_site()) &&
are_same(p.target_site(), q.source_site()) );
}
public:
bool operator()(const Site_2& q, const Site_2& s, const Site_2& r,
const Site_2& t, Sign sgn) const
{
#if 1
std::cout << "inside infinite edge interior top "
<< "level operator()" << std::endl;
std::cout << "q: " << q << std::endl;
std::cout << "s: " << s << std::endl;
std::cout << "r: " << r << std::endl;
std::cout << "t: " << t << std::endl;
std::cout << "sgn: " << sgn << std::endl;
#endif
if ( t.is_segment() ) {
#if PRED_PRINT
std::cout << false << std::endl;
return false;
#endif
return false;
}
#if 0
#if 1
if ( q.is_segment() ) {
// in this case r and s must be endpoints of q
return ( sgn == NEGATIVE );
}
#endif
if ( s.is_point() && r.is_point() && are_same(s, r) ) {
// MK::ERROR: write this code using the compare_x_2 and
// compare_y_2 predicates instead of computing the inner
// product...
RT dtsx = s.point().x() - t.point().x();
RT dtsy = s.point().y() - t.point().y();
RT dtqx = q.point().x() - t.point().x();
RT minus_dtqy = -q.point().y() + t.point().y();
Sign sgn1 = sign_of_determinant2x2(dtsx, dtsy, minus_dtqy, dtqx);
CGAL_assertion( sgn1 != ZERO );
#if 1
std::cout << "result: " << (sgn1 == POSITIVE) << std::endl;
#endif
return (sgn1 == POSITIVE);
}
if ( s.is_segment() && r.is_segment() && same_segments(s, r) ) {
CGAL_assertion( are_same(q, s.source_site()) ||
are_same(q, s.target_site()) );
Site_2 ss;
if ( are_same(q, s.source_site()) ) {
ss = s.target_site();
} else {
ss = s.source_site();
}
// MK::ERROR: write this code using the compare_x_2 and
// compare_y_2 predicates instead of computing the inner
// product...
RT dtssx = ss.point().x() - t.point().x();
RT dtssy = ss.point().y() - t.point().y();
RT dtqx = q.point().x() - t.point().x();
RT minus_dtqy = -q.point().y() + t.point().y();
Sign sgn1 = sign_of_determinant2x2(dtssx, dtssy, minus_dtqy, dtqx);
CGAL_assertion( sgn1 != ZERO );
#if 1
std::cout << "result: " << (sgn1 == POSITIVE) << std::endl;
#endif
return (sgn1 == POSITIVE);
}
return ( sgn == NEGATIVE );
}