# HoleFillingPy
A dirty implementation of mesh hole filling with [libigl](https://github.com/libigl/libigl-python-bindings).
<img src="./docs/hole_filling.png" width="600">
## Installation
```bash
pip install hole-filling
```
## Usage
Simply fill all holes.
```python
import numpy as np
import igl
from hole_filling import triangulate_refine_fair
vs, fs, _ = igl.read_off("tests/examples/bunny_holes.off")
out_vs, out_fs = triangulate_refine_fair(vs, fs)
colors = np.ones((len(out_vs), 3))
colors[np.arange(len(vs), len(out_vs))] = [0, 0, 1] # added vertices are blue
igl.write_off("bunny_hole_filling.off", out_vs, out_fs, colors)
```
You can fill holes with fine controls, e.x. keeping the longest boundary.
```python
import numpy as np
import igl
from hole_filling import close_holes, triangulate_refine_fair
vs, fs, _ = igl.read_off("tests/examples/face_holes.off")
loop = igl.boundary_loop(fs)
length = np.linalg.norm(vs[loop[:-1]] - vs[loop[1:]], axis=1).sum()
# tweak the parameters to see the difference
out_vs, out_fs = triangulate_refine_fair(vs, fs, hole_len_thr=length - 0.1, density_factor=2, fair_alpha=0.5)
igl.write_off("face_hole_filling.off", out_vs, out_fs, np.ones_like(out_vs) * 0.7)
```
## Reference
1. Liepa, Peter. "Filling holes in meshes." Proceedings of the 2003 Eurographics/ACM SIGGRAPH symposium on Geometry
processing. 2003.
2. Jacobson, Alec, and Daniele Panozzo. "Libigl: Prototyping geometry processing research in c++." SIGGRAPH Asia 2017
courses. 2017. 1-172.
Raw data
{
"_id": null,
"home_page": "https://github.com/kentechx/hole-filling",
"name": "hole-filling",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "Kaidi Shen",
"author_email": "",
"download_url": "",
"platform": null,
"description": "# HoleFillingPy\n\nA dirty implementation of mesh hole filling with [libigl](https://github.com/libigl/libigl-python-bindings).\n\n<img src=\"./docs/hole_filling.png\" width=\"600\">\n\n## Installation\n\n```bash\npip install hole-filling\n```\n\n## Usage\n\nSimply fill all holes.\n\n```python\nimport numpy as np\nimport igl\nfrom hole_filling import triangulate_refine_fair\n\nvs, fs, _ = igl.read_off(\"tests/examples/bunny_holes.off\")\nout_vs, out_fs = triangulate_refine_fair(vs, fs)\n\ncolors = np.ones((len(out_vs), 3))\ncolors[np.arange(len(vs), len(out_vs))] = [0, 0, 1] # added vertices are blue\n\nigl.write_off(\"bunny_hole_filling.off\", out_vs, out_fs, colors)\n```\n\nYou can fill holes with fine controls, e.x. keeping the longest boundary.\n\n```python\nimport numpy as np\nimport igl\nfrom hole_filling import close_holes, triangulate_refine_fair\n\nvs, fs, _ = igl.read_off(\"tests/examples/face_holes.off\")\nloop = igl.boundary_loop(fs)\nlength = np.linalg.norm(vs[loop[:-1]] - vs[loop[1:]], axis=1).sum()\n# tweak the parameters to see the difference\nout_vs, out_fs = triangulate_refine_fair(vs, fs, hole_len_thr=length - 0.1, density_factor=2, fair_alpha=0.5)\nigl.write_off(\"face_hole_filling.off\", out_vs, out_fs, np.ones_like(out_vs) * 0.7)\n```\n\n## Reference\n\n1. Liepa, Peter. \"Filling holes in meshes.\" Proceedings of the 2003 Eurographics/ACM SIGGRAPH symposium on Geometry\n processing. 2003.\n2. Jacobson, Alec, and Daniele Panozzo. \"Libigl: Prototyping geometry processing research in c++.\" SIGGRAPH Asia 2017\n courses. 2017. 1-172.\n\n\n",
"bugtrack_url": null,
"license": "",
"summary": "A simple Python package for hole filling in triangle meshes.",
"version": "1.0.0",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "904ed34a922461b7ddec8c23ce02b05dabda417bc53118e8853636625918c34f",
"md5": "24a0dbb69dfe10110d82daba1135eba0",
"sha256": "4edcbd5a24fc806270fcdeb4b3de395c931acc131ee99d74a4f8048b54781b15"
},
"downloads": -1,
"filename": "hole_filling-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "24a0dbb69dfe10110d82daba1135eba0",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 5979,
"upload_time": "2023-04-08T19:56:05",
"upload_time_iso_8601": "2023-04-08T19:56:05.910655Z",
"url": "https://files.pythonhosted.org/packages/90/4e/d34a922461b7ddec8c23ce02b05dabda417bc53118e8853636625918c34f/hole_filling-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-04-08 19:56:05",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "kentechx",
"github_project": "hole-filling",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "hole-filling"
}