Skip to content

Instantly share code, notes, and snippets.

@sketchpunk
sketchpunk / _CURVES_IN_JS.md
Last active April 5, 2024 18:42
Curves in Javascript

Curves in Javascript

Collection of algorithms related to using curves written in javascript.

Curve Types

  • Cubic Bezier Splines : inc. derivative, 2nd derivative, normals, easing
  • Catmull Rom
  • Kochanek Bartels ( TCB Splines ) : inc. derivative
  • Lemniscate of Bernoulli and Gerono : inc. derivative
  • Watt's Curve
  • Torus Knot : inc. derivative, 2nd derivative
@arifd
arifd / edgeDetect.js
Created March 16, 2020 14:57
Simple, fast Sobel Edge Detection in Javascript
// I wrote a sobel edge detector in Javascript!
// todo: try Laplacian of Gaussian (LoG) instead of Sobel
// Example usage (taking the pxiels 1D):
// const edge = createEdgeMapFromImageData(imageData);
// for (const i in edge) {
// let x = i % canvas.width;
// let y = (i - x) / canvas.width;
// ctx.fillStyle = `rgba(${edge[i]},${edge[i]},${edge[i]},255)`;
// ctx.fillRect(x, y, 1, 1 );