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 hashes)

Uploaded Python 3

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