[![trimesh](https://trimsh.org/images/logotype-a.svg)](http://trimsh.org)
-----------
[![Build Status](https://travis-ci.org/mikedh/trimesh.svg?branch=master)](https://travis-ci.org/mikedh/trimesh) [![Build status](https://ci.appveyor.com/api/projects/status/j8h3luwvst1tkghl?svg=true)](https://ci.appveyor.com/project/mikedh/trimesh) [![Coverage Status](https://coveralls.io/repos/github/mikedh/trimesh/badge.svg)](https://coveralls.io/github/mikedh/trimesh) [![PyPI version](https://badge.fury.io/py/trimesh.svg)](https://badge.fury.io/py/trimesh) [![Join the chat at https://gitter.im/trimsh/Lobby](https://badges.gitter.im/trimsh/Lobby.svg)](https://gitter.im/trimsh/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
Trimesh is a pure Python (2.7- 3.3+) library for loading and using [triangular meshes](https://en.wikipedia.org/wiki/Triangle_mesh) with an emphasis on single- body watertight surfaces. The goal of the library is to provide a full featured and well tested Trimesh object which allows for easy manipulation and analysis, in the style of the Polygon object in the [Shapely library](http://toblerity.org/shapely/manual.html).
The API is mostly stable, but this should not be relied on and is not guaranteed; install a specific version if you plan on deploying something using trimesh as a backend.
Pull requests are appreciated and responded to promptly! If you'd like to contribute, here is an [up to date list of potential enhancements](https://github.com/mikedh/trimesh/issues/199) although things not on that list are also welcome. Some [general advice for writing mesh code in Python and Numpy.](https://github.com/mikedh/trimesh/blob/master/trimesh/io/README.md)
## Basic Installation
The minimal requirements to import trimesh are
[numpy](http://www.numpy.org/), [scipy](http://www.scipy.org) and
[networkx](https://networkx.github.io). Installing other packages mentioned adds functionality but is **not required**.
For the easiest install with only these minimal dependencies:
```bash
pip install trimesh
```
For more functionality, like faster ray queries (`pyembree`), vector path handling (`shapely` and `rtree`), preview windows (`pyglet`), faster cache checks (`xxhash`) and more, the easiest way to get a full `trimesh` install is a [conda environment](https://conda.io/miniconda.html):
```bash
# this will install all soft dependencies available on your current platform
conda install -c conda-forge trimesh
```
Further information is available in the [advanced installation documentation](https://trimsh.org/install.html).
## Quick Start
Here is an example of loading a mesh from file and colorizing its faces. Here is a nicely formatted
[ipython notebook version](https://trimsh.org/examples/quick_start.html) of this example. Also check out the [cross section example](https://trimsh.org/examples/section.html) or possibly the [integration of a function over a mesh example](https://github.com/mikedh/trimesh/blob/master/examples/integrate.ipynb).
```python
import numpy as np
import trimesh
# attach to logger so trimesh messages will be printed to console
trimesh.util.attach_to_log()
# load a file by name or from a buffer
mesh = trimesh.load('../models/featuretype.STL')
# is the current mesh watertight?
mesh.is_watertight
# what's the euler number for the mesh?
mesh.euler_number
# the convex hull is another Trimesh object that is available as a property
# lets compare the volume of our mesh with the volume of its convex hull
print(mesh.volume / mesh.convex_hull.volume)
# since the mesh is watertight, it means there is a
# volumetric center of mass which we can set as the origin for our mesh
mesh.vertices -= mesh.center_mass
# what's the moment of inertia for the mesh?
mesh.moment_inertia
# if there are multiple bodies in the mesh we can split the mesh by
# connected components of face adjacency
# since this example mesh is a single watertight body we get a list of one mesh
mesh.split()
# facets are groups of coplanar adjacent faces
# set each facet to a random color
# colors are 8 bit RGBA by default (n,4) np.uint8
for facet in mesh.facets:
mesh.visual.face_colors[facet] = trimesh.visual.random_color()
# preview mesh in an opengl window if you installed pyglet with pip
mesh.show()
# transform method can be passed a (4,4) matrix and will cleanly apply the transform
mesh.apply_transform(trimesh.transformations.random_rotation_matrix())
# axis aligned bounding box is available
mesh.bounding_box.extents
# a minimum volume oriented bounding box also available
# primitives are subclasses of Trimesh objects which automatically generate
# faces and vertices from data stored in the 'primitive' attribute
mesh.bounding_box_oriented.primitive.extents
mesh.bounding_box_oriented.primitive.transform
# show the mesh appended with its oriented bounding box
# the bounding box is a trimesh.primitives.Box object, which subclasses
# Trimesh and lazily evaluates to fill in vertices and faces when requested
# (press w in viewer to see triangles)
(mesh + mesh.bounding_box_oriented).show()
# bounding spheres and bounding cylinders of meshes are also
# available, and will be the minimum volume version of each
# except in certain degenerate cases, where they will be no worse
# than a least squares fit version of the primitive.
print(mesh.bounding_box_oriented.volume,
mesh.bounding_cylinder.volume,
mesh.bounding_sphere.volume)
```
## Features
* Import meshes from binary/ASCII STL, Wavefront OBJ, ASCII OFF, binary/ASCII PLY, GLTF/GLB 2.0, 3MF, XAML, 3DXML, etc.
* Import and export 2D or 3D vector paths from/to DXF or SVG files
* Export meshes as binary STL, binary PLY, ASCII OFF, GLTF/GLB 2.0, COLLADA, dictionaries, JSON- serializable dictionaries (base64 encoded arrays), MSGPACK- serializable dictionaries (binary string arrays)
* Preview meshes using pyglet
* Preview meshes in- line in jupyter notebooks using three.js
* Automatic hashing of numpy arrays for change tracking (MD5, zlib CRC, and xxhash)
* Internal caching of computed values validated using numpy hashes
* Fast loading of binary files through importers written by defining custom numpy dtypes
* Calculate things like face adjacencies, face angles, vertex defects, etc.
* Calculate cross sections (IE the slicing operation used in 3D printing)
* Split mesh based on face connectivity using networkx, graph-tool, or scipy.sparse
* Calculate mass properties, including volume, center of mass, moment of inertia, and principal components of inertia
* Fix triangle winding and normals to be consistent
* Find convex hulls of meshes
* Compute a rotation/translation/tessellation invariant identifier for meshes
* Determine duplicate meshes from identifier
* Determine if a mesh is watertight, convex, etc.
* Repair single triangle and single quad holes
* Uniformly sample the surface of a mesh
* Ray-mesh queries including location, triangle id, etc.
* Boolean operations on meshes (intersection, union, difference) using OpenSCAD or Blender as backend
* Voxelize watertight meshes
* Subdivide faces of a mesh
* Minimum volume oriented bounding boxes for meshes
* Minimum volume bounding sphere / n-spheres
* Symbolic integration of function(x,y,z) over a triangle
* Calculate nearest point on mesh surface and signed distance
* Determine if a point lies inside or outside of a mesh using signed distance
* Create primitive objects (Box, Cylinder, Sphere, Extrusion) which are subclassed Trimesh objects and have all the same features (inertia, viewers, etc)
* Simple scene graph and transform tree which can be rendered (pyglet window or three.js in a jupyter notebook) or exported.
* Numerous utility functions, such as transforming points, unitizing vectors, tracking arrays for changes, grouping rows, etc.
## Viewer
Trimesh includes an optional pyglet- based viewer for debugging/inspecting. In the mesh view window:
* dragging rotates the view
* ctl + drag pans
* mouse wheel zooms
没有合适的资源?快使用搜索试试~ 我知道了~
PyPI 官网下载 | trimesh-2.35.39.tar.gz
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 158 浏览量
2022-01-17
03:07:00
上传
评论
收藏 275KB GZ 举报
温馨提示
共105个文件
py:87个
template:7个
txt:4个
资源来自pypi官网。 资源全名:trimesh-2.35.39.tar.gz
资源推荐
资源详情
资源评论
收起资源包目录
PyPI 官网下载 | trimesh-2.35.39.tar.gz (105个子文件)
setup.cfg 38B
MANIFEST.in 37B
units_to_inches.json 1KB
README.md 8KB
LICENSE.md 1KB
PKG-INFO 10KB
PKG-INFO 10KB
base.py 82KB
transformations.py 68KB
util.py 49KB
path.py 43KB
scene.py 31KB
dxf.py 30KB
creation.py 29KB
graph.py 27KB
voxel.py 24KB
visual.py 22KB
collision.py 21KB
gltf.py 21KB
intersections.py 20KB
primitives.py 20KB
polygons.py 19KB
grouping.py 19KB
caching.py 18KB
ply.py 18KB
triangles.py 18KB
viewer.py 18KB
proximity.py 18KB
entities.py 17KB
xml_based.py 17KB
load.py 15KB
bounds.py 14KB
transforms.py 14KB
points.py 14KB
traversal.py 14KB
simplify.py 12KB
ray_triangle.py 12KB
ray_pyembree.py 11KB
repair.py 11KB
registration.py 10KB
poses.py 10KB
packing.py 10KB
svg_io.py 9KB
wavefront.py 9KB
geometry.py 8KB
stl.py 8KB
rendering.py 7KB
threemf.py 7KB
arc.py 7KB
convex.py 6KB
comparison.py 6KB
camera.py 6KB
curvature.py 6KB
inertia.py 6KB
export.py 6KB
nsphere.py 6KB
openctm.py 6KB
urdf.py 6KB
misc.py 5KB
constants.py 5KB
ray_util.py 4KB
sample.py 4KB
misc.py 4KB
remesh.py 4KB
permutate.py 4KB
load.py 4KB
curve.py 4KB
segments.py 4KB
integrate.py 4KB
units.py 4KB
parent.py 3KB
creation.py 3KB
assimp.py 3KB
setup.py 3KB
raster.py 3KB
generic.py 3KB
viewerJS.py 3KB
intersections.py 2KB
scad.py 2KB
export.py 2KB
boolean.py 2KB
util.py 2KB
blender.py 2KB
vhacd.py 1KB
__init__.py 1KB
decomposition.py 901B
__init__.py 573B
__init__.py 271B
__init__.py 183B
__init__.py 124B
__init__.py 105B
version.py 24B
__init__.py 0B
__init__.py 0B
viewer.html.template 66KB
dxf.json.template 13KB
collada.dae.template 4KB
yafaray.xml.template 3KB
blender.py.template 1KB
ply.template 479B
共 105 条
- 1
- 2
资源评论
挣扎的蓝藻
- 粉丝: 13w+
- 资源: 15万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- Scopus Document Download Manager 插件
- 49065784447654二&驴(推荐).apk
- 探索微软新VLM Phi-3 Vision模型:详细分析与代码示例
- 前端开发美信射频前端开发板开发资料美信射频前端开发板开发资料
- 【mysql开发】使用ssm框架+mysql开发,这是一个J2ee项目
- 图像处理MATLAB图像处理,matlab图像处理的基本程序
- 专题讲解:信噪比和噪声系数
- 【matlab仿真】MATLAB入门仿真材料 MATLAB入门仿真材料
- Buffer of Thoughts: Thought-Augmented Reasoning with Large Langu
- 易语言抢购源码,京东抢购助手源码+模块打包
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功