Skip to main content

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.

Metadata

Release files for distance3d 0.9.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for distance3d 0.9.1
File Size Uploaded
distance3d-0.9.1.tar.gz 993.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for distance3d 0.9.1
File Interpreter ABI Platform
distance3d-0.9.1-py3-none-any.whl Python 3 none any Details

Total release size: 1.1 MB

Release files / distance3d-0.9.1.tar.gz

Download URL distance3d-0.9.1.tar.gz
Size 993.8 kB
Tags Source
SHA-256 checksum
How to use checksums
571f6172e0ed518967337b4ec387881a5dfd2237138e0cd9a6f97a4950b12a3c
BLAKE2b-256 checksum
How to use checksums
ff377fea20e16af3e7aac656d1b85c43fdd3906c379234585a9050511e476363
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / distance3d-0.9.1-py3-none-any.whl

Download URL distance3d-0.9.1-py3-none-any.whl
Size 105.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
84dbb80a52ad1386c39b3c9e4d09bc2bfa5a31fc35655a48d3bf6f4cb4eacdde
BLAKE2b-256 checksum
How to use checksums
d8dda26efcb8fa54bd500da5b3a9d851c26a53536a255b0d95cf4c54a812e940
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release history Release notifications | RSS feed

This release

0.9.1 This release

2 release files

0.9.0

1 release file

0.8.0

1 release file

0.7.1

1 release file

0.7.0

1 release file

0.6.0

1 release file

0.5.0

1 release file

0.4.0

1 release file

0.3.0

1 release file

0.2.0

1 release file

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page