projects
/
gph-math
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
64aa0c473542c4111016d7904d14f38e1dbd4e97
[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
}