Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added path for all STL files #342

Merged
merged 2 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading