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.2-cp38-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c8458c0e0c168f28b6878d71a6e23351c7a486d51a766428ea3d86c3262be413 |
|
MD5 | c02ed51745d17570eb233ceec2582019 |
|
BLAKE2b-256 | 542125c0a9d67b701e5051e62a5def9425e0a3ffd5b89ce7da5e1171d068deb9 |
Hashes for ncollpyde-0.10.2-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b4052176c66a7c7f355fa89c0c225c8f87dacaac1e87ec01faeab86d68d2f4f2 |
|
MD5 | 1c61c6b39c69a965322ba22b2aa1a865 |
|
BLAKE2b-256 | 6779576798cbcacf62a2abaf24eb3fddb41aab399eac3faea67185c2080a95be |
Hashes for ncollpyde-0.10.2-cp38-cp38-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0773be1465b209bf8e4ee50319c76e367ab525ed3f51f2c0fb8c4b7fe6a25927 |
|
MD5 | a464867d92454190b9d9c7dcd03aa66e |
|
BLAKE2b-256 | f566c038c0522fdb408d5649f49195289cbed87b56f792082b7f08a1ad4f3903 |
Hashes for ncollpyde-0.10.2-cp37-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9c280b919b9dd0eefa5eabe7c6827b68f40e8ddfc3f86972393f4c61a972cba4 |
|
MD5 | a2d8c72dfe417583c4d952e835185d09 |
|
BLAKE2b-256 | 38be2cb766d60d0a45aac419ef82742bd71a9601b4830b2d30ead31293303998 |
Hashes for ncollpyde-0.10.2-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 102d3a7ef4f6bf0ef1ffc85601b3b5771a06e4c606eed0aa2277309f2c99441c |
|
MD5 | cb26e6b1162780c8c9937945446644b3 |
|
BLAKE2b-256 | a8c5df29f57f92c2ec0be8393b30a67399de7aadbbc3814d66177acd9ebe3ee5 |
Hashes for ncollpyde-0.10.2-cp37-cp37m-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3bc5bffcd9f39cd9f985b452eca71235c0e9826c0556639329f090a1f3982fa2 |
|
MD5 | fbdbbcb4f97db27b006f780e9c5ebac2 |
|
BLAKE2b-256 | 23fd258aa4b9af11fe70a3fef87bb4b06fb940e9c85df4cc65e4c33cfea7e926 |
Hashes for ncollpyde-0.10.2-cp36-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 242f359d2d6e365ffce48e50e45726277a40dfc34936e5b5dfdcb13b3a2227a0 |
|
MD5 | e0891b02b95ca3dfc0724058313579ac |
|
BLAKE2b-256 | e506bf68a134218aa3afe85f21800aa35123c7d5b6e0edc85d5d127fbfee0f6f |
Hashes for ncollpyde-0.10.2-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e99979c84cf427e6e8be387a7a206a7a8963e134d685f76085903ff46a5b6cbf |
|
MD5 | a9a968497f5b2a5f3d38f6784dd57029 |
|
BLAKE2b-256 | c7978ceb029f6776704a8000d96df7543c2d8b8e4d10754d98ad5ad9fe357689 |
Hashes for ncollpyde-0.10.2-cp36-cp36m-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1690d1d6836fe101bf504834135016e143ba7966498e191a265e3dc6c4abfea |
|
MD5 | 9d4bf8aadc7f80535039439262cad455 |
|
BLAKE2b-256 | d2ddfda0fba82bcfabfcf48284083bf84a30f97ff90048a4f986a895cd7cee2a |