Преглед на файлове

Implement vector square length.

legacy
Sam Hocevar sam преди 15 години
родител
ревизия
dc45c9e426
променени са 1 файла, в които са добавени 7 реда и са изтрити 2 реда
  1. +7
    -2
      src/matrix.h

+ 7
- 2
src/matrix.h Целия файл

@@ -60,12 +60,17 @@
return ret; \ return ret; \
} \ } \
\ \
inline float len() const \
inline T sqlen() const \
{ \ { \
T acc = 0; \ T acc = 0; \
for (int n = 0; n < elems; n++) \ for (int n = 0; n < elems; n++) \
acc += (*this)[n] * (*this)[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 template <typename T> struct Vec2


Зареждане…
Отказ
Запис