Use w/h instead of width/height for extent
This commit is contained in:
parent
7107968cdb
commit
7bad091cfe
24
extent.cpp
24
extent.cpp
@ -30,23 +30,23 @@ using namespace util;
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
template <typename T>
|
template <typename T>
|
||||||
extent<T>::extent (const T _width, const T _height):
|
extent<T>::extent (const T _width, const T _height):
|
||||||
width (_width),
|
w (_width),
|
||||||
height (_height)
|
h (_height)
|
||||||
{ ; }
|
{ ; }
|
||||||
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
extent<T>::extent (const extent<T> &rhs):
|
extent<T>::extent (const extent<T> &rhs):
|
||||||
width (rhs.width),
|
w (rhs.w),
|
||||||
height (rhs.height)
|
h (rhs.h)
|
||||||
{ ; }
|
{ ; }
|
||||||
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
extent<T>&
|
extent<T>&
|
||||||
extent<T>::operator= (const extent<T> &rhs) {
|
extent<T>::operator= (const extent<T> &rhs) {
|
||||||
width = rhs.width;
|
w = rhs.w;
|
||||||
height = rhs.height;
|
h = rhs.h;
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
@ -56,21 +56,21 @@ extent<T>::operator= (const extent<T> &rhs) {
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
T
|
T
|
||||||
extent<T>::diameter (void) const {
|
extent<T>::diameter (void) const {
|
||||||
return (T)sqrt (width * width + height * height);
|
return (T)sqrt (w * w + h * h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T
|
T
|
||||||
extent<T>::area (void) const
|
extent<T>::area (void) const
|
||||||
{ return width * height; }
|
{ return w * h; }
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
template <typename T>
|
template <typename T>
|
||||||
double
|
double
|
||||||
extent<T>::aspect (void) const
|
extent<T>::aspect (void) const
|
||||||
{ return static_cast<double> (width) / height; }
|
{ return static_cast<double> (w) / h; }
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -84,8 +84,8 @@ extent<T>::empty (void) const
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
bool
|
bool
|
||||||
extent<T>::operator ==(const extent& rhs) const {
|
extent<T>::operator ==(const extent& rhs) const {
|
||||||
return almost_equal (width, rhs.width) &&
|
return almost_equal (w, rhs.w) &&
|
||||||
almost_equal (height, rhs.height);
|
almost_equal (h, rhs.h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ extent<T>::operator ==(const extent& rhs) const {
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
void
|
void
|
||||||
extent<T>::sanity (void) const
|
extent<T>::sanity (void) const
|
||||||
{ CHECK (width >= 0 && height >= 0); }
|
{ CHECK (w >= 0 && h >= 0); }
|
||||||
|
|
||||||
|
|
||||||
namespace util {
|
namespace util {
|
||||||
|
@ -26,7 +26,7 @@ namespace util {
|
|||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct extent {
|
struct extent {
|
||||||
T width, height;
|
T w, h;
|
||||||
|
|
||||||
extent (const T _width, const T _height);
|
extent (const T _width, const T _height);
|
||||||
extent (const extent&);
|
extent (const extent&);
|
||||||
|
Loading…
Reference in New Issue
Block a user