A python wrapper around a subset of the ncollide rust library
Project description
========= ncollpyde
.. image:: https://img.shields.io/pypi/pyversions/ncollpyde.svg :target: https://pypi.python.org/pypi/ncollpyde
.. image:: https://img.shields.io/pypi/v/ncollpyde.svg :target: https://pypi.python.org/pypi/ncollpyde
.. image:: https://img.shields.io/travis/clbarnes/ncollpyde.svg :target: https://travis-ci.org/clbarnes/ncollpyde
.. image:: https://readthedocs.org/projects/ncollpyde/badge/?version=latest :target: https://ncollpyde.readthedocs.io/en/latest/?badge=latest :alt: Documentation Status
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg :target: https://github.com/ambv/black
A python wrapper around a subset of the ncollide rust library
- Free software: MIT License
- Documentation: https://ncollpyde.readthedocs.io.
Features
- Checking whether points are inside a volume defined by a triangular mesh
Usage
.. code-block:: python
# get an array of vertices and triangles which refer to those points
import meshio
mesh = meshio.read("tests/teapot.stl")
vertices = mesh.points
triangles = mesh.cells["triangle"]
# use this library
from ncollpyde import Volume
volume = Volume(vertices, triangles)
Containment checks:
.. code-block:: python
# individual points (as 3-length array-likes) can be checked with `in`
assert [-2.3051376, -4.1556454, 1.9047838] in volume
assert [-0.35222054, -0.513299, 7.6191354] not in volume
# many points (as an Nx3 array-like) can be checked with the `contains` method
bools = volume.contains(np.array([
[-2.3051376, -4.1556454, 1.9047838],
[-0.35222054, -0.513299, 7.6191354],
]))
assert np.array_equal(bools, [True, False])
# checks can be parallelised
volume.contains(np.random.random((1000, 3)), threads=4)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for ncollpyde-0.3.0-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9f4786d517a174a27e64bafcfcb04b76f71518be111ee24ffb8016a1abfc7132 |
|
MD5 | 2bfe695c197fad58eb3e11589e3dc46f |
|
BLAKE2b-256 | ad3901e817fe13f8aa38ec83a27c7c644cfe8399fef01d3beed7767e4543958f |
Hashes for ncollpyde-0.3.0-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0451865fb78ca4866e6163c525f561550e3760c3add09d3e9ed0ce79d5fa6ce5 |
|
MD5 | 28d1b5ccb0cc6c10b2ac5fc92b1de98d |
|
BLAKE2b-256 | d932679ba5477a5b55060d496bc661cab83bd837db2a5f9992a2242e3a313575 |