From 4770daf4accabbc0e379b83e751114746e569a1a Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Sat, 12 May 2012 11:51:43 +0000 Subject: [PATCH] math: replace len(vec) with length(vec) to match the GLSL naming. --- src/lol/math/vector.h | 14 +++++++------- test/tutorial/03_fractal.cpp | 10 +++++----- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/lol/math/vector.h b/src/lol/math/vector.h index ed3c497f..71c2190a 100644 --- a/src/lol/math/vector.h +++ b/src/lol/math/vector.h @@ -268,7 +268,7 @@ template struct Cmplx return Cmplx(x, -y); } - inline T norm() const { return len(*this); } + inline T norm() const { return length(*this); } #if !defined __ANDROID__ template friend std::ostream &operator<<(std::ostream &stream, Cmplx const &v); @@ -280,7 +280,7 @@ template struct Cmplx template static inline Cmplx re(Cmplx const &val) { - return ~val / sqlen(val); + return ~val / sqlength(val); } template @@ -1002,7 +1002,7 @@ template struct Quat template inline T norm(Quat const &val) { - return sqlen(val); + return sqlength(val); } template @@ -1187,7 +1187,7 @@ static inline Quat operator /(Quat x, Quat const &y) } \ \ tprefix \ - inline type sqlen(tname const &a) \ + inline type sqlength(tname const &a) \ { \ type acc = 0; \ for (size_t n = 0; n < sizeof(a) / sizeof(type); n++) \ @@ -1196,16 +1196,16 @@ static inline Quat operator /(Quat x, Quat const &y) } \ \ tprefix \ - inline double len(tname const &a) \ + inline double length(tname const &a) \ { \ using std::sqrt; \ - return sqrt((double)sqlen(a)); \ + return sqrt((double)sqlength(a)); \ } \ \ tprefix \ inline tname normalize(tname const &val) \ { \ - type norm = (type)len(val); \ + type norm = (type)length(val); \ return norm ? val / norm : val * (type)0; \ } diff --git a/test/tutorial/03_fractal.cpp b/test/tutorial/03_fractal.cpp index c8f3f3cd..4262c007 100644 --- a/test/tutorial/03_fractal.cpp +++ b/test/tutorial/03_fractal.cpp @@ -383,7 +383,7 @@ public: z2 = z1 * z1 + r0; z3 = z2 * z2 + r0; z0 = z3 * z3 + r0; - if (sqlen(z0) >= maxsqlen) + if (sqlength(z0) >= maxsqlen) break; iter -= 4; if (iter < 4) @@ -392,11 +392,11 @@ public: if (iter) { - double n = sqlen(z0); + double n = sqlength(z0); - if (sqlen(z1) >= maxsqlen) { iter += 3; n = sqlen(z1); } - else if (sqlen(z2) >= maxsqlen) { iter += 2; n = sqlen(z2); } - else if (sqlen(z3) >= maxsqlen) { iter += 1; n = sqlen(z3); } + if (sqlength(z1) >= maxsqlen) { iter += 3; n = sqlength(z1); } + else if (sqlength(z2) >= maxsqlen) { iter += 2; n = sqlength(z2); } + else if (sqlength(z3) >= maxsqlen) { iter += 1; n = sqlength(z3); } if (n > maxsqlen * maxsqlen) n = maxsqlen * maxsqlen;