Package Exports
- point-line-distance
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (point-line-distance) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
point-line-distance
Computes the distance between a point and a line defined with any two points lying on it
Install
$ npm install --save point-line-distanceUsage
Let
var point = [1, 0, 1]
var a = [1, 2, -1]
var b = [2, 0, 3]Compute the distance as follows
var pld = require('point-line-distance');
pld(point, a, b) // Math.sqrt(8 / 7)If you need the squared distance require squared as follows
var pldSquared = require('point-line-distance/squared');
pldSquared(point, a, b) // 8 / 7API
pld = require('point-line-distance')pld(point, a, b)
params
point[Array] the target pointa[Array] andb[Array] are two points that define a line
returns
The distance between point and the line defined by a and b
throws
Throws an error when a === b
License
2015 MIT © Mauricio Poppe