跳转到主要内容

Cython封装C++库,用于快速三角网格简化

项目描述

Cython封装sp4cerat的二次网格简化算法

需求

  • Numpy

  • Cython(仅用于编译,但若从PyPI安装则不需要)

安装

pyfqmr可以通过pip安装

pip install pyfqmr

编译

运行

python setup.py install

用法

>>> #We assume you have a numpy based mesh processing software
>>> #Where you can get the vertices and faces of the mesh as numpy arrays.
>>> #For example Trimesh or meshio
>>> import pyfqmr
>>> import trimesh as tr
>>> bunny = tr.load_mesh('example/Stanford_Bunny_sample.stl')
>>> #Simplify object
>>> mesh_simplifier = pyfqmr.Simplify()
>>> mesh_simplifier.setMesh(bunny.vertices, bunny.faces)
>>> mesh_simplifier.simplify_mesh(target_count = 1000, aggressiveness=7, preserve_border=True, verbose=10)
iteration 0 - triangles 112402 threshold 2.187e-06
iteration 5 - triangles 62674 threshold 0.00209715
iteration 10 - triangles 21518 threshold 0.0627485
iteration 15 - triangles 9086 threshold 0.61222
iteration 20 - triangles 4692 threshold 3.40483
iteration 25 - triangles 2796 threshold 13.4929
iteration 30 - triangles 1812 threshold 42.6184
iteration 35 - triangles 1262 threshold 114.416
simplified mesh in 0.2518 seconds
>>> vertices, faces, normals = mesh_simplifier.getMesh()

控制简化算法

可以调整的'simplify_mesh'方法参数。

  • target_count

    目标三角形数量。

  • update_rate

    每次更新之间的迭代次数。

  • max_iterations

    最大迭代次数

  • aggressiveness

    控制每次迭代中阈值增长率的参数。

  • preserve_border

    保留位于开放边界的顶点的标志。应用在此问题中描述的方法。

  • alpha

    控制阈值增长的参数。确切含义如下所述。

  • K

    控制阈值增长的参数。确切含义如下所述。

  • lossless

    使用无损简化方法的标志。将更新率设置为1。

  • threshold_lossless

    如果无损标志设置为True,则顶点不会删除的最大误差。

  • verbose

    控制详细程度

阈值增长率参数的影响(非无损模式下)

$$threshold = alpha * (iteration + K)^{agressiveness}$$

更多信息请参阅Sp4cerat的仓库:Fast-Quadric-Mesh-Simplification

非常感谢Sp4cerat公开他的代码!

项目详情


下载文件

下载适合您平台的文件。如果您不确定选择哪个,请了解有关安装包的更多信息。

源代码发行版

此版本没有可用的源代码发行版文件。请参阅有关生成发行版存档的教程。

构建发行版

pyfqmr-0.2.1-cp312-cp312-win_amd64.whl (112.0 kB 查看哈希值)

上传时间 CPython 3.12 Windows x86-64

pyfqmr-0.2.1-cp312-cp312-win32.whl (96.7 kB 查看哈希值)

上传时间 CPython 3.12 Windows x86

pyfqmr-0.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (874.1 kB 查看哈希值)

上传时间 CPython 3.12 manylinux: glibc 2.17+ x86-64

pyfqmr-0.2.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (857.6 kB 查看哈希值)

上传时间 CPython 3.12 manylinux: glibc 2.17+ ARM64

pyfqmr-0.2.1-cp312-cp312-macosx_11_0_arm64.whl (127.8 kB 查看哈希值)

上传时间 CPython 3.12 macOS 11.0+ ARM64

pyfqmr-0.2.1-cp312-cp312-macosx_10_9_x86_64.whl (138.2 kB 查看哈希值)

上传时间 CPython 3.12 macOS 10.9+ x86-64

pyfqmr-0.2.1-cp311-cp311-win_amd64.whl (112.2 kB 查看哈希值)

上传时间 CPython 3.11 Windows x86-64

pyfqmr-0.2.1-cp311-cp311-win32.whl (96.7 kB 查看哈希值)

上传时间: CPython 3.11 Windows x86

pyfqmr-0.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (875.8 kB 查看哈希值)

上传时间: CPython 3.11 manylinux: glibc 2.17+ x86-64

pyfqmr-0.2.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (864.1 kB 查看哈希值)

上传时间: CPython 3.11 manylinux: glibc 2.17+ ARM64

pyfqmr-0.2.1-cp311-cp311-macosx_11_0_arm64.whl (127.1 kB 查看哈希值)

上传时间: CPython 3.11 macOS 11.0+ ARM64

pyfqmr-0.2.1-cp311-cp311-macosx_10_9_x86_64.whl (137.1 kB 查看哈希值)

上传时间: CPython 3.11 macOS 10.9+ x86-64

pyfqmr-0.2.1-cp310-cp310-win_amd64.whl (112.1 kB 查看哈希值)

上传时间: CPython 3.10 Windows x86-64

pyfqmr-0.2.1-cp310-cp310-win32.whl (97.0 kB 查看哈希值)

上传时间: CPython 3.10 Windows x86

pyfqmr-0.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (837.2 kB 查看哈希值)

上传时间: CPython 3.10 manylinux: glibc 2.17+ x86-64

pyfqmr-0.2.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (824.6 kB 查看哈希值)

上传时间: CPython 3.10 manylinux: glibc 2.17+ ARM64

pyfqmr-0.2.1-cp310-cp310-macosx_11_0_arm64.whl (127.2 kB 查看哈希值)

上传时间: CPython 3.10 macOS 11.0+ ARM64

pyfqmr-0.2.1-cp310-cp310-macosx_10_9_x86_64.whl (137.0 kB 查看哈希值)

上传于 CPython 3.10 macOS 10.9+ x86-64

pyfqmr-0.2.1-cp39-cp39-win_amd64.whl (112.7 kB 查看哈希值)

上传于 CPython 3.9 Windows x86-64

pyfqmr-0.2.1-cp39-cp39-win32.whl (97.6 kB 查看哈希值)

上传于 CPython 3.9 Windows x86

pyfqmr-0.2.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (838.8 kB 查看哈希值)

上传于 CPython 3.9 manylinux: glibc 2.17+ x86-64

pyfqmr-0.2.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (827.4 kB 查看哈希值)

上传于 CPython 3.9 manylinux: glibc 2.17+ ARM64

pyfqmr-0.2.1-cp39-cp39-macosx_11_0_arm64.whl (127.7 kB 查看哈希值)

上传于 CPython 3.9 macOS 11.0+ ARM64

pyfqmr-0.2.1-cp39-cp39-macosx_10_9_x86_64.whl (137.7 kB 查看哈希值)

上传于 CPython 3.9 macOS 10.9+ x86-64

pyfqmr-0.2.1-cp38-cp38-win_amd64.whl (112.6 kB 查看哈希值)

上传于 CPython 3.8 Windows x86-64

pyfqmr-0.2.1-cp38-cp38-win32.whl (97.2 kB 查看哈希值)

上传于 CPython 3.8 Windows x86

pyfqmr-0.2.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (846.7 kB 查看哈希值)

上传于 CPython 3.8 manylinux: glibc 2.17+ x86-64

pyfqmr-0.2.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (834.4 kB 查看哈希值)

上传于 CPython 3.8 manylinux: glibc 2.17+ ARM64

pyfqmr-0.2.1-cp38-cp38-macosx_11_0_arm64.whl (127.4 kB 查看哈希值)

上传于 CPython 3.8 macOS 11.0+ ARM64

pyfqmr-0.2.1-cp38-cp38-macosx_10_9_x86_64.whl (137.0 kB 查看哈希值)

上传于 CPython 3.8 macOS 10.9+ x86-64

pyfqmr-0.2.1-cp37-cp37m-win_amd64.whl (112.2 kB 查看哈希值)

上传于 CPython 3.7m Windows x86-64

pyfqmr-0.2.1-cp37-cp37m-win32.whl (97.0 kB 查看哈希值)

上传于 CPython 3.7m Windows x86

pyfqmr-0.2.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (808.3 kB 查看哈希值)

上传于 CPython 3.7m manylinux: glibc 2.17+ x86-64

pyfqmr-0.2.1-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (793.7 kB 查看哈希值)

上传于 CPython 3.7m manylinux: glibc 2.17+ ARM64

pyfqmr-0.2.1-cp37-cp37m-macosx_10_9_x86_64.whl (136.6 kB 查看哈希值)

上传于 CPython 3.7m macOS 10.9+ x86-64

由以下支持