Skip to content

Commit

Permalink
Merge pull request #342 from pariterre/fixMeshPath
Browse files Browse the repository at this point in the history
Added path for all STL files
  • Loading branch information
pariterre authored Feb 27, 2024
2 parents 6892bcd + 1edb9a0 commit 4d8c472
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions include/RigidBody/Mesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ class BIORBD_API Mesh
///
utils::Vector3d& color() const;

///
/// \brief Return if there is a mesh
/// \return If there is a mesh
bool hasMesh() const;

///
/// \brief Add a point to the mesh
/// \param node The point to add
Expand Down
2 changes: 1 addition & 1 deletion src/ModelReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2275,6 +2275,7 @@ rigidbody::Mesh Reader::readMeshFileStl(
}

rigidbody::Mesh mesh;
mesh.setPath(path);
if (isBinary){
// Know the number of points
char headerChar[80] = "";
Expand All @@ -2284,7 +2285,6 @@ rigidbody::Mesh Reader::readMeshFileStl(
file.readFromBinary(nbTrianglesChar, 4);
size_t nbTriangles = static_cast<size_t>(*((unsigned int*) nbTrianglesChar));

mesh.setPath(path);
utils::Vector3d normal;
utils::Vector3d vertex;
for (int i = 0; i<nbTriangles; ++i){
Expand Down
3 changes: 3 additions & 0 deletions src/RigidBody/Mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ utils::Vector3d &rigidbody::Mesh::color() const
return *m_patchColor;
}

bool rigidbody::Mesh::hasMesh() const {
return m_vertex->size() > 0;
}
void rigidbody::Mesh::addPoint(const utils::Vector3d &node)
{
m_vertex->push_back(node);
Expand Down

0 comments on commit 4d8c472

Please sign in to comment.