Skip to content

Commit

Permalink
ArgumentsParser compares lower case letters
Browse files Browse the repository at this point in the history
  • Loading branch information
albertoesmp committed Jan 19, 2024
1 parent 78047e3 commit 9e2c482
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/scanner/detector/FullWaveformPulseRunnable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<double> &calcIntensityRecord =
calcIntensityRecords.back();
calcIntensityRecord[0] = intersect->point.x;
Expand Down
1 change: 1 addition & 0 deletions src/scene/primitives/Triangle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 18 additions & 1 deletion src/util/ArgumentsParser.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <ArgumentsParser.h>

#include <iostream>
#include <algorithm>

// *** PUBLIC METHODS *** //
// ********************** //
Expand Down Expand Up @@ -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;
}

0 comments on commit 9e2c482

Please sign in to comment.