Skip to content

Commit

Permalink
fix ordering of vertices
Browse files Browse the repository at this point in the history
  • Loading branch information
mmeijerdfki committed Dec 30, 2024
1 parent 49629c4 commit e0ef18c
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions seerep_hdf5/seerep_hdf5_core/src/hdf5_core_point_cloud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,29 +120,29 @@ Hdf5CorePointCloud::createMeshFromAABB(const std::vector<float>& bb_coords)
std::vector<CGSurfaceMesh::Face_index> descriptors;

// bottom plane
descriptors.push_back(mesh.add_face(verts[0], verts[4], verts[6], verts[2]));
// front plane
descriptors.push_back(mesh.add_face(verts[0], verts[1], verts[3], verts[2]));
// front plane
descriptors.push_back(mesh.add_face(verts[2], verts[6], verts[4], verts[0]));
// left plane
descriptors.push_back(mesh.add_face(verts[4], verts[5], verts[1], verts[0]));
descriptors.push_back(mesh.add_face(verts[3], verts[7], verts[6], verts[2]));
// back plane
descriptors.push_back(mesh.add_face(verts[4], verts[5], verts[7], verts[6]));
descriptors.push_back(mesh.add_face(verts[1], verts[5], verts[7], verts[3]));
// right plane
descriptors.push_back(mesh.add_face(verts[2], verts[3], verts[7], verts[6]));
descriptors.push_back(mesh.add_face(verts[4], verts[5], verts[1], verts[0]));
// top plane
// for whatever the reason the vertices have to be reversed...
descriptors.push_back(mesh.add_face(verts[3], verts[7], verts[5], verts[1]));
descriptors.push_back(mesh.add_face(verts[6], verts[7], verts[5], verts[4]));

std::vector<CGSurfaceMesh::Face_index>::iterator idx;
// check if any of the faces was not constructed properly
if ((idx = std::find_if(descriptors.begin(), descriptors.end(), [](auto elem) {
return elem == CGSurfaceMesh::null_face();
})) != descriptors.end())
{
throw std::invalid_argument("Could not create the faces for the "
"SurfaceMesh from the pointcloud AABB! "
"First null_face index: " +
boost::lexical_cast<std::string>(idx->idx()));
throw std::invalid_argument(
"Could not create the faces for the "
"SurfaceMesh from the pointcloud AABB! "
"First null_face index: " +
std::to_string(std::distance(descriptors.begin(), idx)));
}

return mesh;
Expand Down

0 comments on commit e0ef18c

Please sign in to comment.