Browse Source

Implement vector square length.

legacy
Sam Hocevar sam 14 years ago
parent
commit
dc45c9e426
1 changed files with 7 additions and 2 deletions
  1. +7
    -2
      src/matrix.h

+ 7
- 2
src/matrix.h View File

@@ -60,12 +60,17 @@
return ret; \
} \
\
inline float len() const \
inline T sqlen() const \
{ \
T acc = 0; \
for (int n = 0; n < elems; n++) \
acc += (*this)[n] * (*this)[n]; \
return sqrtf((float)acc); \
return acc; \
} \
\
inline float len() const \
{ \
return sqrtf((float)sqlen()); \
}

template <typename T> struct Vec2


Loading…
Cancel
Save