diff --git a/test/vector.cpp b/test/vector.cpp index ba4a82a5..e1134f5e 100644 --- a/test/vector.cpp +++ b/test/vector.cpp @@ -115,7 +115,7 @@ main () tap.expect (!is_normalised (util::vector3f::ONES), "ones isn't normalised"); tap.expect_eq ( - util::hypot (util::vector3f{0,1,2}, util::vector3f{3,2,4}), + util::hypot (util::vector3f{0,1,2} - util::vector3f{3,2,4}), std::sqrt (14.f), "vector3f hypot" ); diff --git a/vector.hpp b/vector.hpp index 523d1fc8..060b332a 100644 --- a/vector.hpp +++ b/vector.hpp @@ -50,11 +50,11 @@ namespace util { template vector<2,T> to_euler (vector<3,T>); template vector<3,T> from_euler (vector<2,T>); - // power functions + // root of sum of squares template constexpr T - hypot (util::vector, util::vector); + hypot (util::vector); // output and serialisation operators template diff --git a/vector.ipp b/vector.ipp index e9624569..11897cf8 100644 --- a/vector.ipp +++ b/vector.ipp @@ -38,8 +38,7 @@ util::vector::homog (void) const template constexpr T -util::hypot (util::vector a, util::vector b) +util::hypot (util::vector v) { - auto c = a - b; - return std::sqrt (sum (c * c)); + return std::sqrt (sum (v * v)); }