FIFE
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
FIFE::PointType2D< T > Class Template Reference

A 2D Point. More...

#include <point.h>

+ Inheritance diagram for FIFE::PointType2D< T >:
+ Collaboration diagram for FIFE::PointType2D< T >:

Public Member Functions

 PointType2D (T _x=0, T _y=0)
 Constructor. More...
 
 PointType2D (const PointType2D< T > &rhs)
 Copy Constructor. More...
 
PointType2D< T > operator+ (const PointType2D< T > &p) const
 Vector addition. More...
 
PointType2D< T > operator- (const PointType2D< T > &p) const
 Vector substraction. More...
 
PointType2D< T > & operator+= (const PointType2D< T > &p)
 Vector inplace addition. More...
 
PointType2D< T > & operator-= (const PointType2D< T > &p)
 Vector inplace substraction. More...
 
PointType2D< T > operator* (const T &i) const
 Scalar multiplication with an integer value. More...
 
PointType2D< T > operator/ (const T &i) const
 Scalar division with an integer value. More...
 
bool operator== (const PointType2D< T > &p) const
 Equality comparision. More...
 
bool operator!= (const PointType2D< T > &p) const
 Equality comparision. More...
 
length () const
 Return length. More...
 
void normalize ()
 Normalizes the point. More...
 
void rotate (T angle)
 Rotates the point around the origin. More...
 
void rotate (const PointType2D< T > &origin, T angle)
 Rotates the point around an origin. More...
 
void set (T _x, T _y)
 Sets the x and y coordinate of the 2D point. More...
 
T & operator[] (int32_t ind)
 

Public Attributes

union {
   T   val [2]
 
   struct {
      T   x
 
      T   y
 
   } 
 
}; 
 

Detailed Description

template<typename T>
class FIFE::PointType2D< T >

A 2D Point.

This is a small helper class to aid in 2d vector arithmetics.

See Also
Rect

Definition at line 47 of file point.h.

Constructor & Destructor Documentation

template<typename T>
FIFE::PointType2D< T >::PointType2D ( _x = 0,
_y = 0 
)
inlineexplicit

Constructor.

Creates a with 0 as default values.

Definition at line 60 of file point.h.

template<typename T>
FIFE::PointType2D< T >::PointType2D ( const PointType2D< T > &  rhs)
inline

Copy Constructor.

Definition at line 65 of file point.h.

Member Function Documentation

template<typename T>
T FIFE::PointType2D< T >::length ( ) const
inline

Return length.

Definition at line 122 of file point.h.

Referenced by FIFE::PointType2D< int32_t >::normalize().

+ Here is the caller graph for this function:

template<typename T>
void FIFE::PointType2D< T >::normalize ( )
inline

Normalizes the point.

Definition at line 130 of file point.h.

template<typename T>
bool FIFE::PointType2D< T >::operator!= ( const PointType2D< T > &  p) const
inline

Equality comparision.

Definition at line 116 of file point.h.

template<typename T>
PointType2D<T> FIFE::PointType2D< T >::operator* ( const T &  i) const
inline

Scalar multiplication with an integer value.

Definition at line 98 of file point.h.

template<typename T>
PointType2D<T> FIFE::PointType2D< T >::operator+ ( const PointType2D< T > &  p) const
inline

Vector addition.

Definition at line 70 of file point.h.

template<typename T>
PointType2D<T>& FIFE::PointType2D< T >::operator+= ( const PointType2D< T > &  p)
inline

Vector inplace addition.

Definition at line 82 of file point.h.

template<typename T>
PointType2D<T> FIFE::PointType2D< T >::operator- ( const PointType2D< T > &  p) const
inline

Vector substraction.

Definition at line 76 of file point.h.

template<typename T>
PointType2D<T>& FIFE::PointType2D< T >::operator-= ( const PointType2D< T > &  p)
inline

Vector inplace substraction.

Definition at line 90 of file point.h.

template<typename T>
PointType2D<T> FIFE::PointType2D< T >::operator/ ( const T &  i) const
inline

Scalar division with an integer value.

Definition at line 104 of file point.h.

template<typename T>
bool FIFE::PointType2D< T >::operator== ( const PointType2D< T > &  p) const
inline

Equality comparision.

Definition at line 110 of file point.h.

template<typename T>
T& FIFE::PointType2D< T >::operator[] ( int32_t  ind)
inline

Definition at line 181 of file point.h.

template<typename T>
void FIFE::PointType2D< T >::rotate ( angle)
inline

Rotates the point around the origin.

Definition at line 146 of file point.h.

template<typename T>
void FIFE::PointType2D< T >::rotate ( const PointType2D< T > &  origin,
angle 
)
inline

Rotates the point around an origin.

Definition at line 161 of file point.h.

template<typename T>
void FIFE::PointType2D< T >::set ( _x,
_y 
)
inline

Sets the x and y coordinate of the 2D point.

Definition at line 176 of file point.h.

Member Data Documentation

union { ... }
template<typename T>
T FIFE::PointType2D< T >::val[2]

Definition at line 50 of file point.h.

Referenced by FIFE::PointType2D< int32_t >::operator[]().

template<typename T>
T FIFE::PointType2D< T >::x

Definition at line 52 of file point.h.

Referenced by FIFE::RectType< T >::contains(), FIFE::doublePt2intPt(), FIFE::RenderBackendOpenGLe::drawLightPrimitive(), FIFE::RenderBackendOpenGL::drawLightPrimitive(), FIFE::OpenGLGuiGraphics::drawLine(), FIFE::OpenGLeGuiGraphics::drawLine(), FIFE::RenderBackendSDL::drawLine(), FIFE::RenderBackendOpenGL::drawLine(), FIFE::RenderBackendOpenGLe::drawLine(), FIFE::RenderBackendOpenGLe::drawQuad(), FIFE::RenderBackendSDL::drawQuad(), FIFE::RenderBackendOpenGL::drawQuad(), FIFE::RenderBackendSDL::drawRectangle(), FIFE::RenderBackendOpenGL::drawRectangle(), FIFE::RenderBackendOpenGLe::drawRectangle(), FIFE::RenderBackendOpenGL::drawTriangle(), FIFE::RenderBackendOpenGLe::drawTriangle(), FIFE::RenderBackendOpenGLe::drawVertex(), FIFE::RenderBackendSDL::drawVertex(), FIFE::RenderBackendOpenGL::drawVertex(), FIFE::RenderBackendSDL::fillRectangle(), FIFE::RenderBackendOpenGL::fillRectangle(), FIFE::RenderBackendOpenGLe::fillRectangle(), FIFE::RendererNode::getCalculatedPoint(), FIFE::Camera::getCellImageDimensions(), FIFE::intPt2doublePt(), FIFE::PointType2D< int32_t >::length(), FIFE::PointType2D< int32_t >::normalize(), FIFE::PointType2D< int32_t >::operator!=(), FIFE::PointType2D< int32_t >::operator*(), FIFE::PointType2D< int32_t >::operator+(), FIFE::PointType2D< int32_t >::operator+=(), FIFE::PointType2D< int32_t >::operator-(), FIFE::PointType2D< int32_t >::operator-=(), FIFE::PointType2D< int32_t >::operator/(), FIFE::PointType2D< int32_t >::operator==(), FIFE::GridRenderer::render(), FIFE::OffRendererPointInfo::render(), FIFE::GenericRendererPointInfo::render(), FIFE::CellSelectionRenderer::render(), FIFE::BlockingInfoRenderer::render(), FIFE::CellRenderer::render(), FIFE::LightRendererImageInfo::render(), FIFE::LightRendererAnimationInfo::render(), FIFE::OffRendererImageInfo::render(), FIFE::GenericRendererImageInfo::render(), FIFE::OffRendererAnimationInfo::render(), FIFE::GenericRendererAnimationInfo::render(), FIFE::LightRendererResizeInfo::render(), FIFE::OffRendererTextInfo::render(), FIFE::GenericRendererTextInfo::render(), FIFE::OffRendererResizeInfo::render(), FIFE::GenericRendererResizeInfo::render(), FIFE::Camera::renderOverlay(), FIFE::ImageFontBase::renderString(), FIFE::PointType2D< int32_t >::rotate(), FIFE::MapSaver::save(), FIFE::PointType2D< int32_t >::set(), and FIFE::Camera::updateReferenceScale().

template<typename T>
T FIFE::PointType2D< T >::y

Definition at line 52 of file point.h.

Referenced by FIFE::RectType< T >::contains(), FIFE::doublePt2intPt(), FIFE::RenderBackendOpenGLe::drawLightPrimitive(), FIFE::RenderBackendOpenGL::drawLightPrimitive(), FIFE::OpenGLGuiGraphics::drawLine(), FIFE::OpenGLeGuiGraphics::drawLine(), FIFE::RenderBackendSDL::drawLine(), FIFE::RenderBackendOpenGL::drawLine(), FIFE::RenderBackendOpenGLe::drawLine(), FIFE::RenderBackendOpenGLe::drawQuad(), FIFE::RenderBackendSDL::drawQuad(), FIFE::RenderBackendOpenGL::drawQuad(), FIFE::RenderBackendSDL::drawRectangle(), FIFE::RenderBackendOpenGL::drawRectangle(), FIFE::RenderBackendOpenGLe::drawRectangle(), FIFE::RenderBackendOpenGL::drawTriangle(), FIFE::RenderBackendOpenGLe::drawTriangle(), FIFE::RenderBackendOpenGLe::drawVertex(), FIFE::RenderBackendSDL::drawVertex(), FIFE::RenderBackendOpenGL::drawVertex(), FIFE::RenderBackendSDL::fillRectangle(), FIFE::RenderBackendOpenGL::fillRectangle(), FIFE::RenderBackendOpenGLe::fillRectangle(), FIFE::RendererNode::getCalculatedPoint(), FIFE::Camera::getCellImageDimensions(), FIFE::intPt2doublePt(), FIFE::PointType2D< int32_t >::length(), FIFE::PointType2D< int32_t >::normalize(), FIFE::PointType2D< int32_t >::operator!=(), FIFE::PointType2D< int32_t >::operator*(), FIFE::PointType2D< int32_t >::operator+(), FIFE::PointType2D< int32_t >::operator+=(), FIFE::PointType2D< int32_t >::operator-(), FIFE::PointType2D< int32_t >::operator-=(), FIFE::PointType2D< int32_t >::operator/(), FIFE::PointType2D< int32_t >::operator==(), FIFE::GridRenderer::render(), FIFE::OffRendererPointInfo::render(), FIFE::GenericRendererPointInfo::render(), FIFE::CellSelectionRenderer::render(), FIFE::BlockingInfoRenderer::render(), FIFE::CellRenderer::render(), FIFE::LightRendererImageInfo::render(), FIFE::LightRendererAnimationInfo::render(), FIFE::OffRendererImageInfo::render(), FIFE::GenericRendererImageInfo::render(), FIFE::OffRendererAnimationInfo::render(), FIFE::GenericRendererAnimationInfo::render(), FIFE::LightRendererResizeInfo::render(), FIFE::OffRendererTextInfo::render(), FIFE::GenericRendererTextInfo::render(), FIFE::OffRendererResizeInfo::render(), FIFE::GenericRendererResizeInfo::render(), FIFE::Camera::renderOverlay(), FIFE::ImageFontBase::renderString(), FIFE::PointType2D< int32_t >::rotate(), FIFE::MapSaver::save(), and FIFE::PointType2D< int32_t >::set().


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