UNPKG

cubic-beziers-through-points

Version:

A function to fit fair (bending energy minimizing) cubic bezier curves through a set of given ordered points in the plane.

22 lines (15 loc) 400 B
import { squares } from 'squares-rng'; function getRandomPoints( seed: number, n: number) { const seed_ = squares(seed); const points: number[][] = []; for (let i=0; i<n; i++) { points.push([ squares(seed_ + (i*2) + 0), squares(seed_ + (i*2) + 1) ]); } return points; } export { getRandomPoints }