nuclear@23: #include "vector.h" nuclear@23: nuclear@23: Vector2::Vector2() : x(0), y(0) {} nuclear@23: nuclear@23: Vector2::Vector2(float x, float y) nuclear@23: { nuclear@23: this->x = x; nuclear@23: this->y = y; nuclear@23: } nuclear@23: nuclear@23: nuclear@23: Vector3::Vector3() : x(0), y(0), z(0) {} nuclear@23: nuclear@23: Vector3::Vector3(float x, float y, float z) nuclear@23: { nuclear@23: this->x = x; nuclear@23: this->y = y; nuclear@23: this->z = z; nuclear@23: } nuclear@23: nuclear@54: Vector3::Vector3(const float *arr) nuclear@54: { nuclear@54: x = arr[0]; nuclear@54: y = arr[1]; nuclear@54: z = arr[2]; nuclear@54: } nuclear@54: nuclear@23: void Vector3::normalize() nuclear@23: { nuclear@23: float len = sqrt(x * x + y * y + z * z); nuclear@23: if(len != 0.0) { nuclear@23: x /= len; nuclear@23: y /= len; nuclear@23: z /= len; nuclear@23: } nuclear@23: }