Plane.cpp 294 B

12345678910111213
  1. #include "math/Plane.h"
  2. Plane::Plane() : d(0) {
  3. }
  4. Plane::Plane(const Vector3& a, const Vector3& b, const Vector3& c) {
  5. abc = static_cast<Vector3>(b - a).cross(c - a).normalize();
  6. d = -abc.dot(a);
  7. }
  8. float Plane::getSignedDistance(const Vector3& v) const {
  9. return abc.dot(v) + d;
  10. }