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.0-cp38-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2213f3efb5d9ea105cdcd88d919d8b8c928b6841a3a747c85f50551764fa6ef7 |
|
MD5 | ca2bb656229e69f8f4f914bd87cfe4f1 |
|
BLAKE2b-256 | 2e1b6173c8322a5b4b54d2f8de24068be3c1617945d8f4b429129570d80e16c4 |
Hashes for ncollpyde-0.10.0-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9c741fee79f7eb73c6d8015c1e1fac7875c9d0bbc1dfabff36597281e6edc4f5 |
|
MD5 | 8cbd989aa5e0f3e8888a22dc97852148 |
|
BLAKE2b-256 | 1c92f1dfa8b0fea10d56f4ec05e56365da3530caa2be304b4690f8fa47d55c3c |
Hashes for ncollpyde-0.10.0-cp38-cp38-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b0fc2eab8a10ea54f69a12375ee7e65ba2730a67c5193e2761228d802090f1c2 |
|
MD5 | 24d1d3a5c003cdfcf4758319cd50f5ca |
|
BLAKE2b-256 | d36c700025c63a49a94e9d4fce7414774d2f7f8b818b78a1194319190ae20591 |
Hashes for ncollpyde-0.10.0-cp37-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1c953a880d65fc02912c93ddbf97dd7cbe5d67ee859948586fe1a56af4c78941 |
|
MD5 | 4a957daec27f082ad14fe2bfade2b673 |
|
BLAKE2b-256 | 01d3915de13516bb4fda7de825e1b74e341da739cfe29714e967e41d92a2b920 |
Hashes for ncollpyde-0.10.0-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5843ddfca0b2b5dd9fdb20a2f1d996544f4e47c663e26bf44194af414a14dfa5 |
|
MD5 | 146c0baebee405d65ba8d5539661bf37 |
|
BLAKE2b-256 | 4d3969d1605333dfe84a17162ce03cacf8c82b465ddfd324fbd001560f68023e |
Hashes for ncollpyde-0.10.0-cp37-cp37m-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f0b6fec134829aefed07baff3aad130feb0d56b185d33589b4f3cb29efbe97fa |
|
MD5 | 36c86b13901c864c349e791f5df30201 |
|
BLAKE2b-256 | d1493ffdf1b664a25d8d776182343cfebe509d6ba0d1e363976cce7b766369ba |
Hashes for ncollpyde-0.10.0-cp36-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 41baec862c6d1c1b1d09ccc2f8edd125811dc2fcabb632d68a5c20c8057768ed |
|
MD5 | 2da6a6791cb7533baf9c890b12df2f8c |
|
BLAKE2b-256 | e0d4a16fbdd02d8be356a4b9db22730ebc7ec716a80cf818b4e872295eaa4804 |
Hashes for ncollpyde-0.10.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 483787361c382225372a79dd1085d124933b013ac4c63ede606ce704291c2215 |
|
MD5 | 8e43ada3bf23c94c7b97fcaf1ec2a7c4 |
|
BLAKE2b-256 | ab1ecd0f7ac7a1fdf3d1517c3726e24c9d1b7ea0886843bb4d2bcea369f363ca |
Hashes for ncollpyde-0.10.0-cp36-cp36m-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0a80c6d6700b5a52d8ed9f8feeea1e237c978fe5ad716134d079d9c5359469ef |
|
MD5 | e299ebbc2d394b0f572c9b3549cfba91 |
|
BLAKE2b-256 | 6657a42ba3a0d7181b5e2404f7e0465774540998f37784de1aa2ec2ee394817d |