prevent filter failures

This commit is contained in:
Peter Hachenberger 2008-01-04 17:36:01 +00:00
parent 7a3d8afb8c
commit 6d1dd4bb0e
1 changed files with 21 additions and 23 deletions

View File

@ -183,18 +183,19 @@ class SNC_intersection : public SNC_const_decorator<SNC_structure_> {
Point_3& p) const {
if(s2.has_on(s1.target()))
return false;
return (does_intersect_internally(Ray_3(s1.source(), s1.target()), s2, p)
&& s1.has_on(p));
Ray_3 r(s1.source(), s1.target());
if(!does_intersect_internally(r, s2, p))
return false;
Plane_3 pl(s1.target(), r.to_vector());
return (pl.oriented_side(p) == CGAL::NEGATIVE);
}
bool does_intersect_internally( const Ray_3& s1,
const Segment_3& s2,
Point_3& p) const {
CGAL_NEF_TRACEN("does intersect internally without LINE3_LINE3_INTERSECTION");
if ( s1.is_degenerate() || s2.is_degenerate())
// the segment is degenerate so there is not internal intersection
return false;
CGAL_NEF_TRACEN("does intersect internally without LINE3_LINE3_INTERSECTION");
CGAL_assertion(!s1.is_degenerate());
CGAL_assertion(!s2.is_degenerate());
if ( orientation( s1.source(), s1.point(1), s2.source(), s2.target())
!= COPLANAR)
// the segments doesn't define a plane
@ -217,7 +218,14 @@ class SNC_intersection : public SNC_const_decorator<SNC_structure_> {
// since line(s1) and line(s2) are not parallel they intersects in only
// one point
CGAL::assign( p ,o);
return( s1.has_on(p) && s2.has_on(p));
Plane_3 pl(s1.source(), vs1);
if(pl.oriented_side(p) != CGAL::POSITIVE)
return false;
pl = Plane_3(s2.source(), vs2);
if(pl.oriented_side(p) != CGAL::POSITIVE)
return false;
pl = Plane_3(s2.target(), vs2);
return (pl.oriented_side(p) == CGAL::NEGATIVE);
}
#endif // LINE3_LINE3_INTERSECTION
@ -268,12 +276,8 @@ class SNC_intersection : public SNC_const_decorator<SNC_structure_> {
CGAL_NEF_TRACEN("-> facet's plane: " << h);
CGAL_NEF_TRACEN("-> a point on the plane: " << h.point());
CGAL_NEF_TRACEN("-> ray: " << ray);
if( ray.is_degenerate())
/* no possible internal intersection */
return false;
if( h.has_on( ray.source()))
/* no possible internal intersection */
return false;
CGAL_assertion(!ray.is_degenerate());
CGAL_assertion(!h.has_on(ray.source()));
Object o = intersection( h, ray);
if( !CGAL::assign( p, o))
return false;
@ -291,9 +295,7 @@ class SNC_intersection : public SNC_const_decorator<SNC_structure_> {
CGAL_NEF_TRACEN("-> facet's plane: " << h);
CGAL_NEF_TRACEN("-> a point on the plane: " << h.point());
CGAL_NEF_TRACEN("-> ray: " << ray);
if( ray.is_degenerate())
/* no possible internal intersection */
return false;
CGAL_assertion(!ray.is_degenerate());
if( h.has_on( ray.source()))
/* no possible internal intersection */
return false;
@ -314,9 +316,7 @@ class SNC_intersection : public SNC_const_decorator<SNC_structure_> {
CGAL_NEF_TRACEN("-> facet's plane: " << h);
CGAL_NEF_TRACEN("-> a point on the plane: " << h.point());
CGAL_NEF_TRACEN("-> segment: " << seg);
if( seg.is_degenerate())
/* no possible internal intersection */
return false;
CGAL_assertion(!seg.is_degenerate());
if( h.has_on( seg.source()) || h.has_on(seg.target()))
/* no possible internal intersection */
return false;
@ -344,9 +344,7 @@ class SNC_intersection : public SNC_const_decorator<SNC_structure_> {
CGAL_NEF_TRACEN("-> facet's plane: " << h);
CGAL_NEF_TRACEN("-> a point on the plane: " << h.point());
CGAL_NEF_TRACEN("-> segment: " << seg);
if( seg.is_degenerate())
/* no possible internal intersection */
return false;
CGAL_assertion(!seg.is_degenerate());
if( h.has_on( seg.source()) || h.has_on(seg.target()))
/* no possible internal intersection */
return false;