clray

view src/vector.cc @ 27:8b2f2ad14ae7

semi-fixed the kdtree construction
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 17 Aug 2010 20:35:00 +0100
parents
children 6a30f27fa1e6
line source
1 #include "vector.h"
3 Vector2::Vector2() : x(0), y(0) {}
5 Vector2::Vector2(float x, float y)
6 {
7 this->x = x;
8 this->y = y;
9 }
12 Vector3::Vector3() : x(0), y(0), z(0) {}
14 Vector3::Vector3(float x, float y, float z)
15 {
16 this->x = x;
17 this->y = y;
18 this->z = z;
19 }
21 void Vector3::normalize()
22 {
23 float len = sqrt(x * x + y * y + z * z);
24 if(len != 0.0) {
25 x /= len;
26 y /= len;
27 z /= len;
28 }
29 }