From 9e2c4823dfab801fcbd562248c30ca9b550073bb Mon Sep 17 00:00:00 2001 From: albertoesmp Date: Fri, 19 Jan 2024 15:06:53 +0100 Subject: [PATCH] ArgumentsParser compares lower case letters --- .../detector/FullWaveformPulseRunnable.cpp | 1 - src/scene/primitives/Triangle.cpp | 1 + src/util/ArgumentsParser.cpp | 19 ++++++++++++++++++- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/scanner/detector/FullWaveformPulseRunnable.cpp b/src/scanner/detector/FullWaveformPulseRunnable.cpp index 78c82b97b..4d0e73fcc 100644 --- a/src/scanner/detector/FullWaveformPulseRunnable.cpp +++ b/src/scanner/detector/FullWaveformPulseRunnable.cpp @@ -308,7 +308,6 @@ void FullWaveformPulseRunnable::handleSubray( intersects.push_back(*intersect); } #if DATA_ANALYTICS >= 2 - // TODO Rethink : At this point, double insertion has happened std::vector &calcIntensityRecord = calcIntensityRecords.back(); calcIntensityRecord[0] = intersect->point.x; diff --git a/src/scene/primitives/Triangle.cpp b/src/scene/primitives/Triangle.cpp index 3eee51b0d..d2e4f4325 100644 --- a/src/scene/primitives/Triangle.cpp +++ b/src/scene/primitives/Triangle.cpp @@ -70,6 +70,7 @@ double Triangle::getIncidenceAngle_rad( ){ double const angle = glm::angle(faceNormal, rayDir); return (angle > PI_HALF) ? M_PI - angle : angle; // Return min. angle + // If (PI_HALF - min. angle), then 0 rad does no longer mean orthogonal } // These naive methods are much faster than the built-in in Vector3D diff --git a/src/util/ArgumentsParser.cpp b/src/util/ArgumentsParser.cpp index 7a204a8bd..04e880d4e 100644 --- a/src/util/ArgumentsParser.cpp +++ b/src/util/ArgumentsParser.cpp @@ -1,6 +1,7 @@ #include #include +#include // *** PUBLIC METHODS *** // // ********************** // @@ -236,8 +237,24 @@ bool ArgumentsParser::parseLegacyEnergyModel(){ // *** PRIVATE METHODS *** // // *********************** // int ArgumentsParser::findIndexOfArgument(std::string&& arg){ + // Get lower case arg + std::string argLow(arg); + std::transform(arg.begin(), arg.end(), argLow.begin(), + [](unsigned char c) { + return std::tolower(c); + } + ); + // Compare arg against each argvi in argv for(int i = 1 ; i < argc ; i++){ - if(arg == argv[i]) return i; + // Get lower case argvi + std::string argvi(argv[i]); + std::transform(argvi.begin(), argvi.end(), argvi.begin(), + [](unsigned char c){ + return std::tolower(c); + } + ); + // Compare lower case strings + if(argLow == argvi) return i; } return -1; }