Skip to content

A library for doing fast line simplification (radial distance, ramer - douglas - peucker) in JavaScript.

License

Notifications You must be signed in to change notification settings

leeoniya/simplify2-js

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

simplify2

This is another version of Vladimir Agafonkin's awesome simplify.js library for doing high-performance polyline simplification in JavaScript primarily using the Ramer-Douglas-Peucker simplification algorithm.

Simplify2.js is a collection of similar simplification algorithms that has been somewhat optimized. The douglasPeucker() function does not require any temporary internal memory constructs with a size proportional to the input (for marker array and stack); the use of recursion of cause requires use of some number of stack frames - but this will in practice be very few. The math and flow has also been tweaked so that fewer calculations are needed.

A quite noticeable speedup can be observed on large inputs (>100K+ point) with a low tolerance < 1 for high fidelity output (e.g. needed for LOD generation).

Additional test cases have been added.

Please see in-code API docs.

Usage

var simplify = require('simplify2');
...
var points = [...], // array of {x, y} objects.
    tolerance = 0.2;
    
// run the douglas-peucker simplification 
var simplifiedPoints = simplify.douglasPeucker(points, tolerance);

About

A library for doing fast line simplification (radial distance, ramer - douglas - peucker) in JavaScript.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%