pybresenham-tspspi


Namepybresenham-tspspi JSON
Version 0.0.2 PyPI version JSON
download
home_pagehttps://github.com/tspspi/pybresenham
SummaryA very simple implementation of Bresenham algorithm implementations
upload_time2024-04-06 23:19:07
maintainerNone
docs_urlNone
authorThomas Spielauer
requires_python>=3.8
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Simple Bresenham implementation

This is a very simple Bresenham implementation for enumerating pixels along a line
including a very simple anti aliased version. It's the felt infinite implementation
out there and has been implemented during enhancement of a tomography reconstruction
library for personal use.

![](https://raw.githubusercontent.com/tspspi/pybresenham/master/example/lines01.png)

## Dependencies

* ```numpy >= 1.25```

## Installation

```
pip install pybresenham-tspspi
```

## Usage

### Simple lines

```
import matplotlib.pyplot as plt
import numpy as np

from bresenham.bresenham import trace_line

fig, ax = plt.subplots()

img = np.zeros((51, 21))
for pt in trace_line((-25,-10),(10,10)):
    img[int(pt[0]) + 25, int(pt[1]) + 10] = 1
ax.imshow(img)
```

### Simple lines using callbacks

```
from bresenham.bresenham import trace_line

def mycallback(point):
    print(f"Point at {point[0]} x {point[1]}")

trace_line((-25,-10),(10,10),mycallback)
```

### Antialiased lines

```
import matplotlib.pyplot as plt
import numpy as np
from bresenham.bresenham import trace_line_antialiased_it

fig, ax = plt.subplots()

imgaa = np.zeros((51, 21))
for pt, weight in trace_line_antialiased_it((-25,-10),(10,10)):
    imgaa[int(pt[0]) + 25, int(pt[1]) + 10] = weight
ax.imshow(imgaa)
```

### Antialiased lines using callbacks

```
from bresenham.bresenham import trace_line_antialiased

def mycallback(point, weight):
    print(f"Point at {point[0]} x {point[1]} with weight {weight}")

trace_line_antialiased((-25,-10),(10,10),mycallback)
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/tspspi/pybresenham",
    "name": "pybresenham-tspspi",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": "Thomas Spielauer",
    "author_email": "pypipackages01@tspi.at",
    "download_url": "https://files.pythonhosted.org/packages/93/1d/e72be66857b78b1a79c7ff1695e3e0603dbec6da1735c4a0dbfa88301291/pybresenham-tspspi-0.0.2.tar.gz",
    "platform": null,
    "description": "# Simple Bresenham implementation\n\nThis is a very simple Bresenham implementation for enumerating pixels along a line\nincluding a very simple anti aliased version. It's the felt infinite implementation\nout there and has been implemented during enhancement of a tomography reconstruction\nlibrary for personal use.\n\n![](https://raw.githubusercontent.com/tspspi/pybresenham/master/example/lines01.png)\n\n## Dependencies\n\n* ```numpy >= 1.25```\n\n## Installation\n\n```\npip install pybresenham-tspspi\n```\n\n## Usage\n\n### Simple lines\n\n```\nimport matplotlib.pyplot as plt\nimport numpy as np\n\nfrom bresenham.bresenham import trace_line\n\nfig, ax = plt.subplots()\n\nimg = np.zeros((51, 21))\nfor pt in trace_line((-25,-10),(10,10)):\n    img[int(pt[0]) + 25, int(pt[1]) + 10] = 1\nax.imshow(img)\n```\n\n### Simple lines using callbacks\n\n```\nfrom bresenham.bresenham import trace_line\n\ndef mycallback(point):\n    print(f\"Point at {point[0]} x {point[1]}\")\n\ntrace_line((-25,-10),(10,10),mycallback)\n```\n\n### Antialiased lines\n\n```\nimport matplotlib.pyplot as plt\nimport numpy as np\nfrom bresenham.bresenham import trace_line_antialiased_it\n\nfig, ax = plt.subplots()\n\nimgaa = np.zeros((51, 21))\nfor pt, weight in trace_line_antialiased_it((-25,-10),(10,10)):\n    imgaa[int(pt[0]) + 25, int(pt[1]) + 10] = weight\nax.imshow(imgaa)\n```\n\n### Antialiased lines using callbacks\n\n```\nfrom bresenham.bresenham import trace_line_antialiased\n\ndef mycallback(point, weight):\n    print(f\"Point at {point[0]} x {point[1]} with weight {weight}\")\n\ntrace_line_antialiased((-25,-10),(10,10),mycallback)\n```\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A very simple implementation of Bresenham algorithm implementations",
    "version": "0.0.2",
    "project_urls": {
        "Homepage": "https://github.com/tspspi/pybresenham"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "828156c8b872d10c377210b1f83617a47ad958e4b01e5b0f4428cc39bf0838f4",
                "md5": "cfc0246f564750080dd4852121740a8c",
                "sha256": "b927951ce5298006160821066c69355ccafdf83fa6f3d68add985b497f8d13ad"
            },
            "downloads": -1,
            "filename": "pybresenham_tspspi-0.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "cfc0246f564750080dd4852121740a8c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 3851,
            "upload_time": "2024-04-06T23:19:05",
            "upload_time_iso_8601": "2024-04-06T23:19:05.327589Z",
            "url": "https://files.pythonhosted.org/packages/82/81/56c8b872d10c377210b1f83617a47ad958e4b01e5b0f4428cc39bf0838f4/pybresenham_tspspi-0.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "931de72be66857b78b1a79c7ff1695e3e0603dbec6da1735c4a0dbfa88301291",
                "md5": "0f4b4e3c7ac629c30b51bc35b78999fd",
                "sha256": "6d3df4a612c21e1883d486800f5e9f1ecccbe53ee22e9c09731fccf64dacc96c"
            },
            "downloads": -1,
            "filename": "pybresenham-tspspi-0.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "0f4b4e3c7ac629c30b51bc35b78999fd",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 3508,
            "upload_time": "2024-04-06T23:19:07",
            "upload_time_iso_8601": "2024-04-06T23:19:07.103529Z",
            "url": "https://files.pythonhosted.org/packages/93/1d/e72be66857b78b1a79c7ff1695e3e0603dbec6da1735c4a0dbfa88301291/pybresenham-tspspi-0.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-06 23:19:07",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "tspspi",
    "github_project": "pybresenham",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "pybresenham-tspspi"
}
        
Elapsed time: 0.23543s