Plane.h 737 B

123456789101112131415161718192021222324252627
  1. #ifndef CORE_PLANE_H
  2. #define CORE_PLANE_H
  3. #include "math/Vector.h"
  4. #include "utils/ArrayString.h"
  5. namespace Core {
  6. class Plane final {
  7. Vector3 abc;
  8. float d;
  9. public:
  10. Plane();
  11. Plane(const Vector3& a, const Vector3& b, const Vector3& c);
  12. float getSignedDistance(const Vector3& v) const;
  13. // returns true on error and calls the error callback
  14. template<int L>
  15. check_return bool toString(ArrayString<L>& s) const {
  16. return s.append("(") || s.append(abc[0]) || s.append(" x + ") ||
  17. s.append(abc[1]) || s.append(" y + ") || s.append(abc[2]) ||
  18. s.append(" z + ") || s.append(d) || s.append(')');
  19. }
  20. };
  21. }
  22. #endif