Simplify meshes including vertex features.
Project description
Quadric mesh simplification
A leightweight package for simplifying a mesh containing node features. The algorithm from Surface Simplification Using Quadric Error Metrics was implemented using cython.
Installation
Download this repository and build the package by running:
$ python setup.py build_ext --inplace
Usage
This package provides one simple function to reduce a given mesh. This can be done for simple meshes or meshes with vertex features.
simplify_mesh(positions, face, num_nodes, features=None, threshold=0., max_err=np.Infinity)
positions
(numpy array): array of shape [num_nodes x 3] containing the x, y, z position for each node
face
(numpy array): array of shape [num_faces x 3] containing the indices for each triangular face
num_nodes
(int): number of nodes that the final mesh will have
threshold (number, optional): threshold of vertices distance to be a valid pair
features
(numpy array): features for all nodes [num_nodes x feature_length]
threshold
(double): if the distance between two vertices is below this threshold, they are considered as valid pairs that can be merged.
max_err
(double): no vertices are merged that have an error higher than this number. IMPORTANT: if provided it is not guaranteed that the output will have less than num_nodes vertices.
Returns: new_positions, new_face, (new_features)
Reduce a simple mesh
from quad_mesh_simplify import simplify_mesh
new_positions, new_face = simplify_mesh(positions, face, <final_num_nodes>)
Reduce a mesh with vertex features
from quad_mesh_simplify import simplify_mesh
new_positions, new_face = simplify_mesh(positions, face, <final_num_nodes>, features=features)
Reduce a mesh with a threshold for the minimal distance
from quad_mesh_simplify import simplify_mesh
new_positions, new_face = simplify_mesh(positions, face, <final_num_nodes>, threshold=0.5)
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
Built Distributions
Hashes for quad_mesh_simplify-1.1.1-cp39-cp39-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | da8b1a895b60b56996708ea68f0f7acce3afb959befa0b423d0ec277275d4205 |
|
MD5 | 41ba5a6c25884309de7aec5bc057ac52 |
|
BLAKE2b-256 | a1995b438741403cefe8621a1d27b91678ede32823ce2aca91a4eab040e3011f |
Hashes for quad_mesh_simplify-1.1.1-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf40c758d62e2c3f94f13b8722f2a5e238b05b37606d12261a6c4c7ee39324c3 |
|
MD5 | cf6a20581ae506dbfec2eb68e65a91c6 |
|
BLAKE2b-256 | 646e33948b9ee3557d22d71b75c2000de9ea493c4ac9cbf376981e38b7bb1877 |
Hashes for quad_mesh_simplify-1.1.1-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dc95026bd41a83f655ead172d070901b389db4981929de53448b6a87feb659dc |
|
MD5 | ebc2a8062a492972da2f00d810fd7a36 |
|
BLAKE2b-256 | 28e67c7162708d1dbdc8298d7151059a58e49bb0a4be78e76814ebc4b5f81c20 |
Hashes for quad_mesh_simplify-1.1.1-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a5e2c7af4e7c3e6baeb8956b0b3830d27584195eb288a2e4c22dd6c4a6ec96a8 |
|
MD5 | c14ab4ec7c1f1cdaaea159ccf9e5ccd5 |
|
BLAKE2b-256 | 28511666ae3b3dd3e70f3431d9728e2ecf9884238ac689d872f5cab5f714ad77 |