#ifndef Foundation_Math_Scale_INCLUDED
#define Foundation_Math_Scale_INCLUDED

#include <foundation/Math/misc.hpp>

namespace Tn {

namespace math {

template <typename T>
struct Scale {

    typedef T component_type;

    T x, y, z;

    Scale() 
        : x(T(1)), 
          y(T(1)), 
          z(T(1)) {}
    Scale(T nx, T ny, T nz) : x(nx), y(ny), z(nz) {}
    Scale(T s) : x(s), y(s), z(s) {}

};


template <class T>
inline Scale<T> operator*(Scale<T> const & a, Scale<T> const & b) {
    return Scale<T>(a.x*b.x, a.y*b.y, a.z*b.z);
}

typedef Scale<float> Scalef;
typedef Scale<double> Scaled;

} // end namespace math

} // end namespace Tn


template <typename T>
Tn::math::Scale<T> invert(Tn::math::Scale<T> const & a) {
    return Tn::math::Scale<T>(invert(a.x), invert(a.y), invert(a.z));
}

template <typename T>
inline bool isIdentity(Tn::math::Scale<T> const & s) {
    return
        (s.x==T(1)) &&
        (s.y==T(1)) &&
        (s.z==T(1));
}

#endif
