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

Remove Face - Attempted divide by 0 #42

Open
petrasvestartas opened this issue Feb 24, 2017 · 2 comments
Open

Remove Face - Attempted divide by 0 #42

petrasvestartas opened this issue Feb 24, 2017 · 2 comments
Assignees
Labels

Comments

@petrasvestartas
Copy link

Hi,

I would like to ask how to properly delete face from planktonMesh.

When I do it like this I get error for division by zero.
I just want to remove one first face from planktonMesh.

question

@pearswj pearswj added the bug label Feb 24, 2017
@pearswj pearswj self-assigned this Feb 24, 2017
@pearswj
Copy link
Contributor

pearswj commented Feb 24, 2017

I managed to reproduce the "divide by zero" error, so it looks like there's a bug...! As a workaround, if you compact the mesh after removing the face, the "divide by zero" error disappears.

Note: compacting the data structure might change all the indexing! For example, if by removing the face there are now vertices that aren't connected to anything, they will be removed and the list of vertices will shrink, changing all the vertex indices. All the other faces/halfedges will be updated to reflect the new indexing, but you might have some external code that relies on the original indexing...

PlanktonMesh pm = x.ToPlanktonMesh();
pm.Faces.RemoveFace(0);
pm.Compact(); // purges any unreferenced vertices, faces and halfedges
A = pm;

Note to self: this grasshopper definition reproduces the bug... remove_face_bug.gh.zip

@planUnd
Copy link

planUnd commented Oct 10, 2017

Same happens when mergin Faces...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants