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
with pip
$ pip install quad_mesh_simplify
from source if distribution is not supported
Download this repository and build the package by running:
$ pip install -r requirements.txt
$ python setup.py build_ext --inplace
$ pip install .
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 Distribution
Built Distributions
Hashes for quad_mesh_simplify-1.1.1a-cp39-cp39-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1601a74ff39a222b757ba5a4ae3aa402ecb57a79a9b87ed73787d9e4a2473cf3 |
|
MD5 | a41dd83cc1c7adcb293c5b4a18052c35 |
|
BLAKE2b-256 | 6ccd36d48f1d857fa072bf3fa724387ed9bac55928b12eee02506042a8c480c4 |
Hashes for quad_mesh_simplify-1.1.1a-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c1a2164db0c96fdd1d3823bdf014ba4655504d491497dc9ac54c00a8572f6107 |
|
MD5 | 312d34e50c2e1879dd0ff19372edab15 |
|
BLAKE2b-256 | 6e62f4d4d35461f6a28e96192ba2a94c81216dda248754ae2ca2f49d61717141 |
Hashes for quad_mesh_simplify-1.1.1a-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb50d833a04cebd031638334eb6407ed4e872d999957e3271ca386f7319304ca |
|
MD5 | 22d2bfd2cec9bd8fe131b8af81e900ae |
|
BLAKE2b-256 | b667db0d559c1e7c6c5d3a49f18cd2f23a200d853e0d59276dcd96e2baf7c3ee |
Hashes for quad_mesh_simplify-1.1.1a-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 63362759b3eb235f6946f045d19fc5677cc4f5504ac4faf4847dd35d318e57c3 |
|
MD5 | 745d4ea5b0596af968b228809e20ce7a |
|
BLAKE2b-256 | 130494c4c8ecb89d764b8e07be75f98616f602dba0221e4419d4851256219269 |
Hashes for quad_mesh_simplify-1.1.1-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 16f20087750c824eead2807ee740dc08e4db410d7be722701697913777ce02f9 |
|
MD5 | 339926935eaba504ee77cc4fad107247 |
|
BLAKE2b-256 | 49f1a3d0f39addcfa596aa0c31d4d778ab898370bc4e00e86ca4578f746ccb43 |