Name | pyfqmr-withuvs JSON |
Version |
0.2.1
JSON |
| download |
home_page | https://github.com/t-montes/pyfqmr |
Summary | cython wrapper around C++ library for fast triangular mesh reduction |
upload_time | 2024-08-26 05:27:26 |
maintainer | None |
docs_url | None |
author | kramer84 |
requires_python | None |
license | MIT |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
pyfqmr : Python Fast Quadric Mesh Reduction
===========================================
Cython wrapper around `sp4acerat's quadrics mesh reduction
algorithm <https://github.com/sp4cerat/Fast-Quadric-Mesh-Simplification>`__.
Requirements:
~~~~~~~~~~~~~
- *Numpy*
- *Cython* (only for compilation, but not needed if installed from PyPI)
Installation :
~~~~~~~~~~~~~~
pyfqmr can be installed via `pip <https://pypi.org/project/pyfqmr/0.1.1/>`_ :
.. code:: bash
pip install pyfqmr
Compilation :
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Run:
.. code:: bash
python setup.py install
Usage:
~~~~~~
.. code:: python
>>> #We assume you have a numpy based mesh processing software
>>> #Where you can get the vertices and faces of the mesh as numpy arrays.
>>> #For example Trimesh or meshio
>>> import pyfqmr
>>> import trimesh as tr
>>> bunny = tr.load_mesh('example/Stanford_Bunny_sample.stl')
>>> #Simplify object
>>> mesh_simplifier = pyfqmr.Simplify()
>>> mesh_simplifier.setMesh(bunny.vertices, bunny.faces)
>>> mesh_simplifier.simplify_mesh(target_count = 1000, aggressiveness=7, preserve_border=True, verbose=10)
iteration 0 - triangles 112402 threshold 2.187e-06
iteration 5 - triangles 62674 threshold 0.00209715
iteration 10 - triangles 21518 threshold 0.0627485
iteration 15 - triangles 9086 threshold 0.61222
iteration 20 - triangles 4692 threshold 3.40483
iteration 25 - triangles 2796 threshold 13.4929
iteration 30 - triangles 1812 threshold 42.6184
iteration 35 - triangles 1262 threshold 114.416
simplified mesh in 0.2518 seconds
>>> vertices, faces, normals = mesh_simplifier.getMesh()
Controlling the reduction algorithm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Parameters of the '''simplify\_mesh''' method that can be tuned.
- **target\_count**
Target number of triangles.
- **update\_rate**
Number of iterations between each update.
- **max\_iterations**
Maximal number of iterations
- **aggressiveness**
Parameter controlling the growth rate of the threshold at each iteration when lossless is False.
- **preserve\_border**
Flag for preserving the vertices situated on open borders. Applies the method described in `this issue <https://github.com/sp4cerat/Fast-Quadric-Mesh-Simplification/issues/14>`__.
- **alpha**
Parameter for controlling the threshold growth. Exact implication described below.
- **K**
Parameter for controlling the threshold growth. Exact implication described below.
- **lossless**
Flag for using the lossless simplification method. Sets the update rate to 1 .
- **threshold\_lossless**
Maximal error after which a vertex is not deleted, only when the lossless flag is set to True.
- **verbose**
Controls verbosity
Implications of the parameters of the threshold growth rate (when not in lossless mode) :
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
$$threshold = alpha \* (iteration + K)^{agressiveness}$$
\
More information is to be found on Sp4cerat's repository : `Fast-Quadric-Mesh-Simplification <https://github.com/sp4cerat/Fast-Quadric-Mesh-Simplification>`__
Huge thanks to Sp4cerat for making his code available!
Raw data
{
"_id": null,
"home_page": "https://github.com/t-montes/pyfqmr",
"name": "pyfqmr-withuvs",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": null,
"author": "kramer84",
"author_email": null,
"download_url": null,
"platform": null,
"description": "pyfqmr : Python Fast Quadric Mesh Reduction\r\n===========================================\r\n\r\nCython wrapper around `sp4acerat's quadrics mesh reduction\r\nalgorithm <https://github.com/sp4cerat/Fast-Quadric-Mesh-Simplification>`__.\r\n\r\nRequirements:\r\n~~~~~~~~~~~~~\r\n\r\n- *Numpy*\r\n- *Cython* (only for compilation, but not needed if installed from PyPI)\r\n\r\nInstallation :\r\n~~~~~~~~~~~~~~\r\npyfqmr can be installed via `pip <https://pypi.org/project/pyfqmr/0.1.1/>`_ :\r\n\r\n\r\n.. code:: bash\r\n\r\n pip install pyfqmr\r\n\r\n\r\nCompilation :\r\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n\r\nRun:\r\n\r\n.. code:: bash\r\n\r\n python setup.py install\r\n\r\nUsage:\r\n~~~~~~\r\n\r\n.. code:: python\r\n\r\n >>> #We assume you have a numpy based mesh processing software\r\n >>> #Where you can get the vertices and faces of the mesh as numpy arrays.\r\n >>> #For example Trimesh or meshio\r\n >>> import pyfqmr\r\n >>> import trimesh as tr\r\n >>> bunny = tr.load_mesh('example/Stanford_Bunny_sample.stl')\r\n >>> #Simplify object\r\n >>> mesh_simplifier = pyfqmr.Simplify()\r\n >>> mesh_simplifier.setMesh(bunny.vertices, bunny.faces)\r\n >>> mesh_simplifier.simplify_mesh(target_count = 1000, aggressiveness=7, preserve_border=True, verbose=10)\r\n iteration 0 - triangles 112402 threshold 2.187e-06\r\n iteration 5 - triangles 62674 threshold 0.00209715\r\n iteration 10 - triangles 21518 threshold 0.0627485\r\n iteration 15 - triangles 9086 threshold 0.61222\r\n iteration 20 - triangles 4692 threshold 3.40483\r\n iteration 25 - triangles 2796 threshold 13.4929\r\n iteration 30 - triangles 1812 threshold 42.6184\r\n iteration 35 - triangles 1262 threshold 114.416\r\n simplified mesh in 0.2518 seconds \r\n >>> vertices, faces, normals = mesh_simplifier.getMesh()\r\n\r\nControlling the reduction algorithm\r\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n\r\nParameters of the '''simplify\\_mesh''' method that can be tuned.\r\n\r\n- **target\\_count**\r\n Target number of triangles.\r\n- **update\\_rate**\r\n Number of iterations between each update.\r\n- **max\\_iterations**\r\n Maximal number of iterations\r\n- **aggressiveness**\r\n Parameter controlling the growth rate of the threshold at each iteration when lossless is False.\r\n- **preserve\\_border**\r\n Flag for preserving the vertices situated on open borders. Applies the method described in `this issue <https://github.com/sp4cerat/Fast-Quadric-Mesh-Simplification/issues/14>`__.\r\n- **alpha**\r\n Parameter for controlling the threshold growth. Exact implication described below.\r\n- **K**\r\n Parameter for controlling the threshold growth. Exact implication described below.\r\n- **lossless**\r\n Flag for using the lossless simplification method. Sets the update rate to 1 .\r\n- **threshold\\_lossless**\r\n Maximal error after which a vertex is not deleted, only when the lossless flag is set to True.\r\n- **verbose**\r\n Controls verbosity\r\n\r\nImplications of the parameters of the threshold growth rate (when not in lossless mode) :\r\n'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''\r\n$$threshold = alpha \\* (iteration + K)^{agressiveness}$$\r\n\r\n\\\r\n\r\nMore information is to be found on Sp4cerat's repository : `Fast-Quadric-Mesh-Simplification <https://github.com/sp4cerat/Fast-Quadric-Mesh-Simplification>`__\r\n\r\nHuge thanks to Sp4cerat for making his code available!\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "cython wrapper around C++ library for fast triangular mesh reduction",
"version": "0.2.1",
"project_urls": {
"Homepage": "https://github.com/t-montes/pyfqmr"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a851b78d5914ad2d8178ef83d7ecc54c05eb511d07042ab9d19516aa9e822d6a",
"md5": "ac45675b5d8e94df6966dc7a613fed74",
"sha256": "83fb989b6d73ce8d4c1efa09ae26f7465181a5a1c50f0732d975c767e0c4a137"
},
"downloads": -1,
"filename": "pyfqmr_withuvs-0.2.1-cp312-cp312-win_amd64.whl",
"has_sig": false,
"md5_digest": "ac45675b5d8e94df6966dc7a613fed74",
"packagetype": "bdist_wheel",
"python_version": "cp312",
"requires_python": null,
"size": 110230,
"upload_time": "2024-08-26T05:27:26",
"upload_time_iso_8601": "2024-08-26T05:27:26.226486Z",
"url": "https://files.pythonhosted.org/packages/a8/51/b78d5914ad2d8178ef83d7ecc54c05eb511d07042ab9d19516aa9e822d6a/pyfqmr_withuvs-0.2.1-cp312-cp312-win_amd64.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-26 05:27:26",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "t-montes",
"github_project": "pyfqmr",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pyfqmr-withuvs"
}