一种通用的基于半边的数据结构,用于表示和操作多边形网格
项目描述
OpenMesh Python 绑定 (1.2.1)
OpenMesh 是一种通用的基于半边的数据结构,用于表示和操作多边形网格。OpenMesh Python 绑定与numpy紧密集成,并使用pybind11实现。
例子
import openmesh as om
import numpy as np
mesh = om.TriMesh()
# add a a couple of vertices to the mesh
vh0 = mesh.add_vertex([0, 1, 0])
vh1 = mesh.add_vertex([1, 0, 0])
vh2 = mesh.add_vertex([2, 1, 0])
vh3 = mesh.add_vertex([0,-1, 0])
vh4 = mesh.add_vertex([2,-1, 0])
# add a couple of faces to the mesh
fh0 = mesh.add_face(vh0, vh1, vh2)
fh1 = mesh.add_face(vh1, vh3, vh4)
fh2 = mesh.add_face(vh0, vh3, vh1)
# add another face to the mesh, this time using a list
vh_list = [vh2, vh1, vh4]
fh3 = mesh.add_face(vh_list)
# 0 ==== 2
# |\ 0 /|
# | \ / |
# |2 1 3|
# | / \ |
# |/ 1 \|
# 3 ==== 4
# get the point with vertex handle vh0
point = mesh.point(vh0)
# get all points of the mesh
point_array = mesh.points()
# translate the mesh along the x-axis
point_array += np.array([1, 0, 0])
# write and read meshes
om.write_mesh('test.off', mesh)
mesh_2 = om.read_trimesh('test.off')
有关更多示例,请参阅文档或参阅单元测试。
安装
使用pip
pip install openmesh
使用conda
感谢 Martin Drawitsch,您还可以通过 conda 安装 openmesh- python:
conda install -c conda-forge openmesh-python
从源头构建
- 递归克隆 repo
cd回购目录- 确保激活了正确的 virtualenv
pip install -e .
项目详情
下载文件
下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。
源分布
openmesh-1.2.1.tar.gz
(9.3 MB
查看哈希)
内置发行版
openmesh-1.2.1-cp39-cp39-win_amd64.whl
(590.9 kB
查看哈希)
关
openmesh -1.2.1-cp39-cp39-macosx_10_13_x86_64.whl 的哈希值
| 算法 | 哈希摘要 | |
|---|---|---|
| SHA256 | b7c99c55777cac2183e6161d2cd37723537c74ab57d6483e346931bd4dd5fff9 |
|
| MD5 | e6383ca10fb3f06d147aebd01d18ee68 |
|
| 布莱克2-256 | 0ebccbd370af575d36d821c7823dfae39dea8e9d7d88de7baf99bbf12db6e5e5 |