alternative Standard Libary  0.29.8
std::math::rectangle< T > Template-Klassenreferenz

#include <rectangle.hpp>

+ Klassendiagramm für std::math::rectangle< T >:
+ Zusammengehörigkeiten von std::math::rectangle< T >:

Öffentliche Typen

typedef typedef T value_type
 
typedef rectangle< T > self_type
 
typedef T * pointer
 

Öffentliche Methoden

virtual std::string to_string ()
 
 rectangle ()
 
 rectangle (value_type _x, value_type _y, value_type _w, value_type _h)
 
 rectangle (vector2< value_type > pos, vector2< value_type > size)
 
const value_typetop ()
 
void top (const value_type &t)
 
const value_typeleft ()
 
void left (const value_type &t)
 
const value_typebottom ()
 
const value_typeright ()
 
vector2< value_typecenter ()
 
vector2< value_typesize ()
 
rectangle< value_typeinflate (value_type leftRight, value_type topBottom)
 
bool contains (rectangle< T > r)
 
rectangle< value_type > & intersect (const rectangle< value_type > &r1, const rectangle< value_type > &r2)
 
bool intersects (const rectangle< value_type > &r)
 
void offset (float offx, float offy)
 

Öffentliche Attribute

union {
   struct {
      value_type   x
 
      value_type   y
 
      value_type   width
 
      value_type   height
 
   } 
 
   struct {
      vector2< T >   position
 
      vector2< T >   size
 
   } 
 
   value_type   c [4]
 
}; 
 

Ausführliche Beschreibung

template<typename T>
class std::math::rectangle< T >

Dokumentation der benutzerdefinierten Datentypen

◆ pointer

template<typename T >
typedef T* std::math::rectangle< T >::pointer

◆ self_type

template<typename T >
typedef rectangle<T> std::math::rectangle< T >::self_type

◆ value_type

template<typename T >
typedef typedef T std::math::rectangle< T >::value_type

Beschreibung der Konstruktoren und Destruktoren

◆ rectangle() [1/3]

template<typename T >
std::math::rectangle< T >::rectangle ( )
inline
69  : x(0), y(0), width(1), height(1) { }
value_type width
Definition: rectangle.hpp:55
value_type height
Definition: rectangle.hpp:56
value_type x
Definition: rectangle.hpp:53
value_type y
Definition: rectangle.hpp:54

◆ rectangle() [2/3]

template<typename T >
std::math::rectangle< T >::rectangle ( value_type  _x,
value_type  _y,
value_type  _w,
value_type  _h 
)
inline
71  : x(_x), y(_y), width(_w), height(_h) { }
value_type width
Definition: rectangle.hpp:55
value_type height
Definition: rectangle.hpp:56
value_type x
Definition: rectangle.hpp:53
value_type y
Definition: rectangle.hpp:54

◆ rectangle() [3/3]

template<typename T >
std::math::rectangle< T >::rectangle ( vector2< value_type pos,
vector2< value_type size 
)
inline
73  : x(pos.x), y(pos.y), width(size.x), height(size.y) { }
value_type width
Definition: rectangle.hpp:55
vector2< value_type > size()
Definition: rectangle.hpp:85
value_type height
Definition: rectangle.hpp:56
value_type x
Definition: rectangle.hpp:53
value_type y
Definition: rectangle.hpp:54

Dokumentation der Elementfunktionen

◆ bottom()

template<typename T >
const value_type& std::math::rectangle< T >::bottom ( )
inline
81 { return y + height; }
value_type height
Definition: rectangle.hpp:56
value_type y
Definition: rectangle.hpp:54

◆ center()

template<typename T >
vector2<value_type> std::math::rectangle< T >::center ( )
inline
84 { return vector2<T>(x + width / 2, y + height / 2); }
value_type width
Definition: rectangle.hpp:55
value_type height
Definition: rectangle.hpp:56
value_type x
Definition: rectangle.hpp:53
value_type y
Definition: rectangle.hpp:54

◆ contains()

template<typename T >
bool std::math::rectangle< T >::contains ( rectangle< T >  r)
inline
97  {
98  return r.left() >= left() && r.right() <= right() &&
99  r.top() >= top() && r.bottom() <= bottom();
100  }
const value_type & top()
Definition: rectangle.hpp:75
const value_type & right()
Definition: rectangle.hpp:82
const value_type & left()
Definition: rectangle.hpp:78
const value_type & bottom()
Definition: rectangle.hpp:81

◆ inflate()

template<typename T >
rectangle<value_type> std::math::rectangle< T >::inflate ( value_type  leftRight,
value_type  topBottom 
)
inline
88  {
89  x -= leftRight;
90  width += leftRight * 2;
91  y -= topBottom;
92  height += topBottom * 2;
93 
94  return this;
95  }
value_type width
Definition: rectangle.hpp:55
value_type height
Definition: rectangle.hpp:56
value_type x
Definition: rectangle.hpp:53
value_type y
Definition: rectangle.hpp:54

◆ intersect()

template<typename T >
rectangle<value_type>& std::math::rectangle< T >::intersect ( const rectangle< value_type > &  r1,
const rectangle< value_type > &  r2 
)
inline
102  {
103  int x = std::_max<value_type> (r1.x, r2.x);
104  int y = std::_max<value_type> (r1.y, r2.y);
105  int w = std::_min<value_type> (r1.right(), r2.right()) - x;
106  int h = std::_min<value_type> (r1.bottom(), r2.bottom()) - y;
107  return rectangle<value_type>(x,y,w,h);
108  }
value_type x
Definition: rectangle.hpp:53
value_type y
Definition: rectangle.hpp:54

◆ intersects()

template<typename T >
bool std::math::rectangle< T >::intersects ( const rectangle< value_type > &  r)
inline
110  {
111  int w = std::_min<value_type> (r.right(), right()) - std::_max<value_type> (r.x, x);
112  int h = std::_min<value_type> (r.bottom(), bottom()) - std::_max<value_type> (r.y, y);
113  return w > 0 && h > 0;
114  }
const value_type & right()
Definition: rectangle.hpp:82
const value_type & bottom()
Definition: rectangle.hpp:81
value_type x
Definition: rectangle.hpp:53
value_type y
Definition: rectangle.hpp:54

◆ left() [1/2]

template<typename T >
const value_type& std::math::rectangle< T >::left ( )
inline
78 { return x; }
value_type x
Definition: rectangle.hpp:53

◆ left() [2/2]

template<typename T >
void std::math::rectangle< T >::left ( const value_type t)
inline
79 { x = t; }
value_type x
Definition: rectangle.hpp:53

◆ offset()

template<typename T >
void std::math::rectangle< T >::offset ( float  offx,
float  offy 
)
inline
116  {
117  x += offx;
118  y += offy;
119  }
value_type x
Definition: rectangle.hpp:53
value_type y
Definition: rectangle.hpp:54

◆ right()

template<typename T >
const value_type& std::math::rectangle< T >::right ( )
inline
82 { return x + width; }
value_type width
Definition: rectangle.hpp:55
value_type x
Definition: rectangle.hpp:53

◆ size()

template<typename T >
vector2<value_type> std::math::rectangle< T >::size ( )
inline
85 { return vector2<value_type>(width, height); }
value_type width
Definition: rectangle.hpp:55
value_type height
Definition: rectangle.hpp:56

◆ to_string()

template<typename T >
virtual std::string std::math::rectangle< T >::to_string ( )
inlinevirtual
64  {
65  return std::frmstring("[rect] pos: %s size: %s",
66  position.to_string().c_str(), size.to_string().c_str());
67  }
vector2< T > position
Definition: rectangle.hpp:59
vector2< value_type > size()
Definition: rectangle.hpp:85
size_t frmstring(basic_string< E, TAllocator, TStorage > &dest, const char *format, va_list arg)
Definition: string.hpp:99

◆ top() [1/2]

template<typename T >
const value_type& std::math::rectangle< T >::top ( )
inline
75 { return y; }
value_type y
Definition: rectangle.hpp:54

◆ top() [2/2]

template<typename T >
void std::math::rectangle< T >::top ( const value_type t)
inline
76 { y = t; }
value_type y
Definition: rectangle.hpp:54

Dokumentation der Datenelemente

◆ @24

union { ... }

◆ c

template<typename T >
value_type std::math::rectangle< T >::c[4]

◆ height

template<typename T >
value_type std::math::rectangle< T >::height

◆ position

template<typename T >
vector2<T> std::math::rectangle< T >::position

◆ size

template<typename T >
vector2<T> std::math::rectangle< T >::size

◆ width

template<typename T >
value_type std::math::rectangle< T >::width

◆ x

template<typename T >
value_type std::math::rectangle< T >::x

◆ y

template<typename T >
value_type std::math::rectangle< T >::y

Die Dokumentation für diese Klasse wurde erzeugt aufgrund der Datei: