modeling/src/maths/plane/signedDistanceToPoint.js

  1. const vec3 = require('../vec3')
  2. /**
  3. * Calculate the distance to the given point.
  4. *
  5. * @param {plane} plane - plane of reference
  6. * @param {vec3} point - point of reference
  7. * @return {Number} signed distance to point
  8. * @alias module:modeling/maths/plane.signedDistanceToPoint
  9. */
  10. const signedDistanceToPoint = (plane, point) => vec3.dot(plane, point) - plane[3]
  11. module.exports = signedDistanceToPoint