Skip to content
Snippets Groups Projects
Commit 4493c4ab authored by Joseph Mirabel's avatar Joseph Mirabel Committed by Joseph Mirabel
Browse files

Add exception when loading meshes with lines.

Triangulated meshes contain faces with 1, 2 or 3 vertex. 1 and 2 vertex is not supported by FCL.

Refers to https://github.com/humanoid-path-planner/hpp-model-urdf/pull/6
parent 0e62605c
Branches
Tags
No related merge requests found
......@@ -20,6 +20,7 @@
#define __se3_collada_to_fcl_hpp__
#include <limits>
#include <sstream>
#include <boost/filesystem/fstream.hpp>
#include <boost/foreach.hpp>
......@@ -110,7 +111,15 @@ namespace se3
for (uint32_t j = 0; j < input_mesh->mNumFaces; j++)
{
aiFace& face = input_mesh->mFaces[j];
// FIXME: can add only triangular faces.
if (face.mNumIndices != 3) {
std::stringstream ss;
ss << "Mesh " << input_mesh->mName.C_Str() << " has a face with "
<< face.mNumIndices << " vertices. This is not supported\n";
ss << "Node name is: " << node->mName.C_Str() << "\n";
ss << "Mesh index: " << i << "\n";
ss << "Face index: " << j << "\n";
throw std::invalid_argument (ss.str());
}
tv.triangles_.push_back (fcl::Triangle( oldNbPoints + face.mIndices[0],
oldNbPoints + face.mIndices[1],
oldNbPoints + face.mIndices[2]));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment