+ return myGaussMetric;
+}
+
+//----------------------------------------------------------------------------
+vtkFloatingPointType CutValue (vtkFloatingPointType theValue, int theDecimals)
+{
+ vtkFloatingPointType v = theValue;
+
+#if defined(USE_SPRINTF)
+ char aFormat[16];
+ sprintf(aFormat, "%%.%dg", theDecimals);
+ char aStr [256];
+ sprintf(aStr, aFormat, theValue);
+ v = atof(aStr);
+#elif defined(USE_NEW_ALGORITHM)
+ //
+ // VSR 19/10/2009: new algorithm does not use long long type
+ //
+ long n1 = 0;
+ // calculate order of the integral part
+ while ( v > 1. ) {
+ v = v / 10.;
+ n1++;
+ }
+ // calculate length of the fractional part
+ long n2 = theDecimals - n1;
+ v = theValue;
+ if ( n2 > 0 )
+ while ( n2-- > 0 ) v = v * 10.;
+ else
+ while ( n2++ < 0 ) v = v / 10.;
+ v = floor( (double) v );
+ n2 = theDecimals - n1;
+ if ( n2 > 0 )
+ while ( n2-- > 0 ) v = v / 10.;
+ else
+ while ( n2++ < 0 ) v = v * 10.;
+#else
+ //
+ // VSR 19/10/2009: old algorithm uses long long type -
+ // causes incompatibility with some platforms (Windows?)
+ //
+ vtkFloatingPointType aDegree = 0.0;
+ if (abs((long long)v) > 1)
+ aDegree = (long long)log10((double)abs((long long)v)) + 1;
+ aDegree = theDecimals - aDegree;
+ //printf("$$$ 1 v = %.20g , aDegree = %lld \n", v, (long long)aDegree);
+
+ aDegree = pow(10, aDegree);
+ v = ((vtkFloatingPointType)((long long)(v * aDegree))) / aDegree;
+ //printf("$$$ 2 v = %.20g , aDegree = %lld \n", v, (long long)aDegree);
+#endif
+
+ return v;
+}
+
+//----------------------------------------------------------------------------
+template<typename TValueType>
+void
+Module2Scalars(vtkDataArray *theInputDataArray,
+ TValueType* theOutputPtr,
+ vtkIdType theNbOfTuples)
+{
+ vtkIdType aNbComp = theInputDataArray->GetNumberOfComponents();
+ std::vector<vtkFloatingPointType> anArray(aNbComp < 3? 3: aNbComp);
+ for(vtkIdType aTupleId = 0; aTupleId < theNbOfTuples; aTupleId++){
+ theInputDataArray->GetTuple(aTupleId, &anArray[0]);
+ vtkFloatingPointType aVector[3] = {anArray[0], anArray[1], anArray[2]};
+ vtkFloatingPointType aScalar = sqrt(aVector[0]*aVector[0] +
+ aVector[1]*aVector[1] +
+ aVector[2]*aVector[2]);
+ *theOutputPtr = TValueType(aScalar);
+ theOutputPtr++;
+ }
+}
+
+template<typename TValueType>
+void
+Module2ScalarsMOD(vtkDataArray *theInputDataArray,
+ TValueType* theOutputPtr,
+ vtkIdType theNbOfTuples,
+ VISU::TGaussMetric theGaussMetric)
+{
+ vtkIdType aNbComp = theInputDataArray->GetNumberOfComponents();
+ if (aNbComp != 3) // Min, Max, Avg