1.0.1 • Published 8 years ago

point-plane-distance v1.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

point-plane-distance

npm Build Status js-standard-style

Computes the distance between a point and a plane defined with any three points lying on it

Install

$ npm install --save point-plane-distance

Usage

Let

var point = [0, 0, -5]
var a = [0, 0, 0]
var b = [1, 0, 0]
var c = [0, 1, 0]

Compute the distance as follows

var ppd = require('point-plane-distance');
ppd(point, a, b, c)  // 5

p is actually behind the plane abc, if you want the signed distance require the file signed

var ppdSigned = require('point-plane-distance/signed');
ppdSigned(point, a, b, c)  // -5

API

ppd = require('point-plane-distance')

ppd(point, a, b, c)

params

  • point {Array} the target point
  • a, b, c {Array} are three points lying on some plane

returns {Number}

The distance between point and the plane containing a, b, and c

License

2015 MIT © Mauricio Poppe