From 53bf22e94e9c4c1663cf9f3fb8784ac86d24a08d Mon Sep 17 00:00:00 2001 From: Calixte DENIZET Date: Fri, 18 Jan 2013 21:14:21 +0100 Subject: [PATCH] Bugs 12196 & 12154 fixed: There were no log-scales with Fec & Fac3d. Change-Id: Ib3d904d42f060315a5117ddbba0ba61afa875ac1 --- scilab/CHANGES_5.4.X | 2 + .../graphic_objects/src/cpp/Fac3DDecomposer.cpp | 37 ++++++++++++----- .../src/cpp/TriangleMeshFecDataDecomposer.cpp | 42 ++++++++++++++++---- 3 files changed, 62 insertions(+), 19 deletions(-) diff --git a/scilab/CHANGES_5.4.X b/scilab/CHANGES_5.4.X index efb66f8..e9000c0 100644 --- a/scilab/CHANGES_5.4.X +++ b/scilab/CHANGES_5.4.X @@ -280,6 +280,8 @@ Bug fixes * Bug #12190 fixed - Description of sprspn updated in help page. +* Bug #12196 fixed - There were no log-scales with Fec & Fac3d. + * Bug #12204 fixed - Fix a typo in the French localization * Bug #12219 fixed - delete("all") does not recreate a basic axe within cleaned figure. diff --git a/scilab/modules/graphic_objects/src/cpp/Fac3DDecomposer.cpp b/scilab/modules/graphic_objects/src/cpp/Fac3DDecomposer.cpp index e6d1fc9..d69ecc4 100644 --- a/scilab/modules/graphic_objects/src/cpp/Fac3DDecomposer.cpp +++ b/scilab/modules/graphic_objects/src/cpp/Fac3DDecomposer.cpp @@ -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; diff --git a/scilab/modules/graphic_objects/src/cpp/TriangleMeshFecDataDecomposer.cpp b/scilab/modules/graphic_objects/src/cpp/TriangleMeshFecDataDecomposer.cpp index 150b6ef..c834fd7 100644 --- a/scilab/modules/graphic_objects/src/cpp/TriangleMeshFecDataDecomposer.cpp +++ b/scilab/modules/graphic_objects/src/cpp/TriangleMeshFecDataDecomposer.cpp @@ -45,13 +45,39 @@ void TriangleMeshFecDataDecomposer::fillVertices(char* id, float* buffer, int bu for (int i = 0; i < numVertices; i++) { - buffer[elementsSize*i] = (float)coordinates[3*i]; - buffer[elementsSize*i +1] = (float)coordinates[3*i+1]; - buffer[elementsSize*i +2] = (float)coordinates[3*i+2]; + if (coordinateMask & 0x1) + { + double xi = coordinates[3 * i]; + if (logMask & 0x1) + { + xi = DecompositionUtils::getLog10Value(xi); + } + buffer[elementsSize * i] = (float)(xi * scale[0] + translation[0]); + } - if (elementsSize == 4) + if (coordinateMask & 0x2) + { + double yi = coordinates[3 * i + 1]; + if (logMask & 0x2) + { + yi = DecompositionUtils::getLog10Value(yi); + } + buffer[elementsSize * i + 1] = (float)(yi * scale[1] + translation[1]); + } + + if (coordinateMask & 0x4) + { + double zi = coordinates[3 * i + 2]; + if (logMask & 0x4) + { + zi = DecompositionUtils::getLog10Value(zi); + } + buffer[elementsSize * i + 2] = (float)(zi * scale[2] + translation[2]); + } + + if (elementsSize == 4 && (coordinateMask & 0x8)) { - buffer[elementsSize*i +3] = 1.0; + buffer[elementsSize * i + 3] = 1.0; } } @@ -90,11 +116,11 @@ void TriangleMeshFecDataDecomposer::fillTextureCoordinates(char* id, float* buff if (colorRange[0] != 0 || colorRange[1] != 0) { - colorsNumber = (double) (1 + colorRange[1] - colorRange[0]); + colorsNumber = (double) (1 + colorRange[1] - colorRange[0]); } else { - colorsNumber = (double) colormapSize; + colorsNumber = (double) colormapSize; } /** To take into account the presence of exterior colors: @@ -278,7 +304,7 @@ void TriangleMeshFecDataDecomposer::fillColors(char* id, float* buffer, int buff } else { - /* To do: replace 0.5 by a macro-definition */ + /* To do: replace 0.5 by a macro-definition */ ColorComputer::getColor(values[i], minValue, valueRange, 0.5, colormap, minColorIndex, maxColorIndex, colormapSize, &buffer[bufferOffset]); } -- 1.7.9.5