extent: add expansion operation
This commit is contained in:
parent
79be955d28
commit
5c1b37d10d
13
extent.cpp
13
extent.cpp
@ -66,6 +66,19 @@ extent<T>::area (void) const
|
||||
{ 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>
|
||||
float
|
||||
|
@ -20,6 +20,8 @@
|
||||
#ifndef __UTIL_EXTENT_HPP
|
||||
#define __UTIL_EXTENT_HPP
|
||||
|
||||
#include "vector.hpp"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
namespace util {
|
||||
@ -37,6 +39,8 @@ namespace util {
|
||||
T area (void) const;
|
||||
T diameter (void) const;
|
||||
|
||||
extent<T> expanded (util::vector<2,T>) const;
|
||||
|
||||
float aspect (void) const;
|
||||
|
||||
bool empty (void) const;
|
||||
|
Loading…
Reference in New Issue
Block a user