Bug fixed in the definition of the PerVertexAttribute "indexInput"

This commit is contained in:
Gianpaolo Palma 2015-10-21 15:57:54 +00:00
parent fd2bfa9f64
commit 6cf0410a6f
1 changed files with 8 additions and 7 deletions

View File

@ -57,7 +57,7 @@ private:
// Initialize the convex hull with the biggest tetraedron created using the vertices of the input mesh
static void InitConvexHull(InputMesh& mesh, CHMesh& convexHull)
{
typename CHMesh:: template PerVertexAttributeHandle<int> indexInputVertex = Allocator<InputMesh>::template GetPerVertexAttribute<int>(mesh, std::string("indexInput"));
typename CHMesh:: template PerVertexAttributeHandle<size_t> indexInputVertex = Allocator<InputMesh>::template GetPerVertexAttribute<size_t>(convexHull, std::string("indexInput"));
InputVertexPointer v[3];
//Find the 6 points with min/max coordinate values
InputVertexIterator vi = mesh.vert.begin();
@ -109,7 +109,7 @@ private:
for (int i = 0; i < 3; i++)
{
(*chVi).P().Import(v[i]->P());
indexInputVertex[chVi] = vcg::tri::Index(mesh, v[i]);
indexInputVertex[chVi] = 0;
chVi++;
}
CHFaceIterator fi = vcg::tri::Allocator<CHMesh>::AddFace(convexHull, 0, 1, 2);
@ -169,7 +169,7 @@ public:
vcg::tri::RequireFFAdjacency(convexHull);
vcg::tri::RequirePerFaceNormal(convexHull);
vcg::tri::Allocator<InputMesh>::CompactVertexVector(mesh);
typename CHMesh:: template PerVertexAttributeHandle<int> indexInputVertex = Allocator<InputMesh>::template GetPerVertexAttribute<int>(mesh, std::string("indexInput"));
typename CHMesh:: template PerVertexAttributeHandle<size_t> indexInputVertex = Allocator<InputMesh>::template GetPerVertexAttribute<size_t>(convexHull, std::string("indexInput"));
if (mesh.vert.size() < 4)
return false;
InitConvexHull(mesh, convexHull);
@ -322,6 +322,7 @@ public:
}
}
}
tri::UpdateTopology<CHMesh>::ClearFaceFace(convexHull);
vcg::tri::Allocator<CHMesh>::CompactFaceVector(convexHull);
vcg::tri::Clean<CHMesh>::RemoveUnreferencedVertex(convexHull);