vector: remove difference methods

This commit is contained in:
Danny Robson 2016-08-11 16:33:42 +10:00
parent 1f3b44a20e
commit ead926bed2
2 changed files with 4 additions and 27 deletions

View File

@ -30,28 +30,6 @@ using util::vector3f;
using util::vector3d;
///////////////////////////////////////////////////////////////////////////////
template <size_t S, typename T>
T
util::vector<S,T>::difference (vector<S,T> rhs) const
{
// TODO: change the signature to ensure it does not truncate
return static_cast<T> (std::sqrt (difference2 (rhs)));
}
//-----------------------------------------------------------------------------
template <size_t S, typename T>
T
util::vector<S,T>::difference2 (vector<S,T> rhs) const
{
T sum {0};
for (size_t i = 0; i < S; ++i)
sum += pow2 (this->data[i] - rhs.data[i]);
return sum;
}
///////////////////////////////////////////////////////////////////////////////
template <typename T>
vector<2,T>
@ -160,12 +138,13 @@ const util::vector<S,T>
util::vector<S,T>::UNIT (T{1});
//-----------------------------------------------------------------------------
template <size_t S, typename T>
const util::vector<S,T>
util::vector<S,T>::ZERO (T{0});
//-----------------------------------------------------------------------------
///////////////////////////////////////////////////////////////////////////////
template <size_t S, typename T>
void
util::vector<S,T>::sanity (void) const

View File

@ -29,9 +29,6 @@ namespace util {
{
using coord::base<S,T,util::vector,coord::xyzw,coord::stpq>::base;
T difference (vector<S,T>) const;
T difference2 (vector<S,T>) const;
// representations
template <size_t D> vector<D,T> homog (void) const;
@ -55,7 +52,8 @@ namespace util {
// output and serialisation operators
template <size_t S, typename T>
const json::tree::node& operator>> (const json::tree::node&, vector<S,T>&);
const json::tree::node&
operator>> (const json::tree::node&, vector<S,T>&);
// convenience typedefs
template <typename T> using vector2 = vector<2,T>;