From: Eduardo DAVILA Date: Mon, 5 Jun 2023 10:00:38 +0000 (+0200) Subject: #3510 Bug windows CreateMeshFromPoints box X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=8381c91a83a3c1d6f5c8f5bc3c7bc7a213673213;p=creaVtk.git #3510 Bug windows CreateMeshFromPoints box --- diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkCreateMeshFromPoints.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkCreateMeshFromPoints.cxx index 21e8f72..7431bad 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkCreateMeshFromPoints.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkCreateMeshFromPoints.cxx @@ -62,40 +62,39 @@ void CreateMeshFromPoints::Process() pointsCentroid[2] /= sizeLstX; if ((bbGetInputCloseSurface()==true) && (lstIndexs.size()>=2) ) - { - //Correct surface normals if needed - double pointSurf1[3], pointSurf2[3], pointSurf3[3]; - double vect1[3], vect2[3]; - double surfNormal[3], vectorCenter[3]; - double dotNormalSurf = 0; - - for(int pIndex = 0; pIndex < lstIndexs[0]-1; pIndex++){ - pointSurf1[0] = lstX[pIndex]; - pointSurf1[1] = lstY[pIndex]; - pointSurf1[2] = lstZ[pIndex]; - vtkMath::Subtract(pointsCentroid, pointSurf1, vectorCenter); - - pointSurf2[0] = lstX[pIndex+lstIndexs[1]]; - pointSurf2[1] = lstY[pIndex+lstIndexs[1]]; - pointSurf2[2] = lstZ[pIndex+lstIndexs[1]]; - pointSurf3[0] = lstX[pIndex+1]; - pointSurf3[1] = lstY[pIndex+1]; - pointSurf3[2] = lstZ[pIndex+1]; - vtkMath::Subtract(pointSurf2, pointSurf1, vect1); - vtkMath::Subtract(pointSurf3, pointSurf1, vect2); - vtkMath::Cross(vect1, vect2, surfNormal); - dotNormalSurf += vtkMath::Dot(surfNormal, vectorCenter); - } + { + //Correct surface normals if needed + double pointSurf1[3], pointSurf2[3], pointSurf3[3]; + double vect1[3], vect2[3]; + double surfNormal[3], vectorCenter[3]; + double dotNormalSurf = 0; + for(int pIndex = 0; pIndex < lstIndexs[0]-1; pIndex++) + { + pointSurf1[0] = lstX[pIndex]; + pointSurf1[1] = lstY[pIndex]; + pointSurf1[2] = lstZ[pIndex]; + vtkMath::Subtract(pointsCentroid, pointSurf1, vectorCenter); + pointSurf2[0] = lstX[pIndex+lstIndexs[1]]; + pointSurf2[1] = lstY[pIndex+lstIndexs[1]]; + pointSurf2[2] = lstZ[pIndex+lstIndexs[1]]; + pointSurf3[0] = lstX[pIndex+1]; + pointSurf3[1] = lstY[pIndex+1]; + pointSurf3[2] = lstZ[pIndex+1]; + vtkMath::Subtract(pointSurf2, pointSurf1, vect1); + vtkMath::Subtract(pointSurf3, pointSurf1, vect2); + vtkMath::Cross(vect1, vect2, surfNormal); + dotNormalSurf += vtkMath::Dot(surfNormal, vectorCenter); + } // for pIndex if(dotNormalSurf > 0){ points->Delete(); points = vtkPoints::New(); - for(int splineI = 0; splineI < lstIndexs.size(); splineI++){ + for(int splineI = 0; splineI < lstIndexs.size(); splineI++){ for (i=lstIndexs[splineI]-1; i >= 0;i--) { points->InsertNextPoint(lstX[splineI*lstIndexs[0]+i],lstY[splineI*lstIndexs[0]+i],lstZ[splineI*lstIndexs[0]+i]); - } - } - } + } // for i + } // for splineI + } // if dotNormalSurf } //