Plane.cpp 289 B

123456789101112
  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()), d(-abc.dot(b)) {
  6. }
  7. float Plane::getSignedDistance(const Vector3& v) const {
  8. return abc.dot(v) + d;
  9. }