www.pudn.com > zfxcengine-0.1.0.zip > cePlane4f.cpp
///////////////////////////////////////////////////////////////////////// // Module: Input //! \file cePlane4f //! \brief PLane definition in parameter form (float) //! \author Kim Kulling aka kimmi // // Licence : LGPL ///////////////////////////////////////////////////////////////////////// #include "Math/ceMath.h" #include#include namespace ZFXCE { //------------------------------------------------------------------------------ using namespace std; //------------------------------------------------------------------------------ cePlane4f::cePlane4f() : m_fA(0), m_fB(0), m_fC(0), m_fD(0) { // empty } //------------------------------------------------------------------------------ cePlane4f::cePlane4f(const FLOAT a, const FLOAT b, const FLOAT c, const FLOAT d) : m_fA(a), m_fB(b), m_fC(c), m_fD(d) { // empty } //------------------------------------------------------------------------------ void cePlane4f::NormalizePlane() { const FLOAT fMag =1 / sqrt(m_fA * m_fA + m_fB * m_fB + m_fC * m_fC + m_fD * m_fD); m_fA *= fMag; m_fB *= fMag; m_fC *= fMag; m_fD *= fMag; } //------------------------------------------------------------------------------ ceHalfSpace cePlane4f::ClassifyPoint(ceVec3f &Vertices) { const FLOAT d = m_fA * Vertices[0] + m_fB * Vertices[1] + m_fC * m_fC + m_fD; if (d < 0) return PLANE_NEGATIVE; if (d > 0) return PLANE_POSITIVE; return PLANE_ONPLANE; } //------------------------------------------------------------------------------ } // Namespace ZFXCE