From d6b23e1ea3f76d9a8cdae62c339bb44049f81791 Mon Sep 17 00:00:00 2001 From: rnv Date: Tue, 4 Sep 2012 11:43:32 +0000 Subject: [PATCH] Fix for the 0021815: EDF 2347 SMESH : Error when meshing vertices: The visualization bug (problem of single node displaying) --- src/VTKViewer/VTKViewer_Utilities.cxx | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/VTKViewer/VTKViewer_Utilities.cxx b/src/VTKViewer/VTKViewer_Utilities.cxx index 15cfe2060..cc8fec734 100755 --- a/src/VTKViewer/VTKViewer_Utilities.cxx +++ b/src/VTKViewer/VTKViewer_Utilities.cxx @@ -124,14 +124,30 @@ ComputeVisiblePropBounds(vtkRenderer* theRenderer, if(VTKViewer_Actor* anActor = VTKViewer_Actor::SafeDownCast(aProp)) if(anActor->IsInfinitive()) continue; - vtkFloatingPointType *aBounds = aProp->GetBounds(); + static vtkFloatingPointType MIN_DISTANCE = 1./VTK_LARGE_FLOAT; static vtkFloatingPointType MAX_DISTANCE = 0.9*VTK_LARGE_FLOAT; + + if(abs(aBounds[1] - aBounds[0]) < MIN_DISTANCE) { + aBounds[0]-=0.001; + aBounds[1]+=0.001; + } + + if(abs(aBounds[3] - aBounds[2]) < MIN_DISTANCE) { + aBounds[2]-=0.001; + aBounds[3]+=0.001; + } + + if(abs(aBounds[5] - aBounds[4]) < MIN_DISTANCE) { + aBounds[4]-=0.001; + aBounds[5]+=0.001; + } + // make sure we haven't got bogus bounds if ( aBounds != NULL && aBounds[0] > -MAX_DISTANCE && aBounds[1] < MAX_DISTANCE && aBounds[2] > -MAX_DISTANCE && aBounds[3] < MAX_DISTANCE && - aBounds[4] > -MAX_DISTANCE && aBounds[5] < MAX_DISTANCE ) + aBounds[4] > -MAX_DISTANCE && aBounds[5] < MAX_DISTANCE) { aCount++; -- 2.39.2