Bugs 12196 & 12154 fixed: There were no log-scales with Fec & Fac3d.
[scilab.git] / scilab / modules / graphic_objects / src / cpp / Fac3DDecomposer.cpp
index e6d1fc9..d69ecc4 100644 (file)
@@ -64,22 +64,37 @@ void Fac3DDecomposer::fillVertices(char* id, float* buffer, int bufferLength, in
     {
         if (coordinateMask & 0x1)
         {
-            buffer[bufferOffset] = (float)(x[i] * scale[0] + translation[0]);
+            double xi = x[i];
+            if (logMask & 0x1)
+            {
+                xi = DecompositionUtils::getLog10Value(x[i]);
+            }
+            buffer[bufferOffset] = (float)(xi * scale[0] + translation[0]);
         }
 
         if (coordinateMask & 0x2)
         {
-            buffer[bufferOffset +1] = (float)(y[i] * scale[1] + translation[1]);
+            double yi = y[i];
+            if (logMask & 0x2)
+            {
+                yi = DecompositionUtils::getLog10Value(y[i]);
+            }
+            buffer[bufferOffset + 1] = (float)(yi * scale[1] + translation[1]);
         }
 
         if (coordinateMask & 0x4)
         {
-            buffer[bufferOffset +2] = (float)(z[i] * scale[2] + translation[2]);
+            double zi = z[i];
+            if (logMask & 0x4)
+            {
+                zi = DecompositionUtils::getLog10Value(z[i]);
+            }
+            buffer[bufferOffset + 2] = (float)(zi * scale[2] + translation[2]);
         }
 
         if (elementsSize == 4 && (coordinateMask & 0x8))
         {
-            buffer[bufferOffset +3] = 1.0;
+            buffer[bufferOffset + 3] = 1.0;
         }
 
         bufferOffset += 4;
@@ -182,18 +197,18 @@ void Fac3DDecomposer::fillTextureCoordinates(char* id, float* buffer, int buffer
         color = DecompositionUtils::getAbsoluteValue(color);
 
         fillConstantColorsTextureCoordinates(buffer, bufferLength, colormap, colormapSize,
-            color, numGons, numVerticesPerGon);
+                                             color, numGons, numVerticesPerGon);
     }
     else
     {
         fillDataColorsTextureCoordinates(buffer, bufferLength, colormap, colormapSize,
-            colors, colorFlag, perVertex, dataMapping, numGons, numVerticesPerGon);
+                                         colors, colorFlag, perVertex, dataMapping, numGons, numVerticesPerGon);
     }
 
 }
 
 void Fac3DDecomposer::fillNormalizedZColorsTextureCoordinates(float* buffer, int bufferLength, double* colormap, int colormapSize,
-    double* z, int numGons, int numVerticesPerGon)
+                                                              double* z, int numGons, int numVerticesPerGon)
 {
     double zavg = 0.;
     double zMin = 0.;
@@ -238,7 +253,7 @@ void Fac3DDecomposer::fillNormalizedZColorsTextureCoordinates(float* buffer, int
 }
 
 void Fac3DDecomposer::fillConstantColorsTextureCoordinates(float* buffer, int bufferLength, double* colormap, int colormapSize,
-    double colorValue, int numGons, int numVerticesPerGon)
+                                                           double colorValue, int numGons, int numVerticesPerGon)
 {
     int bufferOffset = 0;
 
@@ -255,7 +270,7 @@ void Fac3DDecomposer::fillConstantColorsTextureCoordinates(float* buffer, int bu
 }
 
 void Fac3DDecomposer::fillDataColorsTextureCoordinates(float* buffer, int bufferLength, double* colormap, int colormapSize,
-    double* colors, int colorFlag, int perVertex, int dataMapping, int numGons, int numVerticesPerGon)
+                                                       double* colors, int colorFlag, int perVertex, int dataMapping, int numGons, int numVerticesPerGon)
 {
     double colMin = 0.;
     double colRange = 0.;
@@ -333,7 +348,7 @@ double Fac3DDecomposer::computeAverageValue(double* values, int numVertices)
 }
 
 void Fac3DDecomposer::computeMinMaxValues(double* values, int numValues, int numGons, int numVerticesPerGon, int minMaxComputation,
-    double* valueMin, double* valueMax)
+                                          double* valueMin, double* valueMax)
 {
     double maxDouble = DecompositionUtils::getMaxDoubleValue();
     double tmpValueMin = maxDouble;
@@ -341,7 +356,7 @@ void Fac3DDecomposer::computeMinMaxValues(double* values, int numValues, int num
     double value = 0.;
 
     int numIterations = 0;
-    
+
     if (minMaxComputation != ALL_VALUES)
     {
         numIterations = numGons;