/*****************************************************************************
 * $Id: eng_class_math.hh,v 1.9 2006/10/18 05:00:07 devel Exp $
 * @file
 * @author	Jim E. Brooks  http://www.jimbrooks.org
 * @brief	Math functions.
 *//*
 * LEGAL:	COPYRIGHT (C) 2004 JIM E. BROOKS
 *          THIS SOURCE CODE IS RELEASED UNDER THE TERMS
 *          OF THE GNU GENERAL PUBLIC LICENSE (GPL).
 *****************************************************************************/

// -- included inside the Engine class --

public:

/*****************************************************************************
 * Faster variants of TransformVertex() (see gfx/gfx/src/gfx_math.hh).
 *****************************************************************************/
inline void
TransformVertex( EyeVertex& v2, const WorldVertex& v )
{
	fp x = v.x + mEye.mCm[Ox];
	fp y = v.y + mEye.mCm[Oy];
	fp z = v.z + mEye.mCm[Oz];
	v2.x = x * mEye.mCm[Xx] + y * mEye.mCm[Xy] + z * mEye.mCm[Xz];
	v2.y = x * mEye.mCm[Yx] + y * mEye.mCm[Yy] + z * mEye.mCm[Yz];
	v2.z = x * mEye.mCm[Zx] + y * mEye.mCm[Zy] + z * mEye.mCm[Zz];
}
inline void
TransformVertex( EyeVertex* v2, const Position& pos )
{
	fp x = pos.x + mEye.mCm[Ox];
	fp y = pos.y + mEye.mCm[Oy];
	fp z = pos.z + mEye.mCm[Oz];
	v2->x = x * mEye.mCm[Xx] + y * mEye.mCm[Xy] + z * mEye.mCm[Xz];
	v2->y = x * mEye.mCm[Yx] + y * mEye.mCm[Yy] + z * mEye.mCm[Yz];
	v2->z = x * mEye.mCm[Zx] + y * mEye.mCm[Zy] + z * mEye.mCm[Zz];
}

/*****************************************************************************
 * Useful for testing if an object is facing by calculating only eye Z.
 *****************************************************************************/
inline fp
TransformZ( const WorldVertex& v )
{
	fp x = v.x + mEye.mCm[Ox];
	fp y = v.y + mEye.mCm[Oy];
	fp z = v.z + mEye.mCm[Oz];
	return x * mEye.mCm[Zx] + y * mEye.mCm[Zy] + z * mEye.mCm[Zz];
}

private:
