rect-intersection


Namerect-intersection JSON
Version 0.10 PyPI version JSON
download
home_pagehttps://github.com/hansalemaos/rect_intersection
SummaryChecks if two rectangles intersect
upload_time2023-01-04 02:48:30
maintainer
docs_urlNone
authorJohannes Fischer
requires_python
licenseMIT
keywords rectangles intersect
VCS
bugtrack_url
requirements get_rectangle_infos
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# Checks if two rectangles intersect 


```python
# Tested with:
# Python 3.9.13
# Windows 10

from rect_intersection import intersects

# Allowed formats for box1/box2 
format_1x4 = (0, 0, 100, 200)
format_4x2 = [(0, 0), (100, 0), (100, 200), (0, 200)]
format_2x2 = [(0, 0), (100, 200)]

box1 = (0, 0, 100, 200)


box2 = (1000, 1000, 2000, 2000)
print(intersects(box1, box2))
box2 = (50, 20, 2000, 2000)
print(intersects(box1, box2))
box2 = [(50, 20), (2000, 20), (2000, 2000), (50, 2000)]
print(intersects(box1, box2))
box2 = [(50, 20), (2000, 2000)]
print(intersects(box1, box2))


box2 = (1000, 1000, 2000, 2000)
print(intersects(box1, box2))
box2 = (50, 20, 2000, 2000)
print(intersects(box1, box2))
box2 = [(50, 20), (2000, 20), (2000, 2000), (50, 2000)]
print(intersects(box1, box2))
box2 = [(50, 20), (2000, 2000)]
print(intersects(box1, box2))

box2 = (1000, 1000, 2000, 2000)
print(intersects(box1, box2))
box2 = (50, 20, 2000, 2000)
print(intersects(box1, box2))
box2 = [(50, 20), (2000, 20), (2000, 2000), (50, 2000)]
print(intersects(box1, box2))
box2 = [(50, 20), (2000, 2000)]
print(intersects(box1, box2))



False
True
True
True
False
True
True
True
False
True
True
True

	
```





            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hansalemaos/rect_intersection",
    "name": "rect-intersection",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "rectangles,intersect",
    "author": "Johannes Fischer",
    "author_email": "<aulasparticularesdealemaosp@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/37/90/6ad4b48b463375fe1bb41454884f3711b3b2908a14ca30cb04fbd7747cbf/rect_intersection-0.10.tar.gz",
    "platform": null,
    "description": "\n# Checks if two rectangles intersect \n\n\n```python\n# Tested with:\n# Python 3.9.13\n# Windows 10\n\nfrom rect_intersection import intersects\n\n# Allowed formats for box1/box2 \nformat_1x4 = (0, 0, 100, 200)\nformat_4x2 = [(0, 0), (100, 0), (100, 200), (0, 200)]\nformat_2x2 = [(0, 0), (100, 200)]\n\nbox1 = (0, 0, 100, 200)\n\n\nbox2 = (1000, 1000, 2000, 2000)\nprint(intersects(box1, box2))\nbox2 = (50, 20, 2000, 2000)\nprint(intersects(box1, box2))\nbox2 = [(50, 20), (2000, 20), (2000, 2000), (50, 2000)]\nprint(intersects(box1, box2))\nbox2 = [(50, 20), (2000, 2000)]\nprint(intersects(box1, box2))\n\n\nbox2 = (1000, 1000, 2000, 2000)\nprint(intersects(box1, box2))\nbox2 = (50, 20, 2000, 2000)\nprint(intersects(box1, box2))\nbox2 = [(50, 20), (2000, 20), (2000, 2000), (50, 2000)]\nprint(intersects(box1, box2))\nbox2 = [(50, 20), (2000, 2000)]\nprint(intersects(box1, box2))\n\nbox2 = (1000, 1000, 2000, 2000)\nprint(intersects(box1, box2))\nbox2 = (50, 20, 2000, 2000)\nprint(intersects(box1, box2))\nbox2 = [(50, 20), (2000, 20), (2000, 2000), (50, 2000)]\nprint(intersects(box1, box2))\nbox2 = [(50, 20), (2000, 2000)]\nprint(intersects(box1, box2))\n\n\n\nFalse\nTrue\nTrue\nTrue\nFalse\nTrue\nTrue\nTrue\nFalse\nTrue\nTrue\nTrue\n\n\t\n```\n\n\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Checks if two rectangles intersect",
    "version": "0.10",
    "project_urls": {
        "Homepage": "https://github.com/hansalemaos/rect_intersection"
    },
    "split_keywords": [
        "rectangles",
        "intersect"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "209714817a24a175c237a41c1a1d7fa493e625e55535a7d8629bff7f74ac10a3",
                "md5": "984deb4df99af1840125d42588b2d3c0",
                "sha256": "89cda676d5f8afa1367450653c2bc28c3ac30c8ca40001971ddcdc9238c8550f"
            },
            "downloads": -1,
            "filename": "rect_intersection-0.10-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "984deb4df99af1840125d42588b2d3c0",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 4491,
            "upload_time": "2023-01-04T02:48:28",
            "upload_time_iso_8601": "2023-01-04T02:48:28.587367Z",
            "url": "https://files.pythonhosted.org/packages/20/97/14817a24a175c237a41c1a1d7fa493e625e55535a7d8629bff7f74ac10a3/rect_intersection-0.10-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "37906ad4b48b463375fe1bb41454884f3711b3b2908a14ca30cb04fbd7747cbf",
                "md5": "8ff637d20be69c2672981c53e41ff4ee",
                "sha256": "c16628c24ad12c9e2a407a5f96ce8ff28279770cd844141b8b5f21bb9d84b8e8"
            },
            "downloads": -1,
            "filename": "rect_intersection-0.10.tar.gz",
            "has_sig": false,
            "md5_digest": "8ff637d20be69c2672981c53e41ff4ee",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 3167,
            "upload_time": "2023-01-04T02:48:30",
            "upload_time_iso_8601": "2023-01-04T02:48:30.266000Z",
            "url": "https://files.pythonhosted.org/packages/37/90/6ad4b48b463375fe1bb41454884f3711b3b2908a14ca30cb04fbd7747cbf/rect_intersection-0.10.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-04 02:48:30",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hansalemaos",
    "github_project": "rect_intersection",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "get_rectangle_infos",
            "specs": []
        }
    ],
    "lcname": "rect-intersection"
}
        
Elapsed time: 0.35879s