# bezier-subdivide

> Bezier curve subdivision

Latest version **0.0.2** (published 2022-05-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install bezier-subdivide
pnpm add bezier-subdivide
yarn add bezier-subdivide
bun add bezier-subdivide
```

## Health

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

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

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2022-05-02 |
| First published | 2016-04-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 23.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Ryohei Ikegami |
| Maintainers | seanchas116 |

## Links

- npm: https://www.npmjs.com/package/bezier-subdivide
- Repository: https://github.com/seanchas116/subdivide-js
- Issues: https://github.com/seanchas116/subdivide-js/issues
- npm.io page: https://npm.io/package/bezier-subdivide

## Recent versions

- 0.0.2 (latest) — 2022-05-02
- 0.0.1 — 2016-04-11

## README

# bezier-subdivide

[![Build Status](https://travis-ci.org/seanchas116/bezier-subdivide.svg?branch=master)](https://travis-ci.org/seanchas116/bezier-subdivide)

Bezier curve subdivision in JavaScript

Based on [Anti-Grain Geometry bezier subdivision](http://antigrain.com/research/adaptive_bezier/)

## Usage

Points are represented by 2-element arrays.

```javascript
var subdivide = require("bezier-subdivide");

var curve = [
  [100, 200],
  [200, 50],
  [50, 100],
  [200, 200],
];
var points = subdivide(curve); // subdivided points
```

[![https://gyazo.com/f8584661f74872afd5ed33699bca0e5b](https://i.gyazo.com/f8584661f74872afd5ed33699bca0e5b.png)](https://gyazo.com/f8584661f74872afd5ed33699bca0e5b)

### `subdivide(points[, options])`

- `points`: Array of points (start, control point 1, control point 2, end)

## Types

```ts
type Point = [number, number];

interface Options {
  approximationScale?: number;
  angleTolerance?: number;
  cuspLimit?: number;
}

declare function subdivide(
  bezierPoints: [Point, Point, Point, Point],
  options?: Options
): Point[];

export default subdivide;
```

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