pyvista / fast-simplification

Fast Quadratic Mesh Simplification
https://pyvista.github.io/fast-simplification/
MIT License
108 stars 15 forks source link

Keeping track of the history of edge's collapses #5

Closed Louis-Pujol closed 1 year ago

Louis-Pujol commented 1 year ago

Hello,

First of all thank you for this very nice python wrapper of fqmr. For one of my projects, I need to decimate triangular meshes and keep the history of the successive collapses. This can help for various tasks :

I created a fork of this repository here to implement a version of simplification with collapses recording. I modified the code of fast_simplification in order to be able to access the collapses history, encoded as a (n_collapses, 2) integer array. If collapses[j] = [i0, i1], it means that the (j+1)th collapses edge was (i0, i1) with the convention that the index of the point resulting from the collapse is i0.

All the tests previously defined still pass and I added two tests to check that input.n_points - n_collapses = output.n_points in a separate test file

Do you think this could be pertinent to merge these modifications to fast_simplification ?

Having access to collapses is a first step for the tasks I mentioned above. I am working on implementing these based on the (points, triangles, collapses) information in another repository (it is a draft for the moment). Maybe it could be of interest to also add these to fast-simplification in the future ?

Thank you,

akaszynski commented 1 year ago

I'd welcome these changes. If you'd like, please submit a PR with the changes and I'll be sure to review it.

akaszynski commented 1 year ago

Thanks for your work. v0.1.1 should be out on PyPI shortly. When you get a chance, please verify the built library.

Louis-Pujol commented 1 year ago

Thanks, I've tested it on Ubuntu with python 3.8 to 3.11 and it worked well.