bezier-subdivide
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

bezier-subdivide

Build Status

Bezier curve subdivision in JavaScript

Based on Anti-Grain Geometry bezier subdivision

Usage

Points are represented by 2-element arrays.

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

subdivide(points[, options])

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

Types

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;

Readme

Keywords

none

Package Sidebar

Install

npm i bezier-subdivide

Weekly Downloads

0

Version

0.0.2

License

MIT

Unpacked Size

23.9 kB

Total Files

10

Last publish

Collaborators

  • seanchas116