zinglplotter


Namezinglplotter JSON
Version 1.0.0 PyPI version JSON
download
home_pagehttps://github.com/meerk40t/zinglplotter
SummaryZingl Path Plotting
upload_time2023-11-19 09:29:13
maintainer
docs_urlNone
authorTatarize
requires_python
licenseMIT
keywords plotting raster
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # zinglplotter
Zingl-Bresenham plotting algorithms.

The Zingl-Bresenham plotting algorithms are from Alois Zingl's "The Beauty of Bresenham's Algorithm" ( http://members.chello.at/easyfilter/bresenham.html ). They are all MIT Licensed and this library is also MIT licensed. In the case of Zingl's work this isn't explicit from his website, however from personal correspondence "'Free and open source' means you can do anything with it like the MIT licence[sic]."

These algorithms are error-carry-forward algorithms such that they use only integer math to plot pixel positions, and curves like quadratic and cubic beziers do not need to be turned into tiny lines or checked for how small a line should be used. They merely travel from one pixel to the next pixel carrying the error forward. 

# Functions

This library is a series of plot line generators converted from C++.

* plot_line(x0, y0, x1, y1)
* plot_quad_bezier_seg(x0, y0, x1, y1, x2, y2)
* plot_quad_bezier(x0, y0, x1, y1, x2, y2)
* plot_cubic_bezier_seg(x0, y0, x1, y1, x2, y2, x3, y3)
* plot_cubic_bezier(x0, y0, x1, y1, x2, y2, x3, y3)
* plot_line_aa(x0, y0, x1, y1)
* plot_line_width(x0: int, y0: int, x1: int, y1: int, wd: float)

These do Zingl-Bresenham algorithms for line, quad, cubic. The `_seg` function perform the draw but only for rational segments (no inversion points). The `_aa` function performs the same thing but in an anti-alias manner.

```python
from zinglplotter import plot_line
for x, y in plot_line(0, 0, 5, 8):
    print(f"({x},{y})")
```

Will result in:
``python
(0,0)
(1,1)
(1,2)
(2,3)
(3,4)
(3,5)
(4,6)
(4,7)
(5,8)
``

```python
from zinglplotter import plot_quad_bezier
for x, y in plot_quad_bezier(0, 0, 9, 4, 0, 10):
    print(f"({x},{y})")
```

Will result in:
``
(0,0)
(1,0)
(2,1)
(3,2)
(4,3)
(5,4)
(5,5)
(5,5)
(5,6)
(4,7)
(3,8)
(2,9)
(1,9)
(0,10)
``

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/meerk40t/zinglplotter",
    "name": "zinglplotter",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "plotting,raster",
    "author": "Tatarize",
    "author_email": "tatarize@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/57/a2/4938988abb6da05033a00c87b97062c825d5f729b52ac862626897664a40/zinglplotter-1.0.0.tar.gz",
    "platform": null,
    "description": "# zinglplotter\r\nZingl-Bresenham plotting algorithms.\r\n\r\nThe Zingl-Bresenham plotting algorithms are from Alois Zingl's \"The Beauty of Bresenham's Algorithm\" ( http://members.chello.at/easyfilter/bresenham.html ). They are all MIT Licensed and this library is also MIT licensed. In the case of Zingl's work this isn't explicit from his website, however from personal correspondence \"'Free and open source' means you can do anything with it like the MIT licence[sic].\"\r\n\r\nThese algorithms are error-carry-forward algorithms such that they use only integer math to plot pixel positions, and curves like quadratic and cubic beziers do not need to be turned into tiny lines or checked for how small a line should be used. They merely travel from one pixel to the next pixel carrying the error forward. \r\n\r\n# Functions\r\n\r\nThis library is a series of plot line generators converted from C++.\r\n\r\n* plot_line(x0, y0, x1, y1)\r\n* plot_quad_bezier_seg(x0, y0, x1, y1, x2, y2)\r\n* plot_quad_bezier(x0, y0, x1, y1, x2, y2)\r\n* plot_cubic_bezier_seg(x0, y0, x1, y1, x2, y2, x3, y3)\r\n* plot_cubic_bezier(x0, y0, x1, y1, x2, y2, x3, y3)\r\n* plot_line_aa(x0, y0, x1, y1)\r\n* plot_line_width(x0: int, y0: int, x1: int, y1: int, wd: float)\r\n\r\nThese do Zingl-Bresenham algorithms for line, quad, cubic. The `_seg` function perform the draw but only for rational segments (no inversion points). The `_aa` function performs the same thing but in an anti-alias manner.\r\n\r\n```python\r\nfrom zinglplotter import plot_line\r\nfor x, y in plot_line(0, 0, 5, 8):\r\n    print(f\"({x},{y})\")\r\n```\r\n\r\nWill result in:\r\n``python\r\n(0,0)\r\n(1,1)\r\n(1,2)\r\n(2,3)\r\n(3,4)\r\n(3,5)\r\n(4,6)\r\n(4,7)\r\n(5,8)\r\n``\r\n\r\n```python\r\nfrom zinglplotter import plot_quad_bezier\r\nfor x, y in plot_quad_bezier(0, 0, 9, 4, 0, 10):\r\n    print(f\"({x},{y})\")\r\n```\r\n\r\nWill result in:\r\n``\r\n(0,0)\r\n(1,0)\r\n(2,1)\r\n(3,2)\r\n(4,3)\r\n(5,4)\r\n(5,5)\r\n(5,5)\r\n(5,6)\r\n(4,7)\r\n(3,8)\r\n(2,9)\r\n(1,9)\r\n(0,10)\r\n``\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Zingl Path Plotting",
    "version": "1.0.0",
    "project_urls": {
        "Homepage": "https://github.com/meerk40t/zinglplotter"
    },
    "split_keywords": [
        "plotting",
        "raster"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ab4325bd09590dc20b72e53e027fccebac1665eb62e6f09242bcc443f4e4dc58",
                "md5": "95b5c056573be82e3dbb82ef5bdec55c",
                "sha256": "ece471de6e8d6aacb7c6c55b31f8a43c41af842f4e172291d01a4d726e44b1b6"
            },
            "downloads": -1,
            "filename": "zinglplotter-1.0.0-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "95b5c056573be82e3dbb82ef5bdec55c",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 9030,
            "upload_time": "2023-11-19T09:29:04",
            "upload_time_iso_8601": "2023-11-19T09:29:04.767322Z",
            "url": "https://files.pythonhosted.org/packages/ab/43/25bd09590dc20b72e53e027fccebac1665eb62e6f09242bcc443f4e4dc58/zinglplotter-1.0.0-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "57a24938988abb6da05033a00c87b97062c825d5f729b52ac862626897664a40",
                "md5": "9f9af7026e4f864a7e4cbcaddf9ebe06",
                "sha256": "49b6e137f2f1fdebf1c8dda3f8265aa0a1db2ca1f91eb27ebaa8929dda2a4673"
            },
            "downloads": -1,
            "filename": "zinglplotter-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "9f9af7026e4f864a7e4cbcaddf9ebe06",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 9043,
            "upload_time": "2023-11-19T09:29:13",
            "upload_time_iso_8601": "2023-11-19T09:29:13.468461Z",
            "url": "https://files.pythonhosted.org/packages/57/a2/4938988abb6da05033a00c87b97062c825d5f729b52ac862626897664a40/zinglplotter-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-19 09:29:13",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "meerk40t",
    "github_project": "zinglplotter",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "zinglplotter"
}
        
Elapsed time: 0.17947s