From 01453b8b0e5d167239951799791c3fe9da859ff3 Mon Sep 17 00:00:00 2001 From: malomo Date: Tue, 14 Feb 2012 12:13:38 +0000 Subject: [PATCH] Fixed a call to InterpolationParameters. A Point3 reference must be provided for barycentric coordinates output, instead of 3 separate scalars. --- vcg/complex/algorithms/closest.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/vcg/complex/algorithms/closest.h b/vcg/complex/algorithms/closest.h index 2b3924e9..65c078e0 100644 --- a/vcg/complex/algorithms/closest.h +++ b/vcg/complex/algorithms/closest.h @@ -348,13 +348,14 @@ namespace vcg { typename GRID::CoordType dir=_ray.Direction(); dir.Normalize(); typename GRID::CoordType int_point=_ray.Origin()+_ray1.Direction()*_t; - typename GRID::ScalarType alfa,beta,gamma; if (f!=NULL) { - InterpolationParameters(*f,f->N(),int_point, alfa, beta, gamma); - _normf = (f->V(0)->cN())*alfa+ - (f->V(1)->cN())*beta+ - (f->V(2)->cN())*gamma ; + Point3 bary; + InterpolationParameters(*f,f->N(),int_point, bary); + + _normf = (f->V(0)->cN())*bary.X()+ + (f->V(1)->cN())*bary.Y()+ + (f->V(2)->cN())*bary.Z() ; } return f; }