Skip to main content

Distance computation and collision detection in 3D.

Project description

continuous integration codecov DOI

distance3d

Distance computation and collision detection in 3D.

Robot collision detection Capsule collision detection
Closest points Hydroelastic contact

Features

  • Collision detection and distance computation with GJK.
  • Calculation of penetration depth with EPA.
  • Collision detection and calculation of penetration depth with MPR.
  • Various specific distance calculations for points, lines, line segments, planes, triangles, rectangles, circles, disks, boxes, cylinders, ellipsoids, ...
  • Broad phase collision detection with bounding volume hierarchy (AABB tree).
  • Self-collision detection for robots.
  • Contact wrench computation with hydroelastic contact model (pressure field model).

Dependencies

distance3d relies on numba to speed up computations. numba in its latest version requires at least Python 3.7 and NumPy 1.18. See here for current requirements. Required Python libraries will automatically be installed during installation of distance3d.

Installation

Install the package with

pip install -e .[all]

or from PyPI with

pip install distance3d[all]

Unit Tests

Install dependencies with

pip install -e .[test]

Run unit tests with

NUMBA_DISABLE_JIT=1 pytest

You will find the coverage report in htmlcov/index.html.

API Documentation

Install dependencies with

pip install -e .[doc]

Build API documentation with

cd doc
make html

You will find the documentation in doc/build/html/index.html.

Licenses

These implementations are mostly based on

  • Christer Ericson: Real-Time Collision Detection, CRC Press, 2004.
  • David H. Eberly: 3D Game Engine Design, CRC Press, 2006.

and accompanying implementations. These are marked as such.

The distance computation between a line and a circle is based on David Eberly's implementation, Copyright (c) 1998-2022 David Eberly, Geometric Tools, Redmond WA 98052, distributed under the Boost Software License, Version 1.0.

The original GJK algorithm is a translation to Python of the translation to C of the original Fortran implementation. The C implementation is from Diego Ruspini. It is available from http://realtimecollisiondetection.net/files/gilbert.c

Some features related to the GJK algorithm have been inspired by Bullet (zlib license) and are marked as such in the source code.

The EPA algorithm is adapted from Kevin Moran's GJK implementation (MIT License or Unlicense).

A GJK intersection test and the MPR algorithm are based on libccd (for details, see https://github.com/danfis/libccd). For the original code the copyright is of Daniel Fiser danfis@danfis.cz. It has been released under 3-clause BSD license.

The main GJK implementation is based on Jolt Physics, Copyright 2021 Jorrit Rouwe, MIT license.

The translation to Python has been done by Alexander Fabisch and the glue code around it is licensed under the 3-clause BSD license.

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

distance3d-0.9.0.tar.gz (993.0 kB view details)

Uploaded Source

File details

Details for the file distance3d-0.9.0.tar.gz.

File metadata

  • Download URL: distance3d-0.9.0.tar.gz
  • Upload date:
  • Size: 993.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for distance3d-0.9.0.tar.gz
Algorithm Hash digest
SHA256 3ec9fc251a35357442a12b910dc697ab2490559c3d25146d7264d5321fbfd430
MD5 a58522d74a3f5d2e1fc8df2d43071918
BLAKE2b-256 0b537fc7f5205d735680edb5d59b2bede5bc978b6e589ede4427180e858f67d1

See more details on using hashes here.

Supported by

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