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://github.com/clbarnes/ncollpyde/workflows/.github/workflows/ci.yml/badge.svg?branch=master :target: https://github.com/clbarnes/ncollpyde/workflows/.github/workflows/ci.yml
.. 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)
Known issues
- Benchmarks suggest that multithreaded performance is about the same as serial
- Very rare false positives for containment
- Due to a
bug in the underlying library <https://github.com/rustsim/ncollide/issues/335>
_ - Only happens when the point is outside the mesh and fires a ray which touches a single edge or vertex of the mesh.
- Due to a
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.8.9-cp38-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | be3b3ac71c0bdf4cf787d39302c2c6143edc6748e32e61fc8ad446fe723fd131 |
|
MD5 | 46b417c292529d2c5bf79c2ab22776fe |
|
BLAKE2b-256 | 0264b57b84d879c6378edafd1ccc6731798c4296a23319ed455c11f6f4d74db9 |
Hashes for ncollpyde-0.8.9-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac0b4ab1ef237d5bb4ce1d94ee15a7f65bdbd80338677e54aa9fc2617c5c9155 |
|
MD5 | f24117c964580e87112789717935ee82 |
|
BLAKE2b-256 | aa0160574630a9422052f607d66e544d602a9bd197189cf191464d23101d7cd2 |
Hashes for ncollpyde-0.8.9-cp38-cp38-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd67be8f631d127e02a9b579a4746f2c59f6c412e6b459ce01480bb84c03ff8a |
|
MD5 | f8100036613034fd7943163599ca295f |
|
BLAKE2b-256 | e6bd66a504e6e1d7c8b7d8a7b32832041d6f087a84c8686971cab8bf054f09c6 |
Hashes for ncollpyde-0.8.9-cp37-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 585281998388216d1e12a6861b382aee02e4e386a584e4419907a4bd1cb80290 |
|
MD5 | 046c502cb28020b4ce4491fc6bff56ba |
|
BLAKE2b-256 | 92440ff698cb12b1dca6e661432b099caadf3081508f218b83bc517ed1f5652b |
Hashes for ncollpyde-0.8.9-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9a34e4520efd2ad61649d44bb4e926da8d2f21156239a6671644ecb70f1965d |
|
MD5 | a6f031acdc5bfc797f90e6706f4b0dc0 |
|
BLAKE2b-256 | 8331a49ed080b5ed1c9a19c7f2f6291a2551912ccba73787b90490b2e150c0c1 |
Hashes for ncollpyde-0.8.9-cp37-cp37m-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 46a2cd0ea247972934aaa5af6a5cc4f581a942f72ea68dad38bda40f67e4d3cf |
|
MD5 | 8616b8e729efa6208f569b5fa95df420 |
|
BLAKE2b-256 | 674f575cfef740b13b556705981a4545446159bed74a499b56a61aad5ce0adf1 |