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.9.0-cp38-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 051f96112a37f0d4e1674ef855406383380c022e5867d602bde956b64ec27cfc |
|
MD5 | 2fcdd57522ca644b06544c3d213a2909 |
|
BLAKE2b-256 | c4054abbf4b904930ed1b8af65001f38b381d4bd3a66e2dc134521103498091a |
Hashes for ncollpyde-0.9.0-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9c46095e308e5a459b9bf82370fcd1fe1c1bf76aaba97dbb0cb3b30edace7022 |
|
MD5 | 30487717f1af2b72f134803c54644269 |
|
BLAKE2b-256 | 5549a0475154f0befad1add62e80c5bb5fe58e8e7fb4ac816daa978f39a1a926 |
Hashes for ncollpyde-0.9.0-cp38-cp38-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c7ce4a3f630997a94f7700ccf61c638100bb39b3aea7d63604e9f9237d566837 |
|
MD5 | f51adc6bf7818ca1d9cd549e599e7148 |
|
BLAKE2b-256 | 9d3c2ad040ebab595c23c1e955dc333d4c74166fcffc33084681b16f699fe6c7 |
Hashes for ncollpyde-0.9.0-cp37-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d994ee278f2206f17e3d817a854fc9df7896039ec0a787207bfbede1bd9bd063 |
|
MD5 | 973c29a053da6e4451f9470c122fe156 |
|
BLAKE2b-256 | 2856236a882b4aefc6947ecb0b3bf719f161659e1993b93527532979eeb2aada |
Hashes for ncollpyde-0.9.0-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f35fa9b4c0a8a005b2aeaddfb6f70bfff595ac68d87552e59d614c83bcc87f1 |
|
MD5 | 126cc9cff362dc7a2358e80d01e16fd6 |
|
BLAKE2b-256 | 44705cd4b8ac9a3ef161fdad0a1f68b976981467f78ada31dd7e5a6c98b921ed |
Hashes for ncollpyde-0.9.0-cp37-cp37m-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b3e63ecaa7404b9c7da7aa2685656c732a6a1be6c32418f1973f0e6597605152 |
|
MD5 | c448aa40eab7202f5075efd4c60c8ab7 |
|
BLAKE2b-256 | 1cc024ae8a943103fefbc342359ee67ca3f2c5e3b6d08fd94edc84c270fe82dc |