Skip to main content

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://img.shields.io/travis/clbarnes/ncollpyde.svg :target: https://travis-ci.org/clbarnes/ncollpyde

.. 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

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)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ncollpyde-0.1.0.tar.gz (214.1 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

ncollpyde-0.1.0-cp38-cp38-manylinux1_x86_64.whl (148.7 kB view details)

Uploaded CPython 3.8

ncollpyde-0.1.0-cp37-cp37m-manylinux1_x86_64.whl (148.7 kB view details)

Uploaded CPython 3.7m

File details

Details for the file ncollpyde-0.1.0.tar.gz.

File metadata

  • Download URL: ncollpyde-0.1.0.tar.gz
  • Upload date:
  • Size: 214.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/0.7.7

File hashes

Hashes for ncollpyde-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bed83da26a20bd69529feae23c0ad52b4bf29e855a29ca9fd1cf75de7e1c941b
MD5 80f395f6ad61c8b5159b06ea7121a24f
BLAKE2b-256 337fb094d01f2503a51c9d886ea6e1b292fe0c5dcc7403d4ad28e0b4216777ef

See more details on using hashes here.

File details

Details for the file ncollpyde-0.1.0-cp38-cp38-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for ncollpyde-0.1.0-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 ec91c2c5c3e99fce31bde0eff8027b9d391c91614d07dd13d8e5c611cb8d0ee2
MD5 28cb23f4468c9cdc4ed31f3d8488ee86
BLAKE2b-256 6a7e543768003002bcd0a778b4eec41a84462054161c7f2becea553af5f03fef

See more details on using hashes here.

File details

Details for the file ncollpyde-0.1.0-cp37-cp37m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for ncollpyde-0.1.0-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 59acbb08c03d28f87be3cfdafab758f8074de3d21dbd689018758351a0d6e320
MD5 6af124f82c37f8b7a46036a3ce622215
BLAKE2b-256 214ee90d975ec4e9728946b0e6dcd0ce80e3d00f490ea0086460d97353def4db

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page