Просмотр исходного кода

Implement vector square length.

legacy
Sam Hocevar sam 15 лет назад
Родитель
Сommit
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


Загрузка…
Отмена
Сохранить