include/quaternion.h
branchpyrit
changeset 103 3b3257a410fe
parent 94 4c8abb8977dc
equal deleted inserted replaced
102:de3e9ea18f56 103:3b3257a410fe
    24  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    24  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    25  * THE SOFTWARE.
    25  * THE SOFTWARE.
    26  */
    26  */
    27 
    27 
    28 #ifndef QUATERNION_H
    28 #ifndef QUATERNION_H
    29 #define QUATER_H
    29 #define QUATERNION_H
    30 
    30 
    31 /**
    31 /**
    32  * quaternion class
    32  * quaternion class
    33  */
    33  */
    34 class Quaternion
    34 class Quaternion
    62 	{
    62 	{
    63 		return (a*a + b*b + c*c + d*d);
    63 		return (a*a + b*b + c*c + d*d);
    64 	};
    64 	};
    65 	Float mag() const
    65 	Float mag() const
    66 	{
    66 	{
    67 		return sqrtf(mag());
    67 		return sqrtf(mag2());
    68 	};
    68 	};
    69 	friend Quaternion operator*(const Quaternion &q1, const Quaternion &q2)
    69 	friend Quaternion operator*(const Quaternion &q1, const Quaternion &q2)
    70 	{
    70 	{
    71 		return Quaternion(
    71 		return Quaternion(
    72 			q1.a*q2.a - q1.b*q2.b - q1.c*q2.c - q1.d*q2.d,
    72 			q1.a*q2.a - q1.b*q2.b - q1.c*q2.c - q1.d*q2.d,