00001 #include "vector.h" 00002 00003 Vector::Vector () { 00004 x = y = z = 0; 00005 }; 00006 00007 Vector::Vector (GLfloat val) { 00008 x = y = z = val; 00009 }; 00010 00011 Vector::Vector (GLfloat X, GLfloat Y, GLfloat Z) { 00012 x = X; 00013 y = Y; 00014 z = Z; 00015 }; 00016 00017 Vector::Vector (Vector v) { 00018 x = v.x; 00019 y = v.y; 00020 z = v.z; 00021 }; 00022 00023 Vector::~Vector () { 00024 }; 00025 00026 void Vector::operator= (Vector v) { 00027 x = v.x; 00028 y = v.y; 00029 z = v.z; 00030 }; 00031 00032 void Vector::operator= (GLfloat val) { 00033 x = y = z = val; 00034 }; 00035 00036 Vector Vector::operator+ (Vector v) { 00037 Vector tmp; 00038 00039 tmp.x = x + v.x; 00040 tmp.y = y + v.y; 00041 tmp.z = z + v.z; 00042 00043 return tmp; 00044 }; 00045 00046 Vector Vector::operator+ (GLfloat val) { 00047 Vector tmp; 00048 00049 tmp.x = x + val; 00050 tmp.y = y + val; 00051 tmp.z = z + val; 00052 00053 return tmp; 00054 }; 00055 00056 Vector Vector::operator- (Vector v) { 00057 Vector tmp; 00058 00059 tmp.x = x - v.x; 00060 tmp.y = y - v.y; 00061 tmp.z = z - v.z; 00062 00063 return tmp; 00064 }; 00065 00066 Vector Vector::operator- (GLfloat val) { 00067 Vector tmp; 00068 00069 tmp.x = x - val; 00070 tmp.y = y - val; 00071 tmp.z = z - val; 00072 00073 return tmp; 00074 }; 00075 00076 Vector Vector::operator* (Vector v) { 00077 Vector tmp; 00078 00079 // uhm... <blush> I can't remember how to do a vectorproduct... I'll fix this :-) 00080 00081 return tmp; 00082 }; 00083 00084 Vector Vector::operator* (GLfloat val) { 00085 Vector tmp; 00086 00087 tmp.x = x * val; 00088 tmp.y = y * val; 00089 tmp.z = z * val; 00090 00091 return tmp; 00092 };