Skip to main content

一种通用的基于半边的数据结构,用于表示和操作多边形网格

项目描述

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

从源头构建

  1. 递归克隆 repo
  2. cd回购目录
  3. 确保激活了正确的 virtualenv
  4. pip install -e .

项目详情


下载文件

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

源分布

openmesh-1.2.1.tar.gz (9.3 MB 查看哈希

已上传 source

内置发行版

openmesh-1.2.1-cp39-cp39-win_amd64.whl (590.9 kB 查看哈希

已上传 cp39

openmesh-1.2.1-cp39-cp39-manylinux1_x86_64.whl (844.0 kB 查看哈希

已上传 cp39

openmesh-1.2.1-cp39-cp39-macosx_12_0_arm64.whl (660.0 kB 查看哈希

已上传 cp39

openmesh-1.2.1-cp39-cp39-macosx_10_13_x86_64.whl (768.5 kB 查看哈希

已上传 cp39