Skip to content

Yay295/fitCurves

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JavaScript implementation of
CoffeeScript implementation of
Python implementation of
Algorithm for Automatically Fitting Digitized Curves
by Philip J. Schneider
"Graphics Gems", Academic Press, 1990

Usage

  1. Include the JavaScript file.

If you included fitCurves.js or fitCurves3D.js

  1. Call fitCurves(a,e) with an array of points to fit a curve to, and a non-negative number for how close of an approximation you want (smaller numbers giving a more accurate result).
  2. The function will return an array of arrays of the four points required to plot a cubic Bézier curve.

If you included fitCurvesAlt.js

  1. Call fitCurves(a) with an array of points to fit a curve to.
  2. The function will return a single array of the four points required to plot a cubic Bézier curve.

A 'point' is just an array of two numbers (or three numbers for the 3D version).

History

This code was originally committed as part of a different repository on February 28, 2016. Back then I didn't use GitHub as much, so I didn't bother uploading it in its own repository. The history of this repository up to version 3 (8c85212) was recreated from changes made in that repository.

Currently our forks are essentially the same. The main differences being that mine just has the JavaScript files (not having an online demo or being NPM/Bower compatible), and that I have two alternate versions. One that works in three dimensions, and one that returns the point for a single curve rather than an array of curves. Also mine is quite a bit smaller and more self-contained.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%