GImpact-Python
==================
An unofficial python extension for the [GImpact collision library](http://gimpact.sourceforge.net/manual/gimpact_manual.html). 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](https://github.com/sp4cerat/Fast-Quadric-Mesh-Simplification)
* 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
-----------
``` shell
pip install -q build
python -m build
```
Installation
------------
Build requires numpy and cython (tested on Linux and Windows).
``` shell
pip install gimpact
```
Example Usage
-------------
AABB
``` python
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
``` python
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
``` python
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)
```
Raw data
{
"_id": null,
"home_page": "https://github.com/StephenNneji",
"name": "gimpact",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "GImpact, Trimesh, Collision detection, Cython",
"author": "Stephen Nneji",
"author_email": "Stephen Nneji <steve.nneji@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/d2/dd/575aeaa958d78dbd1c0c8f5be666405e1ebea7a092e288b577207d33661a/gimpact-1.0.2.tar.gz",
"platform": null,
"description": "GImpact-Python\n==================\nAn unofficial python extension for the [GImpact collision library](http://gimpact.sourceforge.net/manual/gimpact_manual.html). This extension integrates directly with GImpact's C++ API using Cython.\n\nFeatures\n---------\n* Create trimesh object from numpy array\n* Mesh decimation using Sven Forstmann's C++ mesh simplification [code](https://github.com/sp4cerat/Fast-Quadric-Mesh-Simplification) \n* Axis Aligned Bounding Box (AABB)\n* AABB set for box prunning\n* Collision of triangle mesh with the following\n * triangle mesh\n * sphere\n * capsule\n * plane\n * ray\n * Supports \"first contact\" or \"all contacts\" modes\n\nBuild Wheel\n-----------\n``` shell\npip install -q build\npython -m build\n```\n\n\nInstallation\n------------\nBuild requires numpy and cython (tested on Linux and Windows).\n``` shell\npip install gimpact\n```\n\nExample Usage\n-------------\nAABB\n``` python\nimport gimpact\n\n\naabb1 = gimpact.AABB(-1, 1, -1, 1, -1, 1)\naabb2 = gimpact.AABB(-1, 1, -1, 1, 1.5, 2)\n\nprint(aabb1.intersects(aabb2))\nprint(aabb1.intersection(aabb2))\n\naabb1.merge(aabb2)\nprint(aabb1)\n```\n\nBox Prunning\n``` python\nimport gimpact\n\naabb_set = gimpact.AABBSet(10)\nprint(len(aabb_set))\nprint(aabb_set.global_bounds)\nfor aabb in aabb_set:\n aabb.bounds = (0., 0., 0., 0., 0., 0.)\n\nfor aabb in aabb_set:\n print(aabb)\n\nprint(aabb_set.global_bounds)\npairs = aabb_set.find_intersections(aabb_set)\nprint(pairs)\n\ndel aabb_set\nprint(aabb.bounds)\n```\n\nCollision\n``` python\nimport gimpact\nimport numpy as np\n\ncontacts = gimpact.trimesh_trimesh_collision(trimesh1, trimesh2)\ncontacts = gimpact.trimesh_sphere_collision(trimesh1, [0., 0., 0.], 1, True)\ncontacts = gimpact.trimesh_capsule_collision(trimesh1, np.array([0., 0., 0.]), np.array([1., 0., 0.]), 1, True)\ncontacts = gimpact.trimesh_plane_collision(trimesh1, [0., 0., 1., 0.], True)\n```\n",
"bugtrack_url": null,
"license": null,
"summary": "An unofficial python extension for the GImpact collision library",
"version": "1.0.2",
"project_urls": {
"Homepage": "https://github.com/StephenNneji"
},
"split_keywords": [
"gimpact",
" trimesh",
" collision detection",
" cython"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "6437bea951397dae8d7398e0b74a8dd2f80a20593a297d1dce195cfcf3ad43fe",
"md5": "608e9233dee690a8c8494df81c9f6c00",
"sha256": "2b358ba0c8166e40bbf80ad18a2ce886f6f2f157e61f529234c4cc7ffaa9d837"
},
"downloads": -1,
"filename": "gimpact-1.0.2-cp311-cp311-macosx_10_9_universal2.whl",
"has_sig": false,
"md5_digest": "608e9233dee690a8c8494df81c9f6c00",
"packagetype": "bdist_wheel",
"python_version": "cp311",
"requires_python": ">=3.6",
"size": 308318,
"upload_time": "2025-08-21T14:50:11",
"upload_time_iso_8601": "2025-08-21T14:50:11.432220Z",
"url": "https://files.pythonhosted.org/packages/64/37/bea951397dae8d7398e0b74a8dd2f80a20593a297d1dce195cfcf3ad43fe/gimpact-1.0.2-cp311-cp311-macosx_10_9_universal2.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "29b212cf153a72be02196fc621c1472d5722b074dd6db78fefdee9331c2d9ee4",
"md5": "3ee3a0c5d0825917ac1f01a4ffd97e7b",
"sha256": "4cc34d9a42ac243ed2727ac5606bb625ac385de75564f890db46bb0487c80da9"
},
"downloads": -1,
"filename": "gimpact-1.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "3ee3a0c5d0825917ac1f01a4ffd97e7b",
"packagetype": "bdist_wheel",
"python_version": "cp311",
"requires_python": ">=3.6",
"size": 940006,
"upload_time": "2025-08-21T14:50:13",
"upload_time_iso_8601": "2025-08-21T14:50:13.035693Z",
"url": "https://files.pythonhosted.org/packages/29/b2/12cf153a72be02196fc621c1472d5722b074dd6db78fefdee9331c2d9ee4/gimpact-1.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "c673693a2c1668543a9126627ae30a492732cd2a9b41733dcfe017e3fb91cce5",
"md5": "f23f4abd94d553946f90917853078db2",
"sha256": "a49e85a0dfa498b26f8eb7aac565f3b9f6f67478a257bb3ac9344c5a080e0d52"
},
"downloads": -1,
"filename": "gimpact-1.0.2-cp311-cp311-musllinux_1_2_x86_64.whl",
"has_sig": false,
"md5_digest": "f23f4abd94d553946f90917853078db2",
"packagetype": "bdist_wheel",
"python_version": "cp311",
"requires_python": ">=3.6",
"size": 1970573,
"upload_time": "2025-08-21T14:50:15",
"upload_time_iso_8601": "2025-08-21T14:50:15.023065Z",
"url": "https://files.pythonhosted.org/packages/c6/73/693a2c1668543a9126627ae30a492732cd2a9b41733dcfe017e3fb91cce5/gimpact-1.0.2-cp311-cp311-musllinux_1_2_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "e6c0a354ae609ed8ab3b850686e5559ba0678e8f3b4ccbd1fb878ce627668a1a",
"md5": "5275eda7a8fb6f5fdf467b227815ddab",
"sha256": "c5ddbe56f20647dc8cd713251790de6e909f2ea421a6eab7dbca8a5f8cd41168"
},
"downloads": -1,
"filename": "gimpact-1.0.2-cp311-cp311-win_amd64.whl",
"has_sig": false,
"md5_digest": "5275eda7a8fb6f5fdf467b227815ddab",
"packagetype": "bdist_wheel",
"python_version": "cp311",
"requires_python": ">=3.6",
"size": 141782,
"upload_time": "2025-08-21T14:50:16",
"upload_time_iso_8601": "2025-08-21T14:50:16.414381Z",
"url": "https://files.pythonhosted.org/packages/e6/c0/a354ae609ed8ab3b850686e5559ba0678e8f3b4ccbd1fb878ce627668a1a/gimpact-1.0.2-cp311-cp311-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "f07dcd05ff4793daf28e45be9639b1969d639cc0b6c846b8d60db0c6f61c089f",
"md5": "cf0ea19b37254215d0ff11faf6195328",
"sha256": "e27df1b43014b45d505bfc11b5bc08d6ca9e73c317cd903d2c2fe14cb6d77fbc"
},
"downloads": -1,
"filename": "gimpact-1.0.2-cp312-cp312-macosx_10_13_universal2.whl",
"has_sig": false,
"md5_digest": "cf0ea19b37254215d0ff11faf6195328",
"packagetype": "bdist_wheel",
"python_version": "cp312",
"requires_python": ">=3.6",
"size": 309644,
"upload_time": "2025-08-21T14:50:17",
"upload_time_iso_8601": "2025-08-21T14:50:17.432017Z",
"url": "https://files.pythonhosted.org/packages/f0/7d/cd05ff4793daf28e45be9639b1969d639cc0b6c846b8d60db0c6f61c089f/gimpact-1.0.2-cp312-cp312-macosx_10_13_universal2.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "4dfbc7a934ece365bf7c359974b9d36241289bea4da07ada17cf95981add6c9f",
"md5": "c49b7a857411264c29ab83e8c18ab797",
"sha256": "07241e25e7f87c9c2dd566d4cc17b2d40202725c1a956251baca93f24a5cec0d"
},
"downloads": -1,
"filename": "gimpact-1.0.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "c49b7a857411264c29ab83e8c18ab797",
"packagetype": "bdist_wheel",
"python_version": "cp312",
"requires_python": ">=3.6",
"size": 994782,
"upload_time": "2025-08-21T14:50:19",
"upload_time_iso_8601": "2025-08-21T14:50:19.109023Z",
"url": "https://files.pythonhosted.org/packages/4d/fb/c7a934ece365bf7c359974b9d36241289bea4da07ada17cf95981add6c9f/gimpact-1.0.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "c68ee429830d623eaa1c55ee3973d8a26ae64a6c96ddff936e304a402ce9118c",
"md5": "66e34250a5cf6f31fad28faba85eea82",
"sha256": "417207bced543ad3fe64395da8f8417bc81d75ec6711bbdfe27e9ba10d2ac089"
},
"downloads": -1,
"filename": "gimpact-1.0.2-cp312-cp312-musllinux_1_2_x86_64.whl",
"has_sig": false,
"md5_digest": "66e34250a5cf6f31fad28faba85eea82",
"packagetype": "bdist_wheel",
"python_version": "cp312",
"requires_python": ">=3.6",
"size": 2002696,
"upload_time": "2025-08-21T14:50:21",
"upload_time_iso_8601": "2025-08-21T14:50:21.801754Z",
"url": "https://files.pythonhosted.org/packages/c6/8e/e429830d623eaa1c55ee3973d8a26ae64a6c96ddff936e304a402ce9118c/gimpact-1.0.2-cp312-cp312-musllinux_1_2_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "883ee290e04137e5cd92b234f6025d129846f0c8d2d55dee81023895e4469211",
"md5": "f2b00f829cb8d8531d5b5d15eae523a4",
"sha256": "87b2898b10bcb9aa5d605a2b282be3929a46cfd4777ad17b75788901a8cfddc9"
},
"downloads": -1,
"filename": "gimpact-1.0.2-cp312-cp312-win_amd64.whl",
"has_sig": false,
"md5_digest": "f2b00f829cb8d8531d5b5d15eae523a4",
"packagetype": "bdist_wheel",
"python_version": "cp312",
"requires_python": ">=3.6",
"size": 142062,
"upload_time": "2025-08-21T14:50:23",
"upload_time_iso_8601": "2025-08-21T14:50:23.421181Z",
"url": "https://files.pythonhosted.org/packages/88/3e/e290e04137e5cd92b234f6025d129846f0c8d2d55dee81023895e4469211/gimpact-1.0.2-cp312-cp312-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "428f075ce6595615eee756395666c1874468e00ba09a6edfe712b2fe27e5ed5c",
"md5": "18e93693b0cd3adc403230f94a041a04",
"sha256": "44e7295fc2f7efc1e5015edd73250725cf04df6d9b545483d1b06ac50c092e27"
},
"downloads": -1,
"filename": "gimpact-1.0.2-cp313-cp313-macosx_10_13_universal2.whl",
"has_sig": false,
"md5_digest": "18e93693b0cd3adc403230f94a041a04",
"packagetype": "bdist_wheel",
"python_version": "cp313",
"requires_python": ">=3.6",
"size": 308173,
"upload_time": "2025-08-21T14:50:24",
"upload_time_iso_8601": "2025-08-21T14:50:24.608832Z",
"url": "https://files.pythonhosted.org/packages/42/8f/075ce6595615eee756395666c1874468e00ba09a6edfe712b2fe27e5ed5c/gimpact-1.0.2-cp313-cp313-macosx_10_13_universal2.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "8c9e66d7ee964b4c9596325e5f27fe35370fc2b3bed063f92f69a2c25cf8ea7e",
"md5": "cbf19d4f6f0b5709b515ede990877be9",
"sha256": "39f0f96a6ba538a2ed7d9514a7da1bd5803de4e1d4c99a06b2998d13609a7202"
},
"downloads": -1,
"filename": "gimpact-1.0.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "cbf19d4f6f0b5709b515ede990877be9",
"packagetype": "bdist_wheel",
"python_version": "cp313",
"requires_python": ">=3.6",
"size": 991840,
"upload_time": "2025-08-21T14:50:26",
"upload_time_iso_8601": "2025-08-21T14:50:26.298671Z",
"url": "https://files.pythonhosted.org/packages/8c/9e/66d7ee964b4c9596325e5f27fe35370fc2b3bed063f92f69a2c25cf8ea7e/gimpact-1.0.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "b897318f8afc5b956dfc34c8ae7df697c2d4c24517591bdf0c10d82c3e25c805",
"md5": "2714ce6021cdc8531d7365b68f70a250",
"sha256": "3ab270db8ac2c390309ef89efd636fa1d54b2cebefa66948025647d6f50bf874"
},
"downloads": -1,
"filename": "gimpact-1.0.2-cp313-cp313-musllinux_1_2_x86_64.whl",
"has_sig": false,
"md5_digest": "2714ce6021cdc8531d7365b68f70a250",
"packagetype": "bdist_wheel",
"python_version": "cp313",
"requires_python": ">=3.6",
"size": 2003290,
"upload_time": "2025-08-21T14:50:31",
"upload_time_iso_8601": "2025-08-21T14:50:31.547212Z",
"url": "https://files.pythonhosted.org/packages/b8/97/318f8afc5b956dfc34c8ae7df697c2d4c24517591bdf0c10d82c3e25c805/gimpact-1.0.2-cp313-cp313-musllinux_1_2_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "f1e99b772b7f22ff2b0832be96d825a801f9a8b8cf66120f1dc237648142d0b3",
"md5": "c3902cde6b6778aaffa3b2d6ba221eb5",
"sha256": "48a093c6bf1fa7eae368c155c4a0c22966c7b05cf374248ca9a5288a72ee71c7"
},
"downloads": -1,
"filename": "gimpact-1.0.2-cp313-cp313-win_amd64.whl",
"has_sig": false,
"md5_digest": "c3902cde6b6778aaffa3b2d6ba221eb5",
"packagetype": "bdist_wheel",
"python_version": "cp313",
"requires_python": ">=3.6",
"size": 142137,
"upload_time": "2025-08-21T14:50:33",
"upload_time_iso_8601": "2025-08-21T14:50:33.430601Z",
"url": "https://files.pythonhosted.org/packages/f1/e9/9b772b7f22ff2b0832be96d825a801f9a8b8cf66120f1dc237648142d0b3/gimpact-1.0.2-cp313-cp313-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "d2dd575aeaa958d78dbd1c0c8f5be666405e1ebea7a092e288b577207d33661a",
"md5": "2234ac1e0a6e7f76bb4277d22806e60f",
"sha256": "2992b1936c76d9c112364beef0dc42756e10f4367352245e26bde21677ecb3fc"
},
"downloads": -1,
"filename": "gimpact-1.0.2.tar.gz",
"has_sig": false,
"md5_digest": "2234ac1e0a6e7f76bb4277d22806e60f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 66932,
"upload_time": "2025-08-21T14:50:34",
"upload_time_iso_8601": "2025-08-21T14:50:34.464761Z",
"url": "https://files.pythonhosted.org/packages/d2/dd/575aeaa958d78dbd1c0c8f5be666405e1ebea7a092e288b577207d33661a/gimpact-1.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-21 14:50:34",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "gimpact"
}