frechet

1.0.1 • Public • Published

frechet

Calculates the discrete Fréchet distance of two polylines.

The Fréchet distance is a distance metric that represents the similarity of two curves. A way to think about it is to imagine a person walking along the first curve and a dog walking along the second curve. The Fréchet distance represents the shortest leash required to complete the walk without backtracking.

Installation

The library is available on npm. Install with the following command:

npm install frechet

Usage

var frechet = require('frechet');
 
var l1 = [[0, 0], [1, 1], [2, 2]];
var l2 = [[1, 1], [2, 2], [3, 3]];
 
console.log(frechet(l1, l1)); // 0
console.log(frechet(l1, l2)); // 1

Building the library

The library is packaged using rollup.js. To build use the following command:

npm install
rollup -c

The result is available in [dist/index.js].

Running the tests

Run the tests like this:

npm install
npm test

Readme

Keywords

Package Sidebar

Install

npm i frechet

Weekly Downloads

4

Version

1.0.1

License

MIT

Last publish

Collaborators

  • argelius