planeDistance.glsl 926 B

12345678910111213141516171819202122232425262728
  1. /**
  2. * Computes distance from a point to a plane.
  3. *
  4. * @name czm_planeDistance
  5. * @glslFunction
  6. *
  7. * param {vec4} plane A Plane in Hessian Normal Form. See Plane.js
  8. * param {vec3} point A point in the same space as the plane.
  9. * returns {float} The distance from the point to the plane.
  10. */
  11. float czm_planeDistance(vec4 plane, vec3 point) {
  12. return (dot(plane.xyz, point) + plane.w);
  13. }
  14. /**
  15. * Computes distance from a point to a plane.
  16. *
  17. * @name czm_planeDistance
  18. * @glslFunction
  19. *
  20. * param {vec3} planeNormal Normal for a plane in Hessian Normal Form. See Plane.js
  21. * param {float} planeDistance Distance for a plane in Hessian Normal form. See Plane.js
  22. * param {vec3} point A point in the same space as the plane.
  23. * returns {float} The distance from the point to the plane.
  24. */
  25. float czm_planeDistance(vec3 planeNormal, float planeDistance, vec3 point) {
  26. return (dot(planeNormal, point) + planeDistance);
  27. }