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.
Only python versions >= 3.6 are supported
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 Distributions
Built Distributions
Hashes for quad_mesh_simplify-1.1.2-cp39-cp39-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 72251e4f9538a82565b57db25fabde444a184a0e2756f8dd16624f0ecaff0f9c |
|
MD5 | 1a901eea0d4b518cbe95616284ed7b5c |
|
BLAKE2b-256 | 86ed9a140583b3b68bf89e02bdc6b4a78c25f78b9afe6ca653ef3d51fc4b4236 |
Hashes for quad_mesh_simplify-1.1.2-cp39-cp39-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 64a5a3866f9e174f653aed2e51e91d85db523c070539d9a62e52cf44db0cc1e6 |
|
MD5 | d6b0d72e8fbaca8128c5e99d41e0b09d |
|
BLAKE2b-256 | 2877ba1fcb55c4ae4c4292b9b3ed97b614a9c20c4d1eaf35684d28afae398a0d |
Hashes for quad_mesh_simplify-1.1.2-cp38-cp38-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 548c03fddf672376180b6e0b352ccc0dbb895d5e297e165af65b8db85aa10110 |
|
MD5 | d9cc206f206b3a752adac52fa16cf10a |
|
BLAKE2b-256 | 4e9f24644722736320843711fe9987d3e1e051b16f04efd00022e6ad0d0ae05a |
Hashes for quad_mesh_simplify-1.1.2-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ec3d4a9604c0c90dd61ac4ef8aa1ecaf967457ce7d5cb8dc4232582afd9ef802 |
|
MD5 | 25267b74834f3014ba33c9abe35322d7 |
|
BLAKE2b-256 | 1a19ae6ef08837a3b1940567087ff3cc9718553fdd0e181e8bf4595276394742 |
Hashes for quad_mesh_simplify-1.1.2-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aefa8ead6b81479422cac8ada203eecd6ab7d69a12a490f92e2d57232805cf54 |
|
MD5 | 07c0f93adde3437c0bdd035716a23f40 |
|
BLAKE2b-256 | 494bb71f88346275720093dcf0039b263bf8a2ab4bca6671464b9803123e1519 |
Hashes for quad_mesh_simplify-1.1.2-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dab55be3ab287e0436faf4623ddfb821c79de3d11163932714688cd21d59825d |
|
MD5 | c8b5c790c1a26eb48e19373341c1e0c6 |
|
BLAKE2b-256 | ddc9f8f0e29108812132f97072841e24f885cef40463e5aca3b28917ed8cf720 |
Hashes for quad_mesh_simplify-1.1.2-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 56d5a85f25d1afd24e762d56330b31904b62b28fea09acbf57f4717d93336236 |
|
MD5 | 34e0f07e1c0c775977c9f7a816fef70c |
|
BLAKE2b-256 | 8a666abf83e41faccaa1c49ab9221ebef49c128a998434e8dd7b335c213618fc |
Hashes for quad_mesh_simplify-1.1.2-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7c3140d80dd7808b17cf74f07c03b51bf4246555ccecb73796938532c0312b5b |
|
MD5 | 60f95a797bc37cf15a460769c3c8d0c6 |
|
BLAKE2b-256 | d1a5a3087102aeb6c968364d59d7d2f30cf2e0ae80714152d3c0cac103afc569 |