Utilities to slice 3D triangular meshes.
Project description
A python library to compute the planar cross-section of a 3D mesh.
Given a 3D mesh and a cut plane, this computes a (set of) polyline(s) that results from cutting the mesh with the plane.
Requires python and numpy. Mayavi is used for visualisation in the examples.
Usage
Run the examples with
python3 examples/0_cross_section.py
Given
In [17]: verts Out[17]: array([[ 1.6315 , -0.1505 , 0. ], [ 1.6376 , -0.1516 , 0. ], [ 1.6493 , -0.1518 , 0. ], ..., [ 1.62088 , -0.0263264, -0.0716966], [ 1.63381 , -0.0500889, 0.0726852], [ 1.63381 , -0.0500889, -0.0726852]]) In [20]: faces Out[20]: array([[1530, 1337, 1338], [4549, 4725, 4548], [2940, 2950, 3787], ..., [3107, 3438, 3439], [2263, 2281, 2262], [3116, 3119, 4171]]) In [21]: meshcut.cross_section(verts, faces, plane_orig=(1.2, -0.125, 0), ....: plane_normal=(1, 0, 0)) Out[21]: [array([[ 1.20000000e+00, -1.28957692e-01, -1.02180769e-01], [ 1.20000000e+00, -1.37182869e-01, -8.06541833e-02], [ 1.20000000e+00, -1.36863816e-01, -6.95125000e-02],
Thanks
Thanks to @superzanti for the STL use case and the sphere model.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
meshcut-0.3.0.tar.gz
(6.9 kB
view details)
Built Distribution
File details
Details for the file meshcut-0.3.0.tar.gz
.
File metadata
- Download URL: meshcut-0.3.0.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c07b5ceac38ecd13987cf20aadc099dcfcf7103856ddff7cfd87fa9f05057f21 |
|
MD5 | fc98225d2a9b0e3f611b38bca0e45bf1 |
|
BLAKE2b-256 | 1d315e38fa16d2f305fbcaff40dac1cd1f6a218b550488ba1abae438bbbb7522 |
File details
Details for the file meshcut-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: meshcut-0.3.0-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9134fdffb6e635cfbfd6bc9f59c8b456f4492f68b6b1431dfc37f9a5ca986dc |
|
MD5 | 5192dd093e3851f4ebcf191cb3ab4914 |
|
BLAKE2b-256 | 783099713e13e6b0fc69e82ff546ea67028224083ed66410ca026f54919262b2 |