mirror of https://github.com/CGAL/cgal
Fix returning no intersection for a ray with spawn in a triangle
This commit is contained in:
parent
308ee5c967
commit
39c0a9fb33
|
|
@ -418,14 +418,14 @@ tr_intersection(const typename K::Triangle_3 &t,
|
|||
|
||||
typedef typename K::Point_3 Point_3;
|
||||
|
||||
typename K::Construct_vertex_3 vertex_on =
|
||||
k.construct_vertex_3_object();
|
||||
|
||||
typename K::Do_intersect_3 do_intersect =
|
||||
k.do_intersect_3_object();
|
||||
typename K::Orientation_3 orientation =
|
||||
k.orientation_3_object();
|
||||
|
||||
typename K::Construct_point_on_3 point_on =
|
||||
k.construct_point_on_3_object();
|
||||
typename K::Construct_vertex_3 vertex_on =
|
||||
k.construct_vertex_3_object();
|
||||
|
||||
typename Mesh_3::Vector_plane_orientation_3_static_filter<K> vector_plane_orient;
|
||||
|
||||
|
|
@ -439,17 +439,24 @@ tr_intersection(const typename K::Triangle_3 &t,
|
|||
const Point_3& q = point_on(r,1);
|
||||
|
||||
const Orientation ray_direction = vector_plane_orient(p, q, a, b, c);
|
||||
|
||||
if(ray_direction == COPLANAR) return result_type();
|
||||
if(ray_direction == COPLANAR)
|
||||
return result_type();
|
||||
|
||||
const Orientation abcp = orientation(a,b,c,p);
|
||||
if(abcp == COPLANAR) // p belongs to the triangle's supporting plane
|
||||
{
|
||||
if(do_intersect(t, p))
|
||||
return result_type(p);
|
||||
else
|
||||
return result_type();
|
||||
}
|
||||
|
||||
if(abcp == COPLANAR) return result_type(); // p belongs to the triangle's
|
||||
// supporting plane
|
||||
|
||||
if(ray_direction == abcp) return result_type();
|
||||
// The ray lies entirely in one of the two open halfspaces defined by the
|
||||
// triangle's supporting plane.
|
||||
if(ray_direction == abcp)
|
||||
{
|
||||
// The ray lies entirely in one of the two open halfspaces defined by the
|
||||
// triangle's supporting plane.
|
||||
return result_type();
|
||||
}
|
||||
|
||||
// Here we know that the ray crosses the plane (abc)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue