/////////////////////////////////////////////////////////////
// CINEMA 4D SDK                                           //
/////////////////////////////////////////////////////////////
// (c) 1989-2004 MAXON Computer GmbH, all rights reserved  //
/////////////////////////////////////////////////////////////

#ifndef __QUATERNION_H
#define __QUATERNION_H

#include "ge_matrix.h"
#include "ge_lvector.h"
#include "ge_lmatrix.h"

class Quaternion
{
	public:
		Quaternion(void);

		LReal   w; // angle
		LVector v; // direction vector

		LMatrix GetMatrix(void);						 // derive rotation matrix from quaternion
		void    SetMatrix(const LMatrix &m); // derive quaternion values from matrix

		void SetAxis(const LVector &axis, const LReal wink); // set quaternion values directly

		void Scale(const LReal s);
};


Quaternion QSlerp (const Quaternion &q1, const Quaternion &q2, LReal alfa); // linear interpolation between two quaternions
Quaternion QNorm  (const Quaternion &q);
Quaternion QMul   (const Quaternion &q1, const Quaternion &q2);
Quaternion QMul   (const Quaternion &q, LReal s);
Quaternion QPlus  (const Quaternion &q1, const Quaternion &q2);
Quaternion QInvert(const Quaternion &q);
Quaternion QDeriv (const Quaternion &q, const LVector &w);

LMatrix LHPBToMatrix(const LVector &w);

#endif
