mirror of https://github.com/CGAL/cgal
Merge pull request #5556 from MaelRL/Kernel_23-Dont_recompute_normal_in_proj_point-GF
Fix inconsistency in normal computation in robust projection code
This commit is contained in:
commit
af8c4d57bb
|
|
@ -2752,25 +2752,19 @@ namespace CommonKernelFunctors {
|
|||
bool
|
||||
is_inside_triangle_3(const typename K::Point_3& p,
|
||||
const typename K::Triangle_3& t,
|
||||
const typename K::Vector_3& w,
|
||||
typename K::Point_3& result,
|
||||
const K& k)
|
||||
{
|
||||
typedef typename K::Point_3 Point_3;
|
||||
typedef typename K::Vector_3 Vector_3;
|
||||
|
||||
typename K::Construct_vector_3 vector =
|
||||
k.construct_vector_3_object();
|
||||
typename K::Construct_vertex_3 vertex_on =
|
||||
k.construct_vertex_3_object();
|
||||
typename K::Construct_cross_product_vector_3 cross_product =
|
||||
k.construct_cross_product_vector_3_object();
|
||||
|
||||
const Point_3& t0 = vertex_on(t,0);
|
||||
const Point_3& t1 = vertex_on(t,1);
|
||||
const Point_3& t2 = vertex_on(t,2);
|
||||
|
||||
Vector_3 w = cross_product(vector(t0,t1), vector(t1,t2));
|
||||
|
||||
bool outside = false;
|
||||
if ( is_inside_triangle_3_aux(w, t0, t1, p, result, outside, k)
|
||||
|| is_inside_triangle_3_aux(w, t1, t2, p, result, outside, k)
|
||||
|
|
@ -2846,6 +2840,8 @@ namespace CommonKernelFunctors {
|
|||
typename K::Construct_projected_point_3 projection =
|
||||
k.construct_projected_point_3_object();
|
||||
typename K::Is_degenerate_3 is_degenerate = k.is_degenerate_3_object();
|
||||
typename K::Construct_orthogonal_vector_3 normal =
|
||||
k.construct_orthogonal_vector_3_object();
|
||||
|
||||
const typename K::Plane_3 plane = supporting_plane(triangle);
|
||||
if(is_degenerate(plane)) {
|
||||
|
|
@ -2892,9 +2888,8 @@ namespace CommonKernelFunctors {
|
|||
// Project origin on triangle supporting plane
|
||||
const Point_3 proj = projection(plane, origin);
|
||||
|
||||
|
||||
Point_3 moved_point;
|
||||
bool inside = is_inside_triangle_3(proj,triangle,moved_point,k);
|
||||
bool inside = is_inside_triangle_3(proj,triangle,normal(plane),moved_point,k);
|
||||
|
||||
// If proj is inside triangle, return it
|
||||
if ( inside )
|
||||
|
|
|
|||
Loading…
Reference in New Issue