# bresenham

> Bresenham's line algorithm

Latest version **0.0.4** (published 2016-01-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install bresenham
pnpm add bresenham
yarn add bresenham
bun add bresenham
```

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2016-01-14 |
| First published | 2014-05-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/bresenham) |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 69 |
| Author | Bence Dányi |
| Maintainers | lennon |
| Keywords | line, bresenham, math |

## Links

- npm: https://www.npmjs.com/package/bresenham
- Repository: https://github.com/madbence/node-bresenham
- Issues: https://github.com/madbence/node-bresenham/issues
- npm.io page: https://npm.io/package/bresenham

## Alternatives

- [localforage](https://npm.io/package/localforage.md) — 6.2M weekly downloads
- [localforage-observable](https://npm.io/package/localforage-observable.md) — 30.8K weekly downloads
- [@y/y](https://npm.io/package/@y/y.md) — 30.1K weekly downloads
- [@metaobjectsdev/render](https://npm.io/package/@metaobjectsdev/render.md) — 3.5K weekly downloads
- [@ledgerhq/coin-algorand](https://npm.io/package/@ledgerhq/coin-algorand.md) — 1.1K weekly downloads

## Recent versions

- 0.0.4 (latest) — 2016-01-14
- 0.0.3 — 2014-06-11
- 0.0.2 — 2014-05-21
- 0.0.1 — 2014-05-05
- 0.0.0 — 2014-05-05

## README

# node-bresenham [![Build Status](https://travis-ci.org/madbence/node-bresenham.svg?branch=master)](https://travis-ci.org/madbence/node-bresenham)

[Bresenham's line algorithm](http://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm)
in node. ES6 generators are supported! \o/

## Install

```
$ npm install bresenham
```

## API

#### bresenham(x0, y0, x1, y1[, fn])

Calls `fn` with points between `(x0, y0)` and `(x1, y1)`.
The points have integer coordinates.

If `fn` is omitted, an array of points is returned.

The algorithm uses no floating point arithmetics,
so it's considered to be fast. But JS numbers are not
integers, so I'm not sure whether this is a faster
approach than the naive algorithm or not.

## ES6 API

If you `require('bresenham/generator')`, you can use the generator API.

#### bresenham(x0, y0, x1, y1)

Creates a generator that yields every point between `(x0, y0)` and `(x1, y1)`.

```js
var line = bresenham(1, 2, 3, 4);
do {
  var point = line.next().value;
  // do something
} while(point);
```

## License

MIT

---
_Source: https://npm.io/package/bresenham · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
