fix regression in the Triangle_3-Triangle_3 intersection computation

this has been introduced when rewriting the code for the removal
of Object
This commit is contained in:
Sébastien Loriot 2013-11-28 17:19:52 +01:00
parent 3fe1187e96
commit 61dfe46ab9
2 changed files with 19 additions and 7 deletions

View File

@ -132,18 +132,24 @@ struct Triangle_Line_visitor {
::result_type result_type; ::result_type result_type;
result_type result_type
operator()(const typename K::Point_3& p, const typename K::Segment_3&) const { operator()(const typename K::Point_3& p, const typename K::Segment_3& s) const {
if ( s.has_on(p) )
return intersection_return<typename K::Intersect_3, typename K::Triangle_3, typename K::Triangle_3>(p); return intersection_return<typename K::Intersect_3, typename K::Triangle_3, typename K::Triangle_3>(p);
else
return result_type();
} }
result_type result_type
operator()(const typename K::Segment_3&, const typename K::Point_3& p) const { operator()(const typename K::Segment_3& s, const typename K::Point_3& p) const {
return intersection_return<typename K::Intersect_3, typename K::Triangle_3, typename K::Triangle_3>(p); return operator()(p,s);
} }
result_type result_type
operator()(const typename K::Point_3& p1, const typename K::Point_3&) const { operator()(const typename K::Point_3& p1, const typename K::Point_3& p2) const {
if (p1==p2)
return intersection_return<typename K::Intersect_3, typename K::Triangle_3, typename K::Triangle_3>(p1); return intersection_return<typename K::Intersect_3, typename K::Triangle_3, typename K::Triangle_3>(p1);
else
return result_type();
} }
result_type result_type
@ -158,7 +164,7 @@ struct Triangle_Line_visitor {
return intersection_return<typename K::Intersect_3, typename K::Triangle_3, typename K::Triangle_3>(*p); return intersection_return<typename K::Intersect_3, typename K::Triangle_3, typename K::Triangle_3>(*p);
} }
return intersection_return<typename K::Intersect_3, typename K::Triangle_3, typename K::Triangle_3>(); return result_type();
} }
}; };

View File

@ -273,6 +273,12 @@ void test_non_coplanar_triangles()
assert(obj.empty()); assert(obj.empty());
obj=CGAL::intersection(t2,t1); obj=CGAL::intersection(t2,t1);
assert(obj.empty()); assert(obj.empty());
t1=Triangle( Point( 0, 0, 0 ), Point( 0, 1, 1 ), Point( 0, 1, 0 ) );
t2=Triangle( Point( -1, -1, 0 ),Point( 0, -1, 0 ),Point( -1, 0, 0 ) );
obj=CGAL::intersection(t1,t2);
assert(obj.empty());
obj=CGAL::intersection(t2,t1);
assert(obj.empty());
} }
int main() int main()