extent: add expansion operation

This commit is contained in:
Danny Robson 2015-01-16 14:42:04 +11:00
parent 79be955d28
commit 5c1b37d10d
2 changed files with 17 additions and 0 deletions

View File

@ -66,6 +66,19 @@ extent<T>::area (void) const
{ return w * h; } { return w * h; }
//-----------------------------------------------------------------------------
template <typename T>
extent<T>
extent<T>::expanded (util::vector<2,T> size) const
{
return {
w + size.x,
h + size.y
};
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
template <typename T> template <typename T>
float float

View File

@ -20,6 +20,8 @@
#ifndef __UTIL_EXTENT_HPP #ifndef __UTIL_EXTENT_HPP
#define __UTIL_EXTENT_HPP #define __UTIL_EXTENT_HPP
#include "vector.hpp"
#include <iostream> #include <iostream>
namespace util { namespace util {
@ -37,6 +39,8 @@ namespace util {
T area (void) const; T area (void) const;
T diameter (void) const; T diameter (void) const;
extent<T> expanded (util::vector<2,T>) const;
float aspect (void) const; float aspect (void) const;
bool empty (void) const; bool empty (void) const;