Skip to main content

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

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

quad_mesh_simplify-1.1.5-cp310-cp310-win_amd64.whl (26.7 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

quad_mesh_simplify-1.1.5-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (128.4 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.12+ x86-64 manylinux: glibc 2.5+ x86-64

quad_mesh_simplify-1.1.5-cp310-cp310-macosx_10_9_x86_64.whl (33.3 kB view hashes)

Uploaded CPython 3.10 macOS 10.9+ x86-64

quad_mesh_simplify-1.1.5-cp39-cp39-win_amd64.whl (27.4 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

quad_mesh_simplify-1.1.5-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (131.9 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64 manylinux: glibc 2.5+ x86-64

quad_mesh_simplify-1.1.5-cp39-cp39-macosx_10_9_x86_64.whl (31.6 kB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

quad_mesh_simplify-1.1.5-cp38-cp38-win_amd64.whl (27.5 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

quad_mesh_simplify-1.1.5-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (143.9 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64 manylinux: glibc 2.5+ x86-64

quad_mesh_simplify-1.1.5-cp38-cp38-macosx_10_9_x86_64.whl (34.7 kB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

quad_mesh_simplify-1.1.5-cp37-cp37m-win_amd64.whl (27.2 kB view hashes)

Uploaded CPython 3.7m Windows x86-64

quad_mesh_simplify-1.1.5-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (129.6 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.12+ x86-64 manylinux: glibc 2.5+ x86-64

quad_mesh_simplify-1.1.5-cp37-cp37m-macosx_10_9_x86_64.whl (34.5 kB view hashes)

Uploaded CPython 3.7m macOS 10.9+ x86-64

quad_mesh_simplify-1.1.5-cp36-cp36m-win_amd64.whl (29.4 kB view hashes)

Uploaded CPython 3.6m Windows x86-64

quad_mesh_simplify-1.1.5-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (128.6 kB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.12+ x86-64 manylinux: glibc 2.5+ x86-64

quad_mesh_simplify-1.1.5-cp36-cp36m-macosx_10_9_x86_64.whl (34.4 kB view hashes)

Uploaded CPython 3.6m macOS 10.9+ x86-64

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