Skip to content

Instantly share code, notes, and snippets.

@atandrau
Created February 28, 2011 12:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atandrau/847239 to your computer and use it in GitHub Desktop.
Save atandrau/847239 to your computer and use it in GitHub Desktop.
Distance from Point (x, y, z) to Plane (ax + by + cz + d = 0)
double Point::distanceTo(Plane p) {
return abs( p.a * x + p.b * y + p.c * z + p.d) /
sqrt(p.a * p.a + p.b * p.b + p.c * p.c);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment