
#include <WFX/math/Plane.h>

using namespace WFX;
using namespace WFX::math;

Plane::Side Plane::side(const Vector3& p) const {
    Real dist = distance(p);
    if (dist < 0.0f)
        return NEGATIVE_SIDE;
    if (dist > 0.0f)
        return POSITIVE_SIDE;
    return NO_SIDE;
}

Real Plane::distance(const Vector3& p) const {
    return Normal.dot(p) + D;
}

void Plane::normalize() {
    Real length = Normal.length();
    Normal /= length;
    D /= length;
}

