From c585d252885dd240126379ec9d1b858a11a257b3 Mon Sep 17 00:00:00 2001 From: ana Date: Mon, 17 Jan 2011 08:21:36 +0000 Subject: [PATCH] Fix for the bug IPAL21971: Polyhedron problems --- src/VTKViewer/VTKViewer_ConvexTool.cxx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/VTKViewer/VTKViewer_ConvexTool.cxx b/src/VTKViewer/VTKViewer_ConvexTool.cxx index ce1327a86..115335c5c 100644 --- a/src/VTKViewer/VTKViewer_ConvexTool.cxx +++ b/src/VTKViewer/VTKViewer_ConvexTool.cxx @@ -623,14 +623,17 @@ VTKViewer_OrderedTriangulator vtkFloatingPointType aBounds[6]; myPoints->GetBounds(aBounds); - + vtkFloatingPointType xSize, ySize, zSize; + xSize = aBounds[1] - aBounds[0]; + ySize = aBounds[3] - aBounds[2]; + zSize = aBounds[5] - aBounds[4]; vtkFloatingPointType anAbsoluteCoord[3]; vtkFloatingPointType aParamentrucCoord[3]; for (int aPntId = 0; aPntId < aNumPts; aPntId++) { myPoints->GetPoint(aPntId, anAbsoluteCoord); - aParamentrucCoord[0] = (anAbsoluteCoord[0] - aBounds[0]) / (aBounds[1] - aBounds[0]); - aParamentrucCoord[1] = (anAbsoluteCoord[1] - aBounds[2]) / (aBounds[3] - aBounds[2]); - aParamentrucCoord[2] = (anAbsoluteCoord[2] - aBounds[4]) / (aBounds[5] - aBounds[4]); + aParamentrucCoord[0] = xSize==0. ? 0. : ((anAbsoluteCoord[0] - aBounds[0]) / xSize); + aParamentrucCoord[1] = ySize==0. ? 0. : ((anAbsoluteCoord[1] - aBounds[2]) / ySize); + aParamentrucCoord[2] = zSize==0. ? 0. : ((anAbsoluteCoord[2] - aBounds[4]) / zSize); myTriangulator->InsertPoint(aPntId, anAbsoluteCoord, aParamentrucCoord, 0); } -- 2.39.2