Simple++
Powerfull and lightning fast C++ Library
Public Types | Public Member Functions | Static Public Attributes | List of all members
Math::Rectangle< T > Class Template Reference

#include <Rectangle.h>

Public Types

enum  Position : unsigned int {
  Inside = 0, Left = 1, Right = 2, Bottom = 4,
  Top = 8
}
 
typedef T Type
 

Public Member Functions

 Rectangle ()
 
 Rectangle (const Vec2< T > &rightTop)
 
 Rectangle (const Vec2< T > &leftBottom, const Vec2< T > &rightTop)
 
 Rectangle (const T &left, const T &bottom, const T &right, const T &top)
 
const T & getLeft () const
 
const T & getTop () const
 
const T & getRight () const
 
const T & getBottom () const
 
const Vec2< T > getLeftBottom () const
 
const Vec2< T > getRightTop () const
 
bool isInside (const Vec2< T > &p) const
 
unsigned int getZone (const Vec2< T > &p) const
 get the zone of a point relatively to this rectangle (top left, right bottom, inside etc...) More...
 
void setLeft (const T &left)
 
void setTop (const T &top)
 
void setRight (const T &right)
 
void setBottom (const T &bottom)
 
void setLeftBottom (const Vec2< T > &leftTop)
 
void setRightTop (const Vec2< T > &rightTop)
 
Rectangle< T > & operator+= (const Vec2< T > &p)
 
Rectangle< T > & operator-= (const Vec2< T > &p)
 

Static Public Attributes

static const Rectangle< T > null = Rectangle<T>( 0, 0 )
 

Member Typedef Documentation

template<typename T>
typedef T Math::Rectangle< T >::Type

Member Enumeration Documentation

template<typename T>
enum Math::Rectangle::Position : unsigned int
Enumerator
Inside 
Left 
Right 
Bottom 
Top 

Constructor & Destructor Documentation

template<typename T >
Math::Rectangle< T >::Rectangle ( )
template<typename T>
Math::Rectangle< T >::Rectangle ( const Vec2< T > &  rightTop)
template<typename T>
Math::Rectangle< T >::Rectangle ( const Vec2< T > &  leftBottom,
const Vec2< T > &  rightTop 
)
template<typename T>
Math::Rectangle< T >::Rectangle ( const T &  left,
const T &  bottom,
const T &  right,
const T &  top 
)

Member Function Documentation

template<typename T >
const T & Math::Rectangle< T >::getBottom ( ) const
template<typename T >
const T & Math::Rectangle< T >::getLeft ( ) const
template<typename T >
const Vec2< T > Math::Rectangle< T >::getLeftBottom ( ) const
template<typename T >
const T & Math::Rectangle< T >::getRight ( ) const
template<typename T >
const Vec2< T > Math::Rectangle< T >::getRightTop ( ) const
template<typename T >
const T & Math::Rectangle< T >::getTop ( ) const
template<typename T>
unsigned int Math::Rectangle< T >::getZone ( const Vec2< T > &  p) const

get the zone of a point relatively to this rectangle (top left, right bottom, inside etc...)

See also
https://en.wikipedia.org/wiki/Cohen%E2%80%93Sutherland_algorithm#Example_C.2FC.2B.2B_implementation
Parameters
pPoint
Returns
combination of binary OR with enum Position
template<typename T>
bool Math::Rectangle< T >::isInside ( const Vec2< T > &  p) const
template<typename T>
Rectangle< T > & Math::Rectangle< T >::operator+= ( const Vec2< T > &  p)
template<typename T>
Rectangle< T > & Math::Rectangle< T >::operator-= ( const Vec2< T > &  p)
template<typename T>
void Math::Rectangle< T >::setBottom ( const T &  bottom)
template<typename T>
void Math::Rectangle< T >::setLeft ( const T &  left)
template<typename T>
void Math::Rectangle< T >::setLeftBottom ( const Vec2< T > &  leftTop)
template<typename T>
void Math::Rectangle< T >::setRight ( const T &  right)
template<typename T>
void Math::Rectangle< T >::setRightTop ( const Vec2< T > &  rightTop)
template<typename T>
void Math::Rectangle< T >::setTop ( const T &  top)

Member Data Documentation

template<typename T>
const Rectangle< T > Math::Rectangle< T >::null = Rectangle<T>( 0, 0 )
static

The documentation for this class was generated from the following files: