Skip to main content

An unofficial python extension for the GImpact collision library

Project description

GImpact-Python

An unofficial python extension for the GImpact collision library. This extension integrates directly with GImpact's C++ API using Cython.

Features

  • Create trimesh object from numpy array
  • Mesh decimation using Sven Forstmann's C++ mesh simplification code
  • Axis Aligned Bounding Box (AABB)
  • AABB set for box prunning
  • Collision of triangle mesh with the following
    • triangle mesh
    • sphere
    • capsule
    • plane
    • ray
  • Supports "first contact" or "all contacts" modes

Build Wheel

pip install -q build
python -m build

Installation

Build requires numpy and cython (tested on Linux and Windows).

pip install gimpact

Example Usage

AABB

import gimpact


aabb1 = gimpact.AABB(-1, 1, -1, 1, -1, 1)
aabb2 = gimpact.AABB(-1, 1, -1, 1, 1.5, 2)

print(aabb1.intersects(aabb2))
print(aabb1.intersection(aabb2))

aabb1.merge(aabb2)
print(aabb1)

Box Prunning

import gimpact

aabb_set = gimpact.AABBSet(10)
print(len(aabb_set))
print(aabb_set.global_bounds)
for aabb in aabb_set:
    aabb.bounds = (0., 0., 0., 0., 0., 0.)

for aabb in aabb_set:
    print(aabb)

print(aabb_set.global_bounds)
pairs = aabb_set.find_intersections(aabb_set)
print(pairs)

del aabb_set
print(aabb.bounds)

Collision

import gimpact
import numpy as np

contacts = gimpact.trimesh_trimesh_collision(trimesh1, trimesh2)
contacts = gimpact.trimesh_sphere_collision(trimesh1, [0., 0., 0.], 1, True)
contacts = gimpact.trimesh_capsule_collision(trimesh1, np.array([0., 0., 0.]), np.array([1., 0., 0.]), 1, True)
contacts = gimpact.trimesh_plane_collision(trimesh1, [0., 0., 1., 0.], True)

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

gimpact-1.0.1.tar.gz (228.6 kB view details)

Uploaded Source

Built Distributions

gimpact-1.0.1-cp312-cp312-win_amd64.whl (153.8 kB view details)

Uploaded CPython 3.12 Windows x86-64

gimpact-1.0.1-cp312-cp312-musllinux_1_1_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.12 musllinux: musl 1.1+ x86-64

gimpact-1.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

gimpact-1.0.1-cp312-cp312-macosx_10_9_universal2.whl (363.1 kB view details)

Uploaded CPython 3.12 macOS 10.9+ universal2 (ARM64, x86-64)

gimpact-1.0.1-cp311-cp311-win_amd64.whl (207.4 kB view details)

Uploaded CPython 3.11 Windows x86-64

gimpact-1.0.1-cp311-cp311-musllinux_1_1_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.11 musllinux: musl 1.1+ x86-64

gimpact-1.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

gimpact-1.0.1-cp311-cp311-macosx_10_9_universal2.whl (361.7 kB view details)

Uploaded CPython 3.11 macOS 10.9+ universal2 (ARM64, x86-64)

gimpact-1.0.1-cp310-cp310-win_amd64.whl (208.3 kB view details)

Uploaded CPython 3.10 Windows x86-64

gimpact-1.0.1-cp310-cp310-musllinux_1_1_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.10 musllinux: musl 1.1+ x86-64

gimpact-1.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

gimpact-1.0.1-cp310-cp310-macosx_10_9_universal2.whl (360.9 kB view details)

Uploaded CPython 3.10 macOS 10.9+ universal2 (ARM64, x86-64)

gimpact-1.0.1-cp39-cp39-win_amd64.whl (210.5 kB view details)

Uploaded CPython 3.9 Windows x86-64

gimpact-1.0.1-cp39-cp39-musllinux_1_1_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.9 musllinux: musl 1.1+ x86-64

gimpact-1.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

gimpact-1.0.1-cp39-cp39-macosx_10_9_universal2.whl (362.1 kB view details)

Uploaded CPython 3.9 macOS 10.9+ universal2 (ARM64, x86-64)

File details

Details for the file gimpact-1.0.1.tar.gz.

File metadata

  • Download URL: gimpact-1.0.1.tar.gz
  • Upload date:
  • Size: 228.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for gimpact-1.0.1.tar.gz
Algorithm Hash digest
SHA256 08224a4b9539fcb83806aeac0a7c894e95a7d2f46cea27cbf57d37001abc65f5
MD5 dd4458e15fc8ee6149b162d582e99e94
BLAKE2b-256 1769472267f4ebdada44b94403511255dbc95065a53c6c3d6e074567e4e22ef4

See more details on using hashes here.

File details

Details for the file gimpact-1.0.1-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: gimpact-1.0.1-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 153.8 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.5

File hashes

Hashes for gimpact-1.0.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 b24302408a027897b76c6d6b8944956d3a09cfe0a14e932c9971b67c7e7b87e0
MD5 32efbc0956af3c7e96047c2d986b4981
BLAKE2b-256 a07c6e1f22fa0017181ebe1ccacde36905aad80f433f59f0d13e11d85af25d3a

See more details on using hashes here.

File details

Details for the file gimpact-1.0.1-cp312-cp312-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for gimpact-1.0.1-cp312-cp312-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 69d4b7e76a6a5dbadb558bcd2d555a885ebf02e77012a2355435fad49bae1f5b
MD5 69824faa2d572b369dd04fa15ed18570
BLAKE2b-256 5e388b47c2039c9369a69ab8038236cbef7f29529b6783fb38922278b37df7fd

See more details on using hashes here.

File details

Details for the file gimpact-1.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for gimpact-1.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0ec0d4c9fecf15eb6efb6650ef498dfdfa32708ed55d6adc1ca38c4a863ed1db
MD5 0c0f6b064070314650f5f2f7d04f7b01
BLAKE2b-256 25b9cb7673c0b35bcf06e1668d0dce7e3366b96f18b5e7ba438c684621d386d1

See more details on using hashes here.

File details

Details for the file gimpact-1.0.1-cp312-cp312-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for gimpact-1.0.1-cp312-cp312-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 97055fd9ca6c71bc9ecc4b18b8eefd8084e1225762728e63d001ec90fcaffa6c
MD5 ebd5daee69f568dcf7aa8589d593f7a6
BLAKE2b-256 2572f589b73895c25981a42b3a4abadc346cb029f197ec4c1d69f4f59d5b058d

See more details on using hashes here.

File details

Details for the file gimpact-1.0.1-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: gimpact-1.0.1-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 207.4 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for gimpact-1.0.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 e37a940548c203e13aaf65cc4f46d74ea629af6d1085b55e371eb6fc729003a4
MD5 31507522c2eddb00df6977e3006c8996
BLAKE2b-256 9a540cb92044387dd1690e4e875442e214be24710656791854fe8688946e3804

See more details on using hashes here.

File details

Details for the file gimpact-1.0.1-cp311-cp311-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for gimpact-1.0.1-cp311-cp311-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 1b5710f2f2e8e1e35705cdfdc78a04046faf37a63ec7820372152dc458424f60
MD5 c3a5e564ccf8583ed2370107b8191e59
BLAKE2b-256 d4c72b60636138cc9c37d9c2a97715db31a23cce385e6a8ac3563abd149900b4

See more details on using hashes here.

File details

Details for the file gimpact-1.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for gimpact-1.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 356a156e5727c22c12948ae43cab0e730a3dc8b8b8cf827de1a0ff5510215aa9
MD5 1b28f7d36c8b0f2e1885b7e9f457cd47
BLAKE2b-256 2e69abbbceb1cb9e46b32a0d84ec4840eaabe7313b84eb183bb206e6838e3419

See more details on using hashes here.

File details

Details for the file gimpact-1.0.1-cp311-cp311-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for gimpact-1.0.1-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 ad086bd2bc988306eeea953a8504eb0bca57de6669b5fac593bc3d9282e143b3
MD5 9630b376c803b917d64df1c06f60f21d
BLAKE2b-256 671aefe7654d57b0b060a72b459cebf336e68b801974e50dee0adf8a5746f046

See more details on using hashes here.

File details

Details for the file gimpact-1.0.1-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: gimpact-1.0.1-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 208.3 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for gimpact-1.0.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 c869b4082bc1d187aaa346f3ad3a0d7cb703a6dae91d50b0f04a9c9933bc9805
MD5 fb2c97112429c9997edc8387bc2b343b
BLAKE2b-256 2cf554373c5dc7cdf3b881be5df7833e818d67b6ff7fa2be2756c11ba4af5d1d

See more details on using hashes here.

File details

Details for the file gimpact-1.0.1-cp310-cp310-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for gimpact-1.0.1-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 6dab86773993b245df17c4bb9563c4b60cfcc86838a639fecaad4af480079358
MD5 c60fbe127e27e3b441d2da92c1bcd268
BLAKE2b-256 f2b21d31fbae3a8a1f9d0a44998d88b5f4ef53978d2f5733b49dc77b622d4599

See more details on using hashes here.

File details

Details for the file gimpact-1.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for gimpact-1.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6a8e66bcfae3eb651ec98e06d1d3d549f67396e9aa13a3b727c6deddf538c661
MD5 e1ecb40504925b92e32f6ce9e0f67e79
BLAKE2b-256 0a33eb622dc782f99fc9b3bdbd2b9232bfef42a4f5bbed89ea61c494fc6c6490

See more details on using hashes here.

File details

Details for the file gimpact-1.0.1-cp310-cp310-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for gimpact-1.0.1-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 fdcb58040c7197088a016b08d7cdf002c093aa4eecc7401691fbae18ab77be77
MD5 9778bdcb3acd45ef794b54812fb4a4f9
BLAKE2b-256 1f416fdc8da9da117e74fb53f7d3c13efe8be4aee501ea79cfbe6c30ea667b13

See more details on using hashes here.

File details

Details for the file gimpact-1.0.1-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: gimpact-1.0.1-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 210.5 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for gimpact-1.0.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 8cbc3cb958f61da85d92f38f9bbe2190e750476f8933fc8d1d627852a449794d
MD5 3346257e1978dfc107bc2d005812cc45
BLAKE2b-256 38d7239169f3ab4204f0c915d36685298470d96c6257a613b3359da01cc8e34d

See more details on using hashes here.

File details

Details for the file gimpact-1.0.1-cp39-cp39-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for gimpact-1.0.1-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 c5adc88d0caf7dd652409f93a515a221004801b30ba4571c477b104fa40714ec
MD5 1e63827d3cd386724f1697f755f33d08
BLAKE2b-256 1489b9f8ad3a92dee691a7d18fb4b08633df3553acc135c103975bd1ee82dbb5

See more details on using hashes here.

File details

Details for the file gimpact-1.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for gimpact-1.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2fc762996fbcb38cd47288c56d8146bb04b3d3d4bc34cf7930ab518dac29218d
MD5 f548746e430412b17468d8eaebd5cb8a
BLAKE2b-256 8a0981234667651e527ce00256ef978c4237947e2bcc55728b9e5f7af5638da4

See more details on using hashes here.

File details

Details for the file gimpact-1.0.1-cp39-cp39-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for gimpact-1.0.1-cp39-cp39-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 d7b44f57c9a53f87ef54facf70645bf3b729163e254f8a1a57793c1b6c0dabac
MD5 42bc84cb7b34e424cd26ea7d94d97a72
BLAKE2b-256 48430d680c8f094d7e1d856c15bd1021679fef0d1412d502c8a379da81a20eea

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