mirror of https://github.com/CGAL/cgal
Merge pull request #3855 from sgiraudot/Intersections_3-Fix_almost_collinear_segments_bug-GF
Intersections_3: Fix almost collinear segment bug # Conflicts: # Intersections_3/include/CGAL/Intersections_3/internal/intersection_3_1_impl.h
This commit is contained in:
commit
4d3671024d
|
|
@ -33,6 +33,7 @@
|
|||
#include <CGAL/number_utils.h>
|
||||
#include <CGAL/Intersections_3/Iso_cuboid_3_Iso_cuboid_3.h>
|
||||
#include <CGAL/Intersections_3/Iso_cuboid_3_Line_3.h>
|
||||
#include <CGAL/utils_classes.h>
|
||||
|
||||
#include <CGAL/Intersections_3/internal/bbox_intersection_3.h>
|
||||
namespace CGAL {
|
||||
|
|
@ -307,10 +308,13 @@ intersection(const typename K::Line_3 &l1,
|
|||
const Point_3 p4 = p2 + v2;
|
||||
if(!K().coplanar_3_object()(p1,p2,p3,p4)) return intersection_return<typename K::Intersect_3, typename K::Line_3, typename K::Line_3>();
|
||||
const Vector_3 v3 = p3 - p1;
|
||||
const Vector_3 v3v2 = cross_product(v3,v2);
|
||||
const Vector_3 v3v2 = cross_product(v3,v2);
|
||||
const Vector_3 v1v2 = cross_product(v1,v2);
|
||||
const FT t = ((v3v2.x()*v1v2.x()) + (v3v2.y()*v1v2.y()) + (v3v2.z()*v1v2.z())) /
|
||||
(v1v2.squared_length());
|
||||
const FT sl = v1v2.squared_length();
|
||||
if(certainly(sl == FT(0)))
|
||||
return intersection_return<typename K::Intersect_3, typename K::Line_3, typename K::Line_3>();
|
||||
const FT t = ((v3v2.x()*v1v2.x()) + (v3v2.y()*v1v2.y()) + (v3v2.z()*v1v2.z())) / sl;
|
||||
|
||||
return intersection_return<typename K::Intersect_3, typename K::Line_3, typename K::Line_3>(p1 + (v1 * t));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue