Skip to main content

A simple Python package for hole filling in triangle meshes.

Project description

HoleFillingPy

A dirty implementation of mesh hole filling with libigl.

Installation

pip install hole-filling

Usage

Simply fill all holes.

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.

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

hole_filling-1.0.0-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file hole_filling-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for hole_filling-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4edcbd5a24fc806270fcdeb4b3de395c931acc131ee99d74a4f8048b54781b15
MD5 24a0dbb69dfe10110d82daba1135eba0
BLAKE2b-256 904ed34a922461b7ddec8c23ce02b05dabda417bc53118e8853636625918c34f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page