From ee47d24a3cd10b6a1eb46c8ac883e2a72227762b Mon Sep 17 00:00:00 2001 From: CookieKastanie Date: Mon, 7 Mar 2022 14:39:46 +0100 Subject: [PATCH] unsigned distance --- src/point_tris_dist.cc | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/point_tris_dist.cc b/src/point_tris_dist.cc index 74a826e..53bb241 100644 --- a/src/point_tris_dist.cc +++ b/src/point_tris_dist.cc @@ -52,8 +52,6 @@ double pointTriangleDistance(double *p, vtkCell *triangle, double *direction) { double db = vtkMath::Dot(vecTB, bp); double dc = vtkMath::Dot(vecTC, cp); - double distance = 0; - if(da <= 0 && db <= 0 && dc <= 0) { double na[3] = { n[0] * a[0], @@ -80,7 +78,7 @@ double pointTriangleDistance(double *p, vtkCell *triangle, double *direction) { direction[1] = nt[1]; direction[2] = nt[2]; vtkMath::Normalize(direction); - distance = vtkMath::Norm(nt); + return vtkMath::Norm(nt); } else { double normalA[3]; @@ -107,16 +105,6 @@ double pointTriangleDistance(double *p, vtkCell *triangle, double *direction) { direction[2] = normalC[2]; } - distance = min; + return min; } - - if(vtkMath::Dot(direction, n) < 0) { - direction[0] = -direction[0]; - direction[1] = -direction[1]; - direction[2] = -direction[2]; - - return -distance; - } else { - return distance; - } }