gimpact


Namegimpact JSON
Version 1.0.1 PyPI version JSON
download
home_pagehttps://github.com/StephenNneji
SummaryAn unofficial python extension for the GImpact collision library
upload_time2023-05-15 13:08:28
maintainer
docs_urlNone
authorStephen Nneji
requires_python>=3.6
licenseBSD 3-Clause License Copyright (c) 2019, Stephen Nneji All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
keywords gimpact trimesh collision detection cython
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            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": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "GImpact,Trimesh,Collision detection,Cython",
    "author": "Stephen Nneji",
    "author_email": "Stephen Nneji <steve.nneji@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/17/69/472267f4ebdada44b94403511255dbc95065a53c6c3d6e074567e4e22ef4/gimpact-1.0.1.tar.gz",
    "platform": null,
    "description": "GImpact-Python\r\n==================\r\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.\r\n\r\nFeatures\r\n---------\r\n* Create trimesh object from numpy array\r\n* Mesh decimation using Sven Forstmann's C++ mesh simplification [code](https://github.com/sp4cerat/Fast-Quadric-Mesh-Simplification) \r\n* Axis Aligned Bounding Box (AABB)\r\n* AABB set for box prunning\r\n* Collision of triangle mesh with the following\r\n    * triangle mesh\r\n    * sphere\r\n    * capsule\r\n    * plane\r\n    * ray\r\n * Supports \"first contact\" or \"all contacts\" modes\r\n\r\nBuild Wheel\r\n-----------\r\n``` shell\r\npip install -q build\r\npython -m build\r\n```\r\n\r\n\r\nInstallation\r\n------------\r\nBuild requires numpy and cython (tested on Linux and Windows).\r\n``` shell\r\npip install gimpact\r\n```\r\n\r\nExample Usage\r\n-------------\r\nAABB\r\n```  python\r\nimport gimpact\r\n\r\n\r\naabb1 = gimpact.AABB(-1, 1, -1, 1, -1, 1)\r\naabb2 = gimpact.AABB(-1, 1, -1, 1, 1.5, 2)\r\n\r\nprint(aabb1.intersects(aabb2))\r\nprint(aabb1.intersection(aabb2))\r\n\r\naabb1.merge(aabb2)\r\nprint(aabb1)\r\n```\r\n\r\nBox Prunning\r\n``` python\r\nimport gimpact\r\n\r\naabb_set = gimpact.AABBSet(10)\r\nprint(len(aabb_set))\r\nprint(aabb_set.global_bounds)\r\nfor aabb in aabb_set:\r\n    aabb.bounds = (0., 0., 0., 0., 0., 0.)\r\n\r\nfor aabb in aabb_set:\r\n    print(aabb)\r\n\r\nprint(aabb_set.global_bounds)\r\npairs = aabb_set.find_intersections(aabb_set)\r\nprint(pairs)\r\n\r\ndel aabb_set\r\nprint(aabb.bounds)\r\n```\r\n\r\nCollision\r\n```  python\r\nimport gimpact\r\nimport numpy as np\r\n\r\ncontacts = gimpact.trimesh_trimesh_collision(trimesh1, trimesh2)\r\ncontacts = gimpact.trimesh_sphere_collision(trimesh1, [0., 0., 0.], 1, True)\r\ncontacts = gimpact.trimesh_capsule_collision(trimesh1, np.array([0., 0., 0.]), np.array([1., 0., 0.]), 1, True)\r\ncontacts = gimpact.trimesh_plane_collision(trimesh1, [0., 0., 1., 0.], True)\r\n```\r\n",
    "bugtrack_url": null,
    "license": "BSD 3-Clause License  Copyright (c) 2019, Stephen Nneji All rights reserved.  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:  * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.  * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.  * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ",
    "summary": "An unofficial python extension for the GImpact collision library",
    "version": "1.0.1",
    "project_urls": {
        "Homepage": "https://github.com/StephenNneji"
    },
    "split_keywords": [
        "gimpact",
        "trimesh",
        "collision detection",
        "cython"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2cf554373c5dc7cdf3b881be5df7833e818d67b6ff7fa2be2756c11ba4af5d1d",
                "md5": "fb2c97112429c9997edc8387bc2b343b",
                "sha256": "c869b4082bc1d187aaa346f3ad3a0d7cb703a6dae91d50b0f04a9c9933bc9805"
            },
            "downloads": -1,
            "filename": "gimpact-1.0.1-cp310-cp310-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "fb2c97112429c9997edc8387bc2b343b",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": ">=3.6",
            "size": 208281,
            "upload_time": "2023-05-15T13:08:21",
            "upload_time_iso_8601": "2023-05-15T13:08:21.723809Z",
            "url": "https://files.pythonhosted.org/packages/2c/f5/54373c5dc7cdf3b881be5df7833e818d67b6ff7fa2be2756c11ba4af5d1d/gimpact-1.0.1-cp310-cp310-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9a540cb92044387dd1690e4e875442e214be24710656791854fe8688946e3804",
                "md5": "31507522c2eddb00df6977e3006c8996",
                "sha256": "e37a940548c203e13aaf65cc4f46d74ea629af6d1085b55e371eb6fc729003a4"
            },
            "downloads": -1,
            "filename": "gimpact-1.0.1-cp311-cp311-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "31507522c2eddb00df6977e3006c8996",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": ">=3.6",
            "size": 207399,
            "upload_time": "2023-05-15T13:08:24",
            "upload_time_iso_8601": "2023-05-15T13:08:24.158559Z",
            "url": "https://files.pythonhosted.org/packages/9a/54/0cb92044387dd1690e4e875442e214be24710656791854fe8688946e3804/gimpact-1.0.1-cp311-cp311-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "38d7239169f3ab4204f0c915d36685298470d96c6257a613b3359da01cc8e34d",
                "md5": "3346257e1978dfc107bc2d005812cc45",
                "sha256": "8cbc3cb958f61da85d92f38f9bbe2190e750476f8933fc8d1d627852a449794d"
            },
            "downloads": -1,
            "filename": "gimpact-1.0.1-cp39-cp39-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "3346257e1978dfc107bc2d005812cc45",
            "packagetype": "bdist_wheel",
            "python_version": "cp39",
            "requires_python": ">=3.6",
            "size": 210483,
            "upload_time": "2023-05-15T13:08:26",
            "upload_time_iso_8601": "2023-05-15T13:08:26.372781Z",
            "url": "https://files.pythonhosted.org/packages/38/d7/239169f3ab4204f0c915d36685298470d96c6257a613b3359da01cc8e34d/gimpact-1.0.1-cp39-cp39-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1769472267f4ebdada44b94403511255dbc95065a53c6c3d6e074567e4e22ef4",
                "md5": "dd4458e15fc8ee6149b162d582e99e94",
                "sha256": "08224a4b9539fcb83806aeac0a7c894e95a7d2f46cea27cbf57d37001abc65f5"
            },
            "downloads": -1,
            "filename": "gimpact-1.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "dd4458e15fc8ee6149b162d582e99e94",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 228642,
            "upload_time": "2023-05-15T13:08:28",
            "upload_time_iso_8601": "2023-05-15T13:08:28.883682Z",
            "url": "https://files.pythonhosted.org/packages/17/69/472267f4ebdada44b94403511255dbc95065a53c6c3d6e074567e4e22ef4/gimpact-1.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-15 13:08:28",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "gimpact"
}
        
Elapsed time: 0.06712s