Skip to main content

An implementation of Bresenham's line drawing algorithm

Project description

The bresenham module

An implementation of Bresenham’s line drawing algorithm.

See the Wikipedia entry for details on what that is.

Installation

In a Python virtual environment, do:

python -m pip install bresenham

To install an editable from a Git checkout:

python -m pip install -e.

To install without a virtual envitonment, add the --user option.

Usage

The bresenham(x0, y0, x1, y1) function, which returns a generator of the coordinates of the line from (x0, y0) to (x1, y1).

For example, the coordinates of a line from, say, (-1, -4) to (3, 2), are:

>>> from bresenham import bresenham

>>> list(bresenham(-1, -4, 3, 2))
[(-1, -4), (0, -3), (0, -2), (1, -1), (2, 0), (2, 1), (3, 2)]

Development

You’re welcome to join this project!

If you spot an issue, please report it at the Issues page on Github.

If you’d like to start changing the code or documentation, check out the code locally using:

git clone https://github.com/encukou/bresenham

If you’re new to this, please read the this guide about collaborating on Github-hosted projects like this one.

If that doesn’t make sense, please e-mail the author for clarification. I’d be happy to help you get started.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bresenham-0.1.tar.gz (2.2 kB view details)

Uploaded Source

Built Distribution

bresenham-0.1-py3-none-any.whl (2.7 kB view details)

Uploaded Python 3

File details

Details for the file bresenham-0.1.tar.gz.

File metadata

  • Download URL: bresenham-0.1.tar.gz
  • Upload date:
  • Size: 2.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for bresenham-0.1.tar.gz
Algorithm Hash digest
SHA256 223e1fbdb652ac7460d413d3661500fd0094a8852c745561d64242dccd8cd474
MD5 c8cd462a1d3fd2dc9b7b980ecab09260
BLAKE2b-256 1d2f3e5184417ca80da149530618e300b09bbcfa62c812398d007e1ea1a572de

See more details on using hashes here.

File details

Details for the file bresenham-0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for bresenham-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2f63f4b3af628163acc89e6a1752fc51d5129004b464fabb5d9060d7b18d4d7c
MD5 ff97a7ebdee4348a870e0b226265b396
BLAKE2b-256 3a4a51bcac256c7c7c36c07830f9e0aad820f2957212678728117e82374b3d7c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page