Closed Louis-Pujol closed 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.
Thanks for your work. v0.1.1
should be out on PyPI shortly. When you get a chance, please verify the built library.
Thanks, I've tested it on Ubuntu with python 3.8 to 3.11 and it worked well.
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.
vector<vector <int>>
) is created and when a collapse occurs in the function simplify_mesh it is updated withcollapses.push_back(std::vector<int>({i0,i1}));
get_collapses()
andreturn_collapses()
functions are defined in the same way asget_points()
,get_triangles()
,return_points()
,return_triangles()
simplify()
, I have added an argumentreturn_collapses
(default toFalse
). Ifreturn_collapses
is True, then the output of simplify is (points, triangles, collapses) instead of (points, triangles). Insimplify_mesh()
, I added collapse as a field data of the output meshAll 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 fileDo 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,