123456789101112131415161718192021 |
- #include "core/math/Plane.hpp"
- Core::Plane::Plane() : abc(), d(0) {
- }
- Core::Plane::Plane(const Vector3& a, const Vector3& b, const Vector3& c)
- : abc((b - a).cross(c - a).normalize()), d(-abc.dot(b)) {
- }
- float Core::Plane::getSignedDistance(const Vector3& v) const {
- return abc.dot(v) + d;
- }
- void Core::Plane::toString(BufferString& s) const {
- s.append("(");
- s.append(abc[0]).append(" x + ");
- s.append(abc[1]).append(" y + ");
- s.append(abc[2]).append(" z + ");
- s.append(d);
- s.append(')');
- }
|