Skip to content

Commit

Permalink
fix issue with frames convention in stl meshes (#1136)
Browse files Browse the repository at this point in the history
* return meshes extension as lower case for x sign check


Co-authored-by: Silvio Traversaro <[email protected]>
  • Loading branch information
mebbaid and traversaro authored Jan 5, 2024
1 parent 6fb96d9 commit 07fffef
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed

- Fixed compilation of pybind11 bindings (https://github.com/robotology/idyntree/pull/1128).
- Fixed support for handling correctly STL files that end with `.STL` in iDynTree Irrlicht-based visualizer (https://github.com/robotology/idyntree/pull/1136).

## [10.0.0] - 2023-10-16

Expand Down
19 changes: 12 additions & 7 deletions src/visualization/src/IrrlichtUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

#include <cmath>



namespace iDynTree
{

Expand Down Expand Up @@ -131,19 +133,22 @@ inline iDynTree::Rotation RotationWithPrescribedZColumn(const iDynTree::Directio
return R;
}

inline std::string getFileExt(const std::string filename)
inline std::string getFileExt(const std::string& filename)
{
std::string::size_type idx;
auto idx = filename.rfind('.');

idx = filename.rfind('.');

if (idx != std::string::npos)
if (idx != std::string::npos && idx + 1 < filename.size())
{
return filename.substr(idx+1);
std::string ext = filename.substr(idx + 1);
std::transform(ext.begin(), ext.end(), ext.begin(), [](unsigned char c) {
return std::tolower(c);
});

return ext;
}
else
{
return "";
return ""; // No extension found
}
}

Expand Down

0 comments on commit 07fffef

Please sign in to comment.