12345678910111213141516 |
- #include "client/math/Plane.h"
- Plane::Plane() : d(0) {
- }
- void Plane::set(const Vector3& va, const Vector3& vb, const Vector3& vc) {
- Vector3 h1 = vb - va;
- Vector3 h2 = vc - va;
- abc = h1.cross(h2);
- abc.normalize();
- d = -h1.dot(va);
- }
- float Plane::getSignedDistance(const Vector3& v) const {
- return abc.dot(v) + d;
- }
|