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
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
gimpact-1.0.1.tar.gz
(228.6 kB
view hashes)
Built Distributions
gimpact-1.0.1-cp39-cp39-win_amd64.whl
(210.5 kB
view hashes)
Close
Hashes for gimpact-1.0.1-cp312-cp312-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b24302408a027897b76c6d6b8944956d3a09cfe0a14e932c9971b67c7e7b87e0 |
|
MD5 | 32efbc0956af3c7e96047c2d986b4981 |
|
BLAKE2b-256 | a07c6e1f22fa0017181ebe1ccacde36905aad80f433f59f0d13e11d85af25d3a |
Close
Hashes for gimpact-1.0.1-cp312-cp312-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 69d4b7e76a6a5dbadb558bcd2d555a885ebf02e77012a2355435fad49bae1f5b |
|
MD5 | 69824faa2d572b369dd04fa15ed18570 |
|
BLAKE2b-256 | 5e388b47c2039c9369a69ab8038236cbef7f29529b6783fb38922278b37df7fd |
Close
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 |
Close
Hashes for gimpact-1.0.1-cp312-cp312-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 97055fd9ca6c71bc9ecc4b18b8eefd8084e1225762728e63d001ec90fcaffa6c |
|
MD5 | ebd5daee69f568dcf7aa8589d593f7a6 |
|
BLAKE2b-256 | 2572f589b73895c25981a42b3a4abadc346cb029f197ec4c1d69f4f59d5b058d |
Close
Hashes for gimpact-1.0.1-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e37a940548c203e13aaf65cc4f46d74ea629af6d1085b55e371eb6fc729003a4 |
|
MD5 | 31507522c2eddb00df6977e3006c8996 |
|
BLAKE2b-256 | 9a540cb92044387dd1690e4e875442e214be24710656791854fe8688946e3804 |
Close
Hashes for gimpact-1.0.1-cp311-cp311-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1b5710f2f2e8e1e35705cdfdc78a04046faf37a63ec7820372152dc458424f60 |
|
MD5 | c3a5e564ccf8583ed2370107b8191e59 |
|
BLAKE2b-256 | d4c72b60636138cc9c37d9c2a97715db31a23cce385e6a8ac3563abd149900b4 |
Close
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 |
Close
Hashes for gimpact-1.0.1-cp311-cp311-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ad086bd2bc988306eeea953a8504eb0bca57de6669b5fac593bc3d9282e143b3 |
|
MD5 | 9630b376c803b917d64df1c06f60f21d |
|
BLAKE2b-256 | 671aefe7654d57b0b060a72b459cebf336e68b801974e50dee0adf8a5746f046 |
Close
Hashes for gimpact-1.0.1-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c869b4082bc1d187aaa346f3ad3a0d7cb703a6dae91d50b0f04a9c9933bc9805 |
|
MD5 | fb2c97112429c9997edc8387bc2b343b |
|
BLAKE2b-256 | 2cf554373c5dc7cdf3b881be5df7833e818d67b6ff7fa2be2756c11ba4af5d1d |
Close
Hashes for gimpact-1.0.1-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6dab86773993b245df17c4bb9563c4b60cfcc86838a639fecaad4af480079358 |
|
MD5 | c60fbe127e27e3b441d2da92c1bcd268 |
|
BLAKE2b-256 | f2b21d31fbae3a8a1f9d0a44998d88b5f4ef53978d2f5733b49dc77b622d4599 |
Close
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 |
Close
Hashes for gimpact-1.0.1-cp310-cp310-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fdcb58040c7197088a016b08d7cdf002c093aa4eecc7401691fbae18ab77be77 |
|
MD5 | 9778bdcb3acd45ef794b54812fb4a4f9 |
|
BLAKE2b-256 | 1f416fdc8da9da117e74fb53f7d3c13efe8be4aee501ea79cfbe6c30ea667b13 |
Close
Hashes for gimpact-1.0.1-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8cbc3cb958f61da85d92f38f9bbe2190e750476f8933fc8d1d627852a449794d |
|
MD5 | 3346257e1978dfc107bc2d005812cc45 |
|
BLAKE2b-256 | 38d7239169f3ab4204f0c915d36685298470d96c6257a613b3359da01cc8e34d |
Close
Hashes for gimpact-1.0.1-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c5adc88d0caf7dd652409f93a515a221004801b30ba4571c477b104fa40714ec |
|
MD5 | 1e63827d3cd386724f1697f755f33d08 |
|
BLAKE2b-256 | 1489b9f8ad3a92dee691a7d18fb4b08633df3553acc135c103975bd1ee82dbb5 |
Close
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 |
Close
Hashes for gimpact-1.0.1-cp39-cp39-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d7b44f57c9a53f87ef54facf70645bf3b729163e254f8a1a57793c1b6c0dabac |
|
MD5 | 42bc84cb7b34e424cd26ea7d94d97a72 |
|
BLAKE2b-256 | 48430d680c8f094d7e1d856c15bd1021679fef0d1412d502c8a379da81a20eea |