瀏覽代碼

Implement vector square length.

legacy
Sam Hocevar sam 14 年之前
父節點
當前提交
dc45c9e426
共有 1 個檔案被更改,包括 7 行新增2 行删除
  1. +7
    -2
      src/matrix.h

+ 7
- 2
src/matrix.h 查看文件

@@ -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…
取消
儲存