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.2.tar.gz (66.9 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

gimpact-1.0.2-cp313-cp313-win_amd64.whl (142.1 kB view details)

Uploaded CPython 3.13Windows x86-64

gimpact-1.0.2-cp313-cp313-musllinux_1_2_x86_64.whl (2.0 MB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ x86-64

gimpact-1.0.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (991.8 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

gimpact-1.0.2-cp313-cp313-macosx_10_13_universal2.whl (308.2 kB view details)

Uploaded CPython 3.13macOS 10.13+ universal2 (ARM64, x86-64)

gimpact-1.0.2-cp312-cp312-win_amd64.whl (142.1 kB view details)

Uploaded CPython 3.12Windows x86-64

gimpact-1.0.2-cp312-cp312-musllinux_1_2_x86_64.whl (2.0 MB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ x86-64

gimpact-1.0.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (994.8 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

gimpact-1.0.2-cp312-cp312-macosx_10_13_universal2.whl (309.6 kB view details)

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

gimpact-1.0.2-cp311-cp311-win_amd64.whl (141.8 kB view details)

Uploaded CPython 3.11Windows x86-64

gimpact-1.0.2-cp311-cp311-musllinux_1_2_x86_64.whl (2.0 MB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ x86-64

gimpact-1.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (940.0 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

gimpact-1.0.2-cp311-cp311-macosx_10_9_universal2.whl (308.3 kB view details)

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

File details

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

File metadata

  • Download URL: gimpact-1.0.2.tar.gz
  • Upload date:
  • Size: 66.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for gimpact-1.0.2.tar.gz
Algorithm Hash digest
SHA256 2992b1936c76d9c112364beef0dc42756e10f4367352245e26bde21677ecb3fc
MD5 2234ac1e0a6e7f76bb4277d22806e60f
BLAKE2b-256 d2dd575aeaa958d78dbd1c0c8f5be666405e1ebea7a092e288b577207d33661a

See more details on using hashes here.

File details

Details for the file gimpact-1.0.2-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: gimpact-1.0.2-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 142.1 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for gimpact-1.0.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 48a093c6bf1fa7eae368c155c4a0c22966c7b05cf374248ca9a5288a72ee71c7
MD5 c3902cde6b6778aaffa3b2d6ba221eb5
BLAKE2b-256 f1e99b772b7f22ff2b0832be96d825a801f9a8b8cf66120f1dc237648142d0b3

See more details on using hashes here.

File details

Details for the file gimpact-1.0.2-cp313-cp313-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for gimpact-1.0.2-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 3ab270db8ac2c390309ef89efd636fa1d54b2cebefa66948025647d6f50bf874
MD5 2714ce6021cdc8531d7365b68f70a250
BLAKE2b-256 b897318f8afc5b956dfc34c8ae7df697c2d4c24517591bdf0c10d82c3e25c805

See more details on using hashes here.

File details

Details for the file gimpact-1.0.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for gimpact-1.0.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 39f0f96a6ba538a2ed7d9514a7da1bd5803de4e1d4c99a06b2998d13609a7202
MD5 cbf19d4f6f0b5709b515ede990877be9
BLAKE2b-256 8c9e66d7ee964b4c9596325e5f27fe35370fc2b3bed063f92f69a2c25cf8ea7e

See more details on using hashes here.

File details

Details for the file gimpact-1.0.2-cp313-cp313-macosx_10_13_universal2.whl.

File metadata

File hashes

Hashes for gimpact-1.0.2-cp313-cp313-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 44e7295fc2f7efc1e5015edd73250725cf04df6d9b545483d1b06ac50c092e27
MD5 18e93693b0cd3adc403230f94a041a04
BLAKE2b-256 428f075ce6595615eee756395666c1874468e00ba09a6edfe712b2fe27e5ed5c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gimpact-1.0.2-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 142.1 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for gimpact-1.0.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 87b2898b10bcb9aa5d605a2b282be3929a46cfd4777ad17b75788901a8cfddc9
MD5 f2b00f829cb8d8531d5b5d15eae523a4
BLAKE2b-256 883ee290e04137e5cd92b234f6025d129846f0c8d2d55dee81023895e4469211

See more details on using hashes here.

File details

Details for the file gimpact-1.0.2-cp312-cp312-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for gimpact-1.0.2-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 417207bced543ad3fe64395da8f8417bc81d75ec6711bbdfe27e9ba10d2ac089
MD5 66e34250a5cf6f31fad28faba85eea82
BLAKE2b-256 c68ee429830d623eaa1c55ee3973d8a26ae64a6c96ddff936e304a402ce9118c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gimpact-1.0.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 07241e25e7f87c9c2dd566d4cc17b2d40202725c1a956251baca93f24a5cec0d
MD5 c49b7a857411264c29ab83e8c18ab797
BLAKE2b-256 4dfbc7a934ece365bf7c359974b9d36241289bea4da07ada17cf95981add6c9f

See more details on using hashes here.

File details

Details for the file gimpact-1.0.2-cp312-cp312-macosx_10_13_universal2.whl.

File metadata

File hashes

Hashes for gimpact-1.0.2-cp312-cp312-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 e27df1b43014b45d505bfc11b5bc08d6ca9e73c317cd903d2c2fe14cb6d77fbc
MD5 cf0ea19b37254215d0ff11faf6195328
BLAKE2b-256 f07dcd05ff4793daf28e45be9639b1969d639cc0b6c846b8d60db0c6f61c089f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gimpact-1.0.2-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 141.8 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for gimpact-1.0.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 c5ddbe56f20647dc8cd713251790de6e909f2ea421a6eab7dbca8a5f8cd41168
MD5 5275eda7a8fb6f5fdf467b227815ddab
BLAKE2b-256 e6c0a354ae609ed8ab3b850686e5559ba0678e8f3b4ccbd1fb878ce627668a1a

See more details on using hashes here.

File details

Details for the file gimpact-1.0.2-cp311-cp311-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for gimpact-1.0.2-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 a49e85a0dfa498b26f8eb7aac565f3b9f6f67478a257bb3ac9344c5a080e0d52
MD5 f23f4abd94d553946f90917853078db2
BLAKE2b-256 c673693a2c1668543a9126627ae30a492732cd2a9b41733dcfe017e3fb91cce5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gimpact-1.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4cc34d9a42ac243ed2727ac5606bb625ac385de75564f890db46bb0487c80da9
MD5 3ee3a0c5d0825917ac1f01a4ffd97e7b
BLAKE2b-256 29b212cf153a72be02196fc621c1472d5722b074dd6db78fefdee9331c2d9ee4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gimpact-1.0.2-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 2b358ba0c8166e40bbf80ad18a2ce886f6f2f157e61f529234c4cc7ffaa9d837
MD5 608e9233dee690a8c8494df81c9f6c00
BLAKE2b-256 6437bea951397dae8d7398e0b74a8dd2f80a20593a297d1dce195cfcf3ad43fe

See more details on using hashes here.

Supported by

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