29#ifndef NOMLIB_MATH_SIZE2_HEADERS
30#define NOMLIB_MATH_SIZE2_HEADERS
35#include "nomlib/config.hpp"
44#if defined( NOM_PLATFORM_WINDOWS )
52const std::string SIZE2_DELIMITER =
", ";
87 w { static_cast<T> ( copy.
w ) },
88 h { static_cast<T> ( copy.
h ) }
90 this->
w =
static_cast<T
> ( copy.
w );
91 this->
h =
static_cast<T
> ( copy.
h );
99 return Size2<T>( std::max( this->
w, rhs.
w ), std::max( this->h, rhs.
h ) );
104 template <
typename U>
107 return Size2<T>( std::min( this->
w, rhs.
w ), std::min( this->h, rhs.
h ) );
113 std::swap( this->
w, this->
h );
139inline std::ostream& operator <<( std::ostream& os,
const Size2<T>& pos )
150inline bool operator ==(
const Size2<T>& lhs,
const Size2<T>& rhs )
152 return ( lhs.w == rhs.w ) && ( lhs.h == rhs.h );
158 return ! ( lhs == rhs );
185 return Size2<T>(lhs + rhs.w, lhs + rhs.h);
197 return Size2<T>(lhs.w + rhs, lhs.h + rhs);
252 return Size2<T>(lhs - rhs.w, lhs - rhs.h);
264 return Size2<T>(lhs.w - rhs, lhs.h - rhs);
304 return Size2<T>(lhs * rhs.w, lhs * rhs.h);
316 return Size2<T>(lhs.w * rhs, lhs.h * rhs);
509 ret.
w = lhs.w / rhs.w;
510 ret.h = lhs.h / rhs.h;
554 return ( lhs.w < rhs.w ) && ( lhs.h < rhs.h );
564 return ( rhs.w < lhs.w ) && ( rhs.h < lhs.h );
574 return ( lhs.w <= rhs.w ) && ( lhs.h <= rhs.h );
584 return ( rhs.w <= lhs.w ) && ( rhs.h <= lhs.h );
Size coordinates (width & height) container.
Size2(void)
Default constructor; initialize values to Size2<T>::null.
Size2 min(const Size2< U > &rhs)
Compare two Size2 objects and return the smaller width and height of the two objects.
Size2 max(const Size2< U > &rhs)
Compare two Size2 objects and return the larger width and height of the two objects.
void swap(void)
Transpose width and height dimensions.
Size2(const Size2< U > ©)
Copy constructor.
Size2(T w, T h)
Constructor variant for initializing width & height at construction.