From a6a1ddb5ec2710ce3dc07fd75fcfffeaa50b2eff Mon Sep 17 00:00:00 2001 From: Paolo Cignoni cignoni Date: Tue, 21 Sep 2010 22:35:23 +0000 Subject: [PATCH] added management of failure of computation of baricentric coords during rasterization of textures --- src/meshlabplugins/filter_texture/rastering.h | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/meshlabplugins/filter_texture/rastering.h b/src/meshlabplugins/filter_texture/rastering.h index aa4b05f25..b3e36eb64 100644 --- a/src/meshlabplugins/filter_texture/rastering.h +++ b/src/meshlabplugins/filter_texture/rastering.h @@ -281,12 +281,9 @@ public: // Convert point to barycentric coords vcg::Point3f interp; - int axis = 0; - float tmp = -1; - for (int i=0; i<3; ++i) - if (fabs(nearestF->cN()[i]) > tmp) {tmp = fabs(nearestF->cN()[i]); axis = i;} - bool ret = InterpolationParameters(*nearestF, axis, closestPt, interp); - assert(ret); + bool ret = InterpolationParameters(*nearestF, nearestF->cN(), closestPt, interp); + if(!ret) return; + assert(ret); interp[2]=1.0-interp[1]-interp[0]; if (alpha==255 || qAlpha(trgImg.pixel(tp.X(), trgImg.height() - tp.Y())) < alpha)