I've been getting -1 everytime when I do this (just to test):
//get old face info
var faceCirculator = pMesh.Halfedges.GetFaceCirculator(pMesh.Faces[id].FirstHalfedge);
var faceVerts = new List<int>();
foreach (var idx in faceCirculator)
{
faceVerts.Add(pMesh.Halfedges[idx].StartVertex);
}
//delete old face
pMesh.Faces.RemoveFace(id);
//pMesh.Compact();
var res = pMesh.Faces.AddFace(faceVerts);
The error is thrown in here in the AddFace method:
// Check vertices
foreach (int i in array)
{
// Check that all vertex indices exist in this mesh
if (i < 0 || i >= vs.Count)
throw new IndexOutOfRangeException("No vertex exists at this index.");
// Check that all vertices are on a boundary
int outgoing = vs[i].OutgoingHalfedge;
if (outgoing != -1 && hs[outgoing].AdjacentFace != -1)
return -1;
}
Am I using the methods incorrectly? Shouldn't removing a face create a boundary region (i.e. update the half edges)?
I noticed this too. I think its because this check is looking at only a single half edge used by a given vertex, instead of checking ALL half edges used by that vertex.
I've been getting -1 everytime when I do this (just to test):
The error is thrown in here in the AddFace method:
Am I using the methods incorrectly? Shouldn't removing a face create a boundary region (i.e. update the half edges)?