Vector4 inline definitions, and rearrangement into multiple inl files
[gph-math] / src / vector2.inl
1 inline void Vector2::normalize()
2 {
3         float len = (float)sqrt(x * x + y * y);
4         if(len != 0.0f) {
5                 x /= len;
6                 y /= len;
7         }
8 }
9
10 inline float &Vector2::operator[] (int idx)
11 {
12         return idx == 0 ? x : y;
13 }
14
15 inline const float &Vector2::operator[] (int idx) const
16 {
17         return idx == 0 ? x : y;
18 }