# adaptive-bezier-curve

> adaptive and scalable 2D bezier curves

Latest version **1.0.3** (published 2014-11-02) · BSD-3-Clause license · 0 weekly downloads

## Install

```sh
npm install adaptive-bezier-curve
pnpm add adaptive-bezier-curve
yarn add adaptive-bezier-curve
bun add adaptive-bezier-curve
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2014-11-02 |
| First published | 2014-11-01 |
| Weekly downloads | 0 |
| License | BSD-3-Clause |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 149 |
| Author | Matt DesLauriers |
| Maintainers | mattdesl |
| Keywords | bezier, quadratic, curve, adaptive, approximate, quadraticCurveTo, bezierCurveTo, line, path, rendering, canvas, draw, drawing, webgl, segments |

## Links

- npm: https://www.npmjs.com/package/adaptive-bezier-curve
- Repository: https://github.com/mattdesl/adaptive-bezier-curve
- Issues: https://github.com/mattdesl/adaptive-bezier-curve/issues
- npm.io page: https://npm.io/package/adaptive-bezier-curve

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 1.0.3 (latest) — 2014-11-02
- 1.0.2 — 2014-11-02
- 1.0.1 — 2014-11-01
- 1.0.0 — 2014-11-01

## README

# adaptive-bezier-curve

[![stable](http://badges.github.io/stability-badges/dist/stable.svg)](http://github.com/badges/stability-badges)

Builds a bezier curve that is adaptive; that is to say, it has more points along curved corners, and less points along straight lines. This can be used to produce scalable curves that are consistently smooth, while using a small number of steps. Based on [AntiGrain](http://antigrain.com/research/adaptive_bezier/).

Also see [adaptive-quadratic-curve](https://nodei.co/npm/adaptive-quadratic-curve/).

```js
var bezier = require('adaptive-bezier-curve')

var start = [20, 20],
    c1 = [100, 159],
    c2 = [50, 200],
    end = [200, 20],
    scale = 2

var points = bezier(start, c1, c2, end, scale)

//returns a list of 2d points: [ [x,y], [x,y], [x,y] ... ]
```

See [demo/index.js](demo/index.js) for an example with HTML5 canvas.

![img](http://i.imgur.com/iEQCFY3.png)

## Usage

[![NPM](https://nodei.co/npm/adaptive-bezier-curve.png)](https://nodei.co/npm/adaptive-bezier-curve/)

#### `bezier(start, c1, c2, end[, scale, points])`

Returns an adaptive bezier curve for the given four control points. You can specify a `scale` to produce better smoothing for scaled contexts, otherwise it defaults to 1.0.

If you specify a `points` array, the new points will be pushed onto that array (useful for building paths). If you don't specify `points`, a new array will be used.

## License

The AntiGrain 2.4 code is licensed under BSD-3-Clause, see [LICENSE.md](http://github.com/mattdesl/adaptive-bezier-curve/blob/master/LICENSE.md) for details.

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