From: vsr Date: Fri, 26 Nov 2010 15:45:45 +0000 (+0000) Subject: Merge from V5_1_main 26/11/2010 X-Git-Tag: V6_2_0a1~5 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f9f83ddb9bd1ddb90f8c808bc3652a2c55e208f5;p=modules%2Fgui.git Merge from V5_1_main 26/11/2010 --- diff --git a/src/VTKViewer/VTKViewer_ArcBuilder.cxx b/src/VTKViewer/VTKViewer_ArcBuilder.cxx index c453a1589..6879c1e29 100644 --- a/src/VTKViewer/VTKViewer_ArcBuilder.cxx +++ b/src/VTKViewer/VTKViewer_ArcBuilder.cxx @@ -24,6 +24,7 @@ #include "VTKViewer_ArcBuilder.h" #include +#include //VTK includes #include @@ -425,19 +426,23 @@ vtkUnstructuredGrid* VTKViewer_ArcBuilder::BuildArc(std::vector& theScal theScalarValues.clear(); - double K1; - double K2; - K1 = (y2 - y1)/(x2 - x1); - K2 = (y3 - y2)/(x3 - x2); + double K1 = 0; + double K2 = 0; + bool okK1 = false, okK2 = false; + if ( fabs(x2 - x1) > DBL_MIN ) + K1 = (y2 - y1)/(x2 - x1), okK1 = true; + if ( fabs(x3 - x2) > DBL_MIN ) + K2 = (y3 - y2)/(x3 - x2), okK2 = true; + #ifdef _MY_DEBUG_ std::cout<<"K1 : "<< K1 < infinity + if( !okK2 ) //K2 --> infinity xCenter = (K1*(y1-y3) + (x1+x2))/2.0; - else if(x2 == x1) //K1 --> infinity + else if( !okK1 ) //K1 --> infinity xCenter = (K2*(y1-y3) - (x2+x3))/(-2.0); else