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-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e37a940548c203e13aaf65cc4f46d74ea629af6d1085b55e371eb6fc729003a4 |
|
MD5 | 31507522c2eddb00df6977e3006c8996 |
|
BLAKE2b-256 | 9a540cb92044387dd1690e4e875442e214be24710656791854fe8688946e3804 |
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-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8cbc3cb958f61da85d92f38f9bbe2190e750476f8933fc8d1d627852a449794d |
|
MD5 | 3346257e1978dfc107bc2d005812cc45 |
|
BLAKE2b-256 | 38d7239169f3ab4204f0c915d36685298470d96c6257a613b3359da01cc8e34d |