Visvalingam’s Line Simplification Algorithm
My implementations of Visvalingam's line simplification algorithm in JS and C♯.
Installing this npm package is easy. Make sure you've got
npm, and then simply run:
npm install --save visvalingam-simplifier
This package is written as an ES6 module, so it should work on any platform that supports it. Make sure you have the npm package installed (see above). Then you can use it like so:
;let points_simple =;
The above will work if you're using a preprocessor such as browserify, webpack, or babel - but it might not work so well if you're using pure Node.JS or in the browser without any of the aforementioned preprocessors. In those cases, you may need to tweak the import statement a bit:
const simplify_line = ;
For the browser:
If you encounter any issues (especially relating to importing / requiring it) - please do let me know by opening an issue! I'll be happy to help 😺
I've also ported the algorithm to C♯ for a project of mine. You can find it here: SimplifyLine.cs. It's actually a slightly modified copy of the real implementation I've done for a secret project of mine, so to that end you'll have to implement your own
Vector class - or tweak it to use the Vector2 class I wrote a while ago.
Found a bug? Experiencing difficulties? Please open an issue! Pull requests are accepted too - so if you've got an improvement / bug fix, I'll glading merge 😺
I found the follwing links useful when implementing this module:
This package is licensed under the Mozilla Public License 2.0. The full license text is available here - along with a summary by GitHub on what you can and can't so with it.