inline DXPlane::DXPlane(const float _a, const float _b, const float _c, const float _d)
{
	a = _a; 
	b = _b; 
	c = _c; 
	d = _d;
}

inline DXPlane::DXPlane(const float* const p)
{
	a = p[0];
	b = p[1];
	c = p[2];
	d = p[3];
}

inline DXPlane::DXPlane(const DXPlane &p)
{
	a = p.a;
	b = p.b;
	c = p.c;
	d = p.d;
}

// casting
inline DXPlane::operator float* ()
{
    return (float *) &a;
}

inline DXPlane::operator const float* () const
{
    return (const float *) &a;
}


// assignment operators
inline DXPlane& DXPlane::operator *= ( float f )
{
    a *= f;
    b *= f;
    c *= f;
    d *= f;
    return *this;
}

inline DXPlane& DXPlane::operator /= ( float f )
{
    float fInv = 1.0f / f;
    a *= fInv;
    b *= fInv;
    c *= fInv;
    d *= fInv;
    return *this;
}


// unary operators
inline DXPlane DXPlane::operator + () const
{
    return *this;
}

inline DXPlane DXPlane::operator - () const
{
    return DXPlane(-a, -b, -c, -d);
}


// binary operators
inline DXPlane DXPlane::operator * ( float f ) const
{
    return DXPlane(a * f, b * f, c * f, d * f);
}

inline DXPlane DXPlane::operator / ( float f ) const
{
    float fInv = 1.0f / f;
    return DXPlane(a * fInv, b * fInv, c * fInv, d * fInv);
}

inline DXPlane operator * (float f, const DXPlane& p )
{
    return DXPlane(f * p.a, f * p.b, f * p.c, f * p.d);
}

inline bool DXPlane::operator == ( const DXPlane& p ) const
{
    return a == p.a && b == p.b && c == p.c && d == p.d;
}

inline bool DXPlane::operator != ( const DXPlane& p ) const
{
    return a != p.a || b != p.b || c != p.c || d != p.d;
}

//get-set functions
inline DXVector3 DXPlane::GetNormal(void) const
{
	return DXVector3(a, b, c);
}

//calculations
inline float DXPlane::DotCoord(const DXVector3& p) const
{
	return D3DXPlaneDotCoord((D3DXPLANE*)this, (D3DXVECTOR3*)&p);
}

inline float DXPlane::DotNormal(const DXVector3& p) const
{
	return D3DXPlaneDotNormal((D3DXPLANE*)this, (D3DXVECTOR3*)&p);
}

//plane construction
inline DXPlane DXPlane::FromPointNormal(const DXVector3& p, const DXVector3& n)
{
	DXPlane temp;
	D3DXPlaneFromPointNormal((D3DXPLANE*)&temp, (D3DXVECTOR3*)&p, (D3DXVECTOR3*)&n);
	return temp;
}

inline DXPlane DXPlane::FromPoints(const DXVector3& v1, const DXVector3& v2, const DXVector3& v3)
{
	DXPlane temp;
	D3DXPlaneFromPoints((D3DXPLANE*)&temp, (D3DXVECTOR3*)&v1, (D3DXVECTOR3*)&v2, (D3DXVECTOR3*)&v3);
	return temp;
}