npm.io
1.0.2 • Published 7 years ago

koch-curve

Licence
GPL-3.0
Version
1.0.2
Deps
0
Size
36 kB
Vulns
0
Weekly
0

Koch curve

Koch curve's points generator

Install

npm i koch-curve

Use

The function processLine receives 3 parameters: the first two are the points that define the line, and the third one is the number of levels to process. It returns a list of points.

const {processLine} = require('koch-curve');

const points = processLine({x:-200, y:0}, {x:200, y:0}, 6);

Visualization using Three.js:

Image