@tiaanduplessis/get-euclidean-distance
v1.0.0
Published
Get distance between two coordinates using euclidean distance formula
Downloads
1
Readme
@tiaanduplessis/get-euclidean-distance
Get distance between two coordinates using euclidean distance formula
Table of Contents
Install
This project uses node and npm.
$ npm install @tiaanduplessis/get-euclidean-distance
$ # OR
$ yarn add @tiaanduplessis/get-euclidean-distance
Usage
const getEuclideanDistance = require('@tiaanduplessis/get-euclidean-distance')
const p1 = {
lat: 11,
lng: 12
}
const p2 = {
lat: 13,
lng: 14
}
const p3 = {
x: 11,
y: 12
}
const p4 = {
x: 13,
y: 14
}
console.log(getEuclideanDistance(p1, p2, { xName: 'lat', yName: 'lng' })) // 2.8284271247461903
console.log(getEuclideanDistance(p1, p2, { xName: 'lat', yName: 'lng' })) // 2.8284271247461903
console.log(getEuclideanDistance(p3, p4)) // 2.8284271247461903
Contribute
- Fork it and create your feature branch: git checkout -b my-new-feature
- Commit your changes: git commit -am 'Add some feature'
- Push to the branch: git push origin my-new-feature
- Submit a pull request
License
MIT