21 #include <boost/filesystem.hpp> 28 #define MAX_NUM_MESHES 1 39 if (!boost::filesystem::exists(this->
file_path_))
45 Assimp::Importer importer;
46 const aiScene* scene = importer.ReadFile(file_path,
54 if (0 >= scene->mNumMeshes)
56 ROS_ERROR(
"Found no meshes. Check mesh file. Aborting ...");
60 if (MAX_NUM_MESHES < scene->mNumMeshes)
62 ROS_WARN(
"Found more than one mesh in mesh file. The current implementation can only process %d mesh!!!", static_cast<uint32_t>(
MAX_NUM_MESHES));
65 aiMesh** mesh = scene->mMeshes;
66 aiVector3D* vertex = mesh[0]->mVertices;
72 for (uint32_t i = 0; i < mesh[0]->mNumFaces; ++i)
76 if (0 != this->
toVec3f(i, vertex++, t.
a))
81 if (0 != this->
toVec3f(i, vertex++, t.
b))
86 if (0 != this->
toVec3f(i, vertex++, t.
c))
108 ROS_ERROR(
"No valid vertex found at face %d", num_current_face);
112 out = fcl::Vec3f((*vertex)[0], (*vertex)[1], (*vertex)[2]);
int8_t read(std::vector< TriangleSupport > &tri_vec)
geometry_msgs::TransformStamped t
int8_t toVec3f(uint32_t num_current_face, aiVector3D *vertex, fcl::Vec3f &out)
#define ROS_DEBUG_STREAM(args)
const std::string resolveURI(const std::string &path)
#define ROS_ERROR_STREAM(args)