Salome HOME
Join modifications from branch OCC_debug_for_3_2_0b1
[modules/visu.git] / src / PIPELINE / VISU_PipeLine.cxx
index 9fcd66fdc9a6fec787350d49acd4c93a8a69ceb3..34ba2a61d3267af34b9054d66b8ad7f17564b9eb 100644 (file)
@@ -181,7 +181,7 @@ VISU_PipeLine
 
 int
 VISU_PipeLine
-::CheckAvailableMemory(const float& theSize)
+::CheckAvailableMemory(const vtkFloatingPointType& theSize)
 {
   try{
     if(theSize > ULONG_MAX) return 0;
@@ -202,10 +202,10 @@ VISU_PipeLine
   return 0;
 }
 
-float
+vtkFloatingPointType
 VISU_PipeLine
-::GetAvailableMemory(float theSize, 
-                    float theMinSize)
+::GetAvailableMemory(vtkFloatingPointType theSize, 
+                    vtkFloatingPointType theMinSize)
 {
   while(!CheckAvailableMemory(theSize))
     if(theSize > theMinSize)
@@ -279,36 +279,36 @@ VISU_PipeLine
 static
 void
 ComputeBoundsParam (vtkDataSet* theDataSet,
-                   float theDirection[3], 
-                   float theMinPnt[3],
-                   float& theMaxBoundPrj, 
-                   float& theMinBoundPrj)
+                   vtkFloatingPointType theDirection[3], 
+                   vtkFloatingPointType theMinPnt[3],
+                   vtkFloatingPointType& theMaxBoundPrj, 
+                   vtkFloatingPointType& theMinBoundPrj)
 {
-  float aBounds[6];
+  vtkFloatingPointType aBounds[6];
   theDataSet->GetBounds(aBounds);
 
   //Enlarge bounds in order to avoid conflicts of precision
   for(int i = 0; i < 6; i += 2){
     static double EPS = 1.0E-3;
-    float aDelta = (aBounds[i+1] - aBounds[i])*EPS;
+    vtkFloatingPointType aDelta = (aBounds[i+1] - aBounds[i])*EPS;
     aBounds[i] -= aDelta;
     aBounds[i+1] += aDelta;
   }
 
-  float aBoundPoints[8][3] = { {aBounds[0],aBounds[2],aBounds[4]},
-                              {aBounds[1],aBounds[2],aBounds[4]},
-                              {aBounds[0],aBounds[3],aBounds[4]},
-                              {aBounds[1],aBounds[3],aBounds[4]},
-                              {aBounds[0],aBounds[2],aBounds[5]},
-                              {aBounds[1],aBounds[2],aBounds[5]},
-                              {aBounds[0],aBounds[3],aBounds[5]},
-                              {aBounds[1],aBounds[3],aBounds[5]}};
+  vtkFloatingPointType aBoundPoints[8][3] = { {aBounds[0],aBounds[2],aBounds[4]},
+                                             {aBounds[1],aBounds[2],aBounds[4]},
+                                             {aBounds[0],aBounds[3],aBounds[4]},
+                                             {aBounds[1],aBounds[3],aBounds[4]},
+                                             {aBounds[0],aBounds[2],aBounds[5]},
+                                             {aBounds[1],aBounds[2],aBounds[5]},
+                                             {aBounds[0],aBounds[3],aBounds[5]},
+                                             {aBounds[1],aBounds[3],aBounds[5]}};
 
   int aMaxId = 0, aMinId = aMaxId;
   theMaxBoundPrj = vtkMath::Dot(theDirection,aBoundPoints[aMaxId]);
   theMinBoundPrj = theMaxBoundPrj;
   for(int i = 1; i < 8; i++){
-    float aTmp = vtkMath::Dot(theDirection,aBoundPoints[i]);
+    vtkFloatingPointType aTmp = vtkMath::Dot(theDirection,aBoundPoints[i]);
     if(theMaxBoundPrj < aTmp){
       theMaxBoundPrj = aTmp;
       aMaxId = i;
@@ -318,7 +318,7 @@ ComputeBoundsParam (vtkDataSet* theDataSet,
       aMinId = i;
     }
   }
-  float *aMinPnt = aBoundPoints[aMaxId];
+  vtkFloatingPointType *aMinPnt = aBoundPoints[aMaxId];
   theMinPnt[0] = aMinPnt[0];
   theMinPnt[1] = aMinPnt[1];
   theMinPnt[2] = aMinPnt[2];
@@ -327,13 +327,13 @@ ComputeBoundsParam (vtkDataSet* theDataSet,
 static
 void
 DistanceToPosition(vtkDataSet* theDataSet,
-                  float theDirection[3], 
-                  float theDist, 
-                  float thePos[3])
+                  vtkFloatingPointType theDirection[3], 
+                  vtkFloatingPointType theDist, 
+                  vtkFloatingPointType thePos[3])
 {
-  float aMaxBoundPrj, aMinBoundPrj, aMinPnt[3];
+  vtkFloatingPointType aMaxBoundPrj, aMinBoundPrj, aMinPnt[3];
   ComputeBoundsParam(theDataSet,theDirection,aMinPnt,aMaxBoundPrj,aMinBoundPrj);
-  float aLength = (aMaxBoundPrj-aMinBoundPrj)*theDist;
+  vtkFloatingPointType aLength = (aMaxBoundPrj-aMinBoundPrj)*theDist;
   thePos[0] = aMinPnt[0]-theDirection[0]*aLength;
   thePos[1] = aMinPnt[1]-theDirection[1]*aLength;
   thePos[2] = aMinPnt[2]-theDirection[2]*aLength;
@@ -342,37 +342,37 @@ DistanceToPosition(vtkDataSet* theDataSet,
 static
 void
 PositionToDistance (vtkDataSet* theDataSet,
-                   float theDirection[3], 
-                   float thePos[3], 
-                   float& theDist)
+                   vtkFloatingPointType theDirection[3], 
+                   vtkFloatingPointType thePos[3], 
+                   vtkFloatingPointType& theDist)
 {
-  float aMaxBoundPrj, aMinBoundPrj, aMinPnt[3];
+  vtkFloatingPointType aMaxBoundPrj, aMinBoundPrj, aMinPnt[3];
   ComputeBoundsParam(theDataSet,theDirection,aMinPnt,aMaxBoundPrj,aMinBoundPrj);
-  float aPrj = vtkMath::Dot(theDirection,thePos);
+  vtkFloatingPointType aPrj = vtkMath::Dot(theDirection,thePos);
   theDist = (aPrj-aMinBoundPrj)/(aMaxBoundPrj-aMinBoundPrj);
 }
 
 void
 VISU_PipeLine
-::SetPlaneParam(float theDir[3], 
-               float theDist, 
+::SetPlaneParam(vtkFloatingPointType theDir[3], 
+               vtkFloatingPointType theDist, 
                vtkPlane* thePlane)
 {
   thePlane->SetNormal(theDir);
-  float anOrigin[3];
+  vtkFloatingPointType anOrigin[3];
   ::DistanceToPosition(GetInput(),theDir,theDist,anOrigin);
   thePlane->SetOrigin(anOrigin);
 }
 
 void
 VISU_PipeLine
-::GetPlaneParam(float theDir[3], 
-               float& theDist, 
+::GetPlaneParam(vtkFloatingPointType theDir[3], 
+               vtkFloatingPointType& theDist, 
                vtkPlane* thePlane)
 {
   thePlane->GetNormal(theDir);
 
-  float anOrigin[3];
+  vtkFloatingPointType anOrigin[3];
   thePlane->GetOrigin(anOrigin);
   ::PositionToDistance(GetInput(),theDir,anOrigin,theDist);
 }
@@ -385,7 +385,7 @@ bool
 VISU_PipeLine
 ::IsPlanarInput() const
 {
-  float aBounds[6];
+  vtkFloatingPointType aBounds[6];
   GetInput()->GetBounds( aBounds ); // xmin,xmax, ymin,ymax, zmin,zmax
   if (fabs( aBounds[0] - aBounds[1] ) <= FLT_MIN ||
       fabs( aBounds[2] - aBounds[3] ) <= FLT_MIN ||
@@ -412,7 +412,7 @@ VISU_PipeLine
   return myExtractGeometry->GetNodeVTKId(anID);
 }
 
-float
+vtkFloatingPointType
 VISU_PipeLine
 ::GetNodeCoord(int theObjID)
 {