Commit d0e7bc11 authored by Starbeamrainbowlabs's avatar Starbeamrainbowlabs
Browse files

Write readme.

parent 0c161525
# Visvalingam’s Algorithm Implementations
> My implementations of Visvalingam's line simplification algorithm in JS and C#♯.
> My implementations of Visvalingam's line simplification algorithm in JS and C#♯ (C♯ coming soon).
# Install
Installing this npm package is easy. Make sure you've got `npm`, and then simply run:
```bash
npm install --save visvalingam-simplifier
```
## Usage
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:
```js
import { simplify_line } from "visvalingam-simplifier";
let points_simple = simplify_line([
{ x:389, y: 361 },
{ x:445, y: 239 },
{ x:461, y: 228 },
{ x:501, y: 208 },
{ x:556, y: 195 },
{ x:603, y: 209 },
{ x:678, y: 262 },
{ x:735, y: 279 },
{ x:795, y: 263 },
{ x:838, y: 222 },
{ x:861, y: 172 }
], 6);
```
The above will work if you're using a preprocessor such as [browserify](http://browserify.org/), [webpack](https://webpack.js.org/), or [babel](https://babeljs.io/) - 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:
For Node.js:
```js
const simplify_line = require("visvalingam-simplifier");
```
For the browser:
```js
import { simplify_line } from "./node_modules/visvalingam-simplifier/simplify_line.js";
```
If you encounter any issues (especially relating to importing / requiring it) - please do let me know by [opening an issue](https://github.com/sbrl/line-simplification/issues/new)! I'll be happy to help :smiley_cat:
## Contribute
Found a bug? Experiencing difficulties? Please [open an issue](https://github.com/sbrl/line-simplification/issues/new)! Pull requests are accepted too - so if you've got an improvement / bug fix, I'll glading merge :smiley_cat:
## Links
I found the follwing links useful when implementing this module:
- https://bost.ocks.org/mike/simplify/
## License
This package is licensed under the _Mozilla Public License 2.0_. The full license text is available [here](https://github.com/sbrl/line-simplification/blob/master/LICENSE) - along with a summary by GitHub on what you can and can't so with it.
If you'd like to do something that's prohibited by the license - please do get in touch! My email address is available on my [GitHub profie](https://github.com/sbrl).
......@@ -2,7 +2,7 @@
"name": "visvalingam-simplifier",
"version": "0.1.0",
"description": "An implementation of visvalingam's line simplification algorithm.",
"main": "ramer-douglas-peucker.js",
"main": "simplify_line.js",
"directories": {
"lib": "lib"
},
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment