A python package to fill N-sided holes using combined subdivision schemes, based on Catmull-Clark subdivison.
Project description
Filler for N-sided holes
A python package to fill N-sided holes using combined subdivision schemes, based on Catmull-Clark subdivison.
See Levin, Adi. “Filling N-sided Holes Using Combined Subdivision Schemes.” (2000).
Install
Use PyPI to install subdivision-hole-filler:
pip install subdivision-hole-filler
Usage
Run the following script to fill a hole.
import numpy as np
from subdivision_hole_filler import Boundary, NsidedHoleFiller
r = 1
R = 1
boundaries = [None, None, None, None, None, None]
for d in range(3):
def coord(u: float, d=d):
phi = (1.0 - u / 2.0) * np.pi / 2.0
x = r * np.cos(phi)
y = r * np.sin(phi)
z = r + R
c = np.zeros(3)
c[d] = z
c[(d + 1) % 3] = x
c[(d + 2) % 3] = y
return c
def deriv(u: float, d=d):
vec = np.zeros(3)
vec[d] = -1
return np.array(vec)
bd = Boundary()
bd.coord = coord # A function of parametric coord `u` in [0.0, 2.0], which defines the coordinate of a point on the boundary
bd.deriv = deriv # A function of parametric coord `u` in [0.0, 2.0], which defines the cross boundary derivative of a point on the boundary, poining to the inside
boundaries[d*2] = bd
for d in range(3):
def coord(u: float, d=d):
phi = (1.0 - u / 2.0) * np.pi / 2.0
x = R + r - R * np.cos(phi)
y = R + r - R * np.sin(phi)
z = 0
c = np.zeros(3)
c[d] = z
c[(d + 1) % 3] = x
c[(d + 2) % 3] = y
return c
def deriv(u: float, d=d):
vec = np.zeros(3)
vec[d] = 1
return np.array(vec)
bd = Boundary()
bd.coord = coord # A function of parametric coord `u` in [0.0, 2.0], which defines the coordinate of a point on the boundary
bd.deriv = deriv # A function of parametric coord `u` in [0.0, 2.0], which defines the cross boundary derivative of a point on the boundary, poining to the inside
boundaries[(d + 1) % 3 * 2 + 1] = bd
filler = NsidedHoleFiller(boundaries)
center_point = np.array([r, r, r])
filler.gen_initial_mesh(center_point)
for iteration in range(3):
filler.cmc_subdiv_for_1step(iteration=iteration)
Here is the ouput.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file subdivision_hole_filler-1.0.7.tar.gz.
File metadata
- Download URL: subdivision_hole_filler-1.0.7.tar.gz
- Upload date:
- Size: 287.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
310e2de14767a11e7cc44ae6cc027f296f44a83a25ca3c3955e88290a1116f61
|
|
| MD5 |
f90346c81bb7dd139f66c4fcf08b2404
|
|
| BLAKE2b-256 |
13cb0361c37aeb54207853fb99625db7076ff427d64aec3672b53831a9d46a5e
|
Provenance
The following attestation bundles were made for subdivision_hole_filler-1.0.7.tar.gz:
Publisher:
python-publish.yml on huang-lihao/subdivision-hole-filler
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
subdivision_hole_filler-1.0.7.tar.gz -
Subject digest:
310e2de14767a11e7cc44ae6cc027f296f44a83a25ca3c3955e88290a1116f61 - Sigstore transparency entry: 152780048
- Sigstore integration time:
-
Permalink:
huang-lihao/subdivision-hole-filler@18e6081d8ab738e20766d47d05db22c1b3dc6c1b -
Branch / Tag:
refs/tags/v1.0.7 - Owner: https://github.com/huang-lihao
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@18e6081d8ab738e20766d47d05db22c1b3dc6c1b -
Trigger Event:
release
-
Statement type:
File details
Details for the file subdivision_hole_filler-1.0.7-py3-none-any.whl.
File metadata
- Download URL: subdivision_hole_filler-1.0.7-py3-none-any.whl
- Upload date:
- Size: 7.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7ca8e6359631c7702c83385fece1ea113f7e3aad2f344b44066b89063e04d991
|
|
| MD5 |
6f81e14465e8e057882df08b89e7a15b
|
|
| BLAKE2b-256 |
0484f5a6974927d9cf9153bbbd2f9cf6e64bf2dfbcd948fddde742a10911969f
|
Provenance
The following attestation bundles were made for subdivision_hole_filler-1.0.7-py3-none-any.whl:
Publisher:
python-publish.yml on huang-lihao/subdivision-hole-filler
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
subdivision_hole_filler-1.0.7-py3-none-any.whl -
Subject digest:
7ca8e6359631c7702c83385fece1ea113f7e3aad2f344b44066b89063e04d991 - Sigstore transparency entry: 152780050
- Sigstore integration time:
-
Permalink:
huang-lihao/subdivision-hole-filler@18e6081d8ab738e20766d47d05db22c1b3dc6c1b -
Branch / Tag:
refs/tags/v1.0.7 - Owner: https://github.com/huang-lihao
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@18e6081d8ab738e20766d47d05db22c1b3dc6c1b -
Trigger Event:
release
-
Statement type: