Skip to content

Instantly share code, notes, and snippets.

@ramjoshi
ramjoshi / rdp.js
Created July 26, 2012 16:55 — forked from rhyolight/rdp.js
Ramer-Douglas-Peucker line filtering algorithm in JavaScript
function findPerpendicularDistance(point, line) {
var pointX = point[0],
pointY = point[1],
lineStart = {
x: line[0][0],
y: line[0][1]
},
lineEnd = {
x: line[1][0],
y: line[1][1]