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.10.1-cp38-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fb68daad594501c8de35a6a67eed85b53b9ae1c732e3f703307b9d18514d9c85 |
|
MD5 | 73673d451b69565fc0c5bcd9159b9c68 |
|
BLAKE2b-256 | b48e1b136832d41a93f8c265c7a3b0ecd21a20549e24f70b4e072660a318cdaf |
Hashes for ncollpyde-0.10.1-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ae7d591bf7a31d0210fe4f7883982a83614a22b68a1f8ac788a96def51ff7ff |
|
MD5 | 56fde631a0cbd0ce276c938b02714c62 |
|
BLAKE2b-256 | 750e23e7b03305fcad5836da68214743c6cc7b019edf8f27fd27faefc8ee8c1f |
Hashes for ncollpyde-0.10.1-cp38-cp38-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c7d97955a1681627043ebe4ecaa988ab916aa1e7bb9106e78fbad5073ab1c33d |
|
MD5 | 9af0715fbe8864a2ede0c1ae696cbe4c |
|
BLAKE2b-256 | 5ef38217933ecb0d81e1fdbfb084a38978c9943ec87d21a3f70ecbb2708e3351 |
Hashes for ncollpyde-0.10.1-cp37-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 17d7d9b532513fa8a6446dba1c310102d59028df4a25330147e1c8af06db74b1 |
|
MD5 | 6f17664f0259340abf195406bc5958aa |
|
BLAKE2b-256 | 2b6d7a53960e3227cb727ac5ce029b7fda9500cd2e0f7f15e8380f73d18133ba |
Hashes for ncollpyde-0.10.1-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4f06124d96730adfb4f1c9a92a2013ca07e7ea5d212bc372cbc3da5e518ccffa |
|
MD5 | cb6fbfa9cbd7dfcaae9ebabc9031a8fa |
|
BLAKE2b-256 | b34536fe95d87c0fbb28fa7ddba01167fc2fe9b225b6158da7f483648ff6cd08 |
Hashes for ncollpyde-0.10.1-cp37-cp37m-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e70a0ddbf7a82a99d56176b10d70779186679f8a36ceef7b179c92a0b4041e4a |
|
MD5 | 9403d8a2eb291bbeca100698c726d492 |
|
BLAKE2b-256 | 22bdca0bd5231f08470a0bed724a8cfa444e31c921c7142d0ecf878bd77a05c2 |
Hashes for ncollpyde-0.10.1-cp36-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 02b6e63ff2d2c3e60a244850fb0e5047d8f4fb6dfb9012c5904f3cdee7cec7e9 |
|
MD5 | 08656d855887530e2344f319f624158c |
|
BLAKE2b-256 | 7fd80711c15719134fbc1cfac0222c53823403c515f032334e41d33098f92149 |
Hashes for ncollpyde-0.10.1-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 75a840c1809ded5af2c091a1df71f2c4ed02a1beb6545b8efec6c3c752d89e7f |
|
MD5 | f7b9a065e0e8791e2206769df90236ea |
|
BLAKE2b-256 | 5af630f7f6704781df991af59c43d6210191b8438cd8a6a13dd5ccf7541ef0df |
Hashes for ncollpyde-0.10.1-cp36-cp36m-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 225ceb2a14e0b24ba0be4e95310aae724734c0181f2da0804adb4e410974707a |
|
MD5 | 5471a9ac63e45925bbd57ce0e1e7844b |
|
BLAKE2b-256 | ab7ed539a036209c5f001e689fb1d4ec06275b7e3a229df5b48fa97f6da27636 |