extent: move aspect calculation back into object

This commit is contained in:
Danny Robson 2015-03-24 02:43:43 +11:00
parent 06c537918f
commit fb06a3ec2f
2 changed files with 7 additions and 7 deletions

View File

@ -40,6 +40,9 @@ namespace util {
T area (void) const; T area (void) const;
T diameter (void) const; T diameter (void) const;
template <typename U = float>
U aspect (void) const;
extent expanded (vector<S,T>) const; extent expanded (vector<S,T>) const;
extent expanded (T) const; extent expanded (T) const;
@ -52,10 +55,6 @@ namespace util {
static const extent MIN; static const extent MIN;
}; };
template <typename U, typename T>
U
aspect (extent<2,T>);
typedef extent<2,int> extent2i; typedef extent<2,int> extent2i;
typedef extent<2,size_t> extent2u; typedef extent<2,size_t> extent2u;
typedef extent<2,float> extent2f; typedef extent<2,float> extent2f;

View File

@ -39,9 +39,10 @@ util::extent<S,T>::cast (void) const
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
template <typename U, typename T> template <size_t S, typename T>
template <typename U>
U U
util::aspect (util::extent<2,T> e) util::extent<S,T>::aspect (void) const
{ {
return static_cast<U> (e.w) / e.h; return static_cast<U> (this->w) / this->h;
} }