/**********************************************************************
This file is part of Crack dot Com's free source code release of
Golgotha.
for
information about compiling & licensing issues visit this URL
If that doesn't help, contact Jonathan Clark at golgotha_source@usa.net (Subject should have "GOLG" in it) ***********************************************************************/ #ifndef __VECTOR_TEMPLATE_HPP_ #define __VECTOR_TEMPLATE_HPP_ #include "math/num_type.hh" #includetemplate class i4_vector_template { public: T elt[dimension]; i4_vector_class() {} i4_vector_class(const T v) { for (int i=0; i class i4_vector3_class : public i4_vector_class<3,T> { enum { x,y,z }; public: i4_vector3_class() {}; i4_vector3_class(i4_float _x, i4_float _y, i4_float _z) { elt[x]=_x; elt[y]=_y; elt[z]=_z; } const i4_vector3_class& cross(i4_vector3_class b) { i4_vector3_class temp(*this); elt[x] = temp.elt[y]*b.elt[z] - temp.elt[z]*b.elt[y]; elt[y] = temp.elt[z]*b.elt[x] - temp.elt[x]*b.elt[z]; elt[z] = temp.elt[x]*b.elt[y] - temp.elt[y]*b.elt[x]; return *this; } void set(i4_float _x, i4_float _y, i4_float _z) { elt[x]=_x; elt[y]=_y; elt[z]=_z; } }; typedef i4_vector3_class i4_3d_vector; typedef i4_vector_class<4,i4_float> i4_4d_vector; #endif