Commit 9676c169ceb2f52ae2d9060c8b24d99002e44468

Authored by Klemens Schölhorn
Committed by David Gräff
1 parent bf0ed67c

Do not invert the offset when inverting a channel

Fixes #110.
openhantek/src/glgenerator.cpp
@@ -238,7 +238,7 @@ void GlGenerator::generateGraphs(const DataAnalyzerResult *result) { @@ -238,7 +238,7 @@ void GlGenerator::generateGraphs(const DataAnalyzerResult *result) {
238 238
239 for (unsigned int position = 0; position < sampleCount; ++position) { 239 for (unsigned int position = 0; position < sampleCount; ++position) {
240 *(glIterator++) = position * horizontalFactor - DIVS_TIME / 2; 240 *(glIterator++) = position * horizontalFactor - DIVS_TIME / 2;
241 - *(glIterator++) = invert * (*(dataIterator++) / gain + offset); 241 + *(glIterator++) = *(dataIterator++) / gain * invert + offset;
242 } 242 }
243 } else { 243 } else {
244 std::vector<double>::const_iterator dataIterator = 244 std::vector<double>::const_iterator dataIterator =
@@ -297,8 +297,8 @@ void GlGenerator::generateGraphs(const DataAnalyzerResult *result) { @@ -297,8 +297,8 @@ void GlGenerator::generateGraphs(const DataAnalyzerResult *result) {
297 const double yInvert = settings->voltage[yChannel].inverted ? -1.0 : 1.0; 297 const double yInvert = settings->voltage[yChannel].inverted ? -1.0 : 1.0;
298 298
299 for (unsigned int position = 0; position < sampleCount; ++position) { 299 for (unsigned int position = 0; position < sampleCount; ++position) {
300 - *(glIterator++) = xInvert * (*(xIterator++) / xGain + xOffset);  
301 - *(glIterator++) = yInvert * (*(yIterator++) / yGain + yOffset); 300 + *(glIterator++) = *(xIterator++) / xGain * xInvert + xOffset;
  301 + *(glIterator++) = *(yIterator++) / yGain * yInvert + yOffset;
302 } 302 }
303 } else { 303 } else {
304 // Delete all vector arrays 304 // Delete all vector arrays