Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjacent Faces through Halfedge Index #50

Closed
mmedinav18 opened this issue Aug 2, 2019 · 4 comments
Closed

Adjacent Faces through Halfedge Index #50

mmedinav18 opened this issue Aug 2, 2019 · 4 comments

Comments

@mmedinav18
Copy link

Hi,

I am following one of your advices from a prevoius thread (#41) to get adjacent faces of a halfedge. The issue I am having is that while it works at times, there are times that an error comes out with the index being out of range. I dug a bit deeper and I noticed that the index value for the startVertex = -1, which is what is causing the error. I've been reading the source code to try to identify how to work around the issue, but truly don't know how to fix it. Could you please explain why the start vertex index comes out as -1?

@mmedinav18
Copy link
Author

Also, I noticed that the face index =-1. I've attached an image of the code I am working with for better understanding.
Knit Systems - Microsoft Visual Studio  8_2_2019 3_45_22 PM

@pearswj
Copy link
Contributor

pearswj commented Aug 2, 2019

-1 for PlanktonHalfedge.StartVertex sounds like a bug. Plankton should maintain the StartVertex property for you, unless you directly create/modify the halfedges yourself. How are you constructing the PlanktonMesh? Are you using PlanktonFaceList.AddFace()? AFaceIndex of -1 is normal and just means that the half edge has no adjacent face, i.e. it's on a boundary.

@mmedinav18
Copy link
Author

So what I am doing to create the Plankton mesh is basically get the vertices from a remeshed geometry. I am using geometry3dSharp library to remesh this geometry, then use the vertices to create the Plankton mesh vertices and I use planktonMesh.Faces.AddFace(a,b,c,d). The indices for the faces I've gottent them from a function from the other library. For clarification I've included what I am doing in the image below. For the faceindex of -1, I am not quite sure if that's correct since at the moment I am using a sphere, so no boundary.

Hope it makes sense.

Knit Systems - Microsoft Visual Studio  8_2_2019 4_25_55 PM

@pearswj
Copy link
Contributor

pearswj commented Dec 16, 2019

Sorry for the late reply. It looks like you're trying to quadrangulate a triangular mesh. I would try building the plankton mesh directly from the triangular faces and check that it comes through correctly.

@pearswj pearswj closed this as completed Dec 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants