Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

# Keos::CVector2< T > Class Template Reference

Standard 2-dimensional vector with customizable type. More...

`#include <KeosVector2.h>`

List of all members.

## Public Member Functions

| CVector2 (T X=0, T Y=0)
| Default constructor.
void | Set (T X, T Y)
| Set vector.
T | Length () const
| Returns the length (magnitude) of the vector (sqrt(x² + y²)).
T | LengthSq () const
| Returns the square of the length(magnitude) of the vector (x² + y²).
void | Normalize ()
| Normalizes the vector.
CVector2< T > | operator+ () const
CVector2< T > | operator- () const
CVector2< T > | operator+ (const CVector2< T > &v) const
CVector2< T > | operator- (const CVector2< T > &v) const
const CVector2< T > & | operator+= (const CVector2< T > &v)
const CVector2< T > & | operator-= (const CVector2< T > &v)
CVector2< T > | operator * (T t) const
CVector2< T > | operator/ (T t) const
const CVector2< T > & | operator *= (T t)
const CVector2< T > & | operator/= (T t)
bool | operator== (const CVector2< T > &v) const
bool | operator!= (const CVector2< T > &v) const
| operator T * ()
| T* cast operator.

## Public Attributes

T | x
T | y

## Detailed Description

### template<class T>
class Keos::CVector2< T >

Standard 2-dimensional vector with customizable type.

Definition at line 34 of file KeosVector2.h.

## Constructor & Destructor Documentation

template<class T>
Keos::CVector2< T >::CVector2 | ( | T | X = `0`,
|  | T | Y = `0`
| ) | `[inline]`

| Default constructor. Definition at line 106 of file KeosVector2.h.

## Member Function Documentation

template<class T>
T Keos::CVector2< T >::Length | ( |  | ) | const`[inline]`

| Returns the length (magnitude) of the vector (sqrt(x² + y²)). Definition at line 123 of file KeosVector2.h. References Keos::CVector2< T >::LengthSq(). Referenced by Keos::CVector2< T >::Normalize().

template<class T>
T Keos::CVector2< T >::LengthSq | ( |  | ) | const`[inline]`

| Returns the square of the length(magnitude) of the vector (x² + y²). Definition at line 130 of file KeosVector2.h. References Keos::CVector2< T >::x, and Keos::CVector2< T >::y. Referenced by Keos::CVector2< T >::Length().

template<class T>
void Keos::CVector2< T >::Normalize | ( |  | ) | `[inline]`

| Normalizes the vector. Definition at line 137 of file KeosVector2.h. References Keos::CVector2< T >::Length(), Keos::CVector2< T >::x, and Keos::CVector2< T >::y.

template<class T>
CVector2< T > Keos::CVector2< T >::operator * | ( | T | t | ) | const`[inline]`

| Definition at line 198 of file KeosVector2.h. References Keos::CVector2< T >::x, and Keos::CVector2< T >::y.

template<class T>
const CVector2< T > & Keos::CVector2< T >::operator *= | ( | T | t | ) | `[inline]`

| Definition at line 212 of file KeosVector2.h. References Keos::CVector2< T >::x, and Keos::CVector2< T >::y.

template<class T>
Keos::CVector2< T >::operator T * | ( |  | ) | `[inline]`

| T* cast operator.

Returns:
  Pointer on the vector components.

Definition at line 247 of file KeosVector2.h.

References Keos::CVector2< T >::x.

template<class T>
bool Keos::CVector2< T >::operator!= | ( | const CVector2< T > & | v | ) | const`[inline]`

| Definition at line 240 of file KeosVector2.h.

template<class T>
CVector2< T > Keos::CVector2< T >::operator+ | ( | const CVector2< T > & | v | ) | const`[inline]`

| Definition at line 164 of file KeosVector2.h. References Keos::CVector2< T >::x, and Keos::CVector2< T >::y.

template<class T>
CVector2< T > Keos::CVector2< T >::operator+ | ( |  | ) | const`[inline]`

| Definition at line 150 of file KeosVector2.h.

template<class T>
const CVector2< T > & Keos::CVector2< T >::operator+= | ( | const CVector2< T > & | v | ) | `[inline]`

| Definition at line 178 of file KeosVector2.h. References Keos::CVector2< T >::x, and Keos::CVector2< T >::y.

template<class T>
CVector2< T > Keos::CVector2< T >::operator- | ( | const CVector2< T > & | v | ) | const`[inline]`

| Definition at line 171 of file KeosVector2.h. References Keos::CVector2< T >::x, and Keos::CVector2< T >::y.

template<class T>
CVector2< T > Keos::CVector2< T >::operator- | ( |  | ) | const`[inline]`

| Definition at line 157 of file KeosVector2.h. References Keos::CVector2< T >::x, and Keos::CVector2< T >::y.

template<class T>
const CVector2< T > & Keos::CVector2< T >::operator-= | ( | const CVector2< T > & | v | ) | `[inline]`

| Definition at line 188 of file KeosVector2.h. References Keos::CVector2< T >::x, and Keos::CVector2< T >::y.

template<class T>
CVector2< T > Keos::CVector2< T >::operator/ | ( | T | t | ) | const`[inline]`

| Definition at line 205 of file KeosVector2.h. References Keos::CVector2< T >::x, and Keos::CVector2< T >::y.

template<class T>
const CVector2< T > & Keos::CVector2< T >::operator/= | ( | T | t | ) | `[inline]`

| Definition at line 222 of file KeosVector2.h. References Keos::CVector2< T >::x, and Keos::CVector2< T >::y.

template<class T>
bool Keos::CVector2< T >::operator== | ( | const CVector2< T > & | v | ) | const`[inline]`

| Definition at line 232 of file KeosVector2.h. References Keos::CVector2< T >::x, and Keos::CVector2< T >::y.

template<class T>
void Keos::CVector2< T >::Set | ( | T | X,
|  | T | Y
| ) | `[inline]`

| Set vector. Definition at line 115 of file KeosVector2.h. References Keos::CVector2< T >::x, and Keos::CVector2< T >::y. Referenced by Keos::CFontManager::DrawString(), and Keos::CRectangle::Set().

## Member Data Documentation

template<class T>
T Keos::CVector2< T >::x

| Definition at line 83 of file KeosVector2.h. Referenced by Keos::CGraphicString::Align(), Keos::Console::CLookDefault::CLookDefault(), Keos::CImage::CopyImage(), Keos::CImage::Flip(), Keos::CImage::GetPixel(), Keos::CFontManager::GetStringPixelSize(), Keos::CRectangle::Intersects(), Keos::CRectangle::Left(), Keos::CVector2< T >::LengthSq(), Keos::CMDLQ1Loader::LoadFromFile(), Keos::CMD2Loader::LoadFromFile(), Keos::CImage::Mirror(), Keos::CVector2< T >::Normalize(), Keos::CVector2< T >::operator *(), Keos::CVector2< T >::operator *=(), Keos::CVector2< T >::operator T *(), Keos::CVector2< T >::operator+(), Keos::CVector2< T >::operator+=(), Keos::CVector2< T >::operator-(), Keos::CVector2< T >::operator-=(), Keos::CVector2< T >::operator/(), Keos::CVector2< T >::operator/=(), Keos::CVector2< T >::operator==(), Keos::CRectangle::Right(), Keos::CImagesLoader::SaveToFile(), Keos::CVector2< T >::Set(), Keos::CImage::SetPixel(), Keos::CImage::SubImage(), Keos::COGLTexture::Update(), Keos::CD3D9Texture::Update(), Keos::CD3D9Texture::UpdateSurface(), and Keos::CRectangle::Width().

template<class T>
T Keos::CVector2< T >::y

| Definition at line 83 of file KeosVector2.h. Referenced by Keos::Console::CLookDefault::AddLine(), Keos::CGraphicString::Align(), Keos::CRectangle::Bottom(), Keos::Console::CLookDefault::CLookDefault(), Keos::CImage::CopyImage(), Keos::CImage::Flip(), Keos::CFontManager::GetStringPixelSize(), Keos::CRectangle::Height(), Keos::CRectangle::Intersects(), Keos::CVector2< T >::LengthSq(), Keos::CMDLQ1Loader::LoadFromFile(), Keos::CMD2Loader::LoadFromFile(), Keos::CImage::Mirror(), Keos::CVector2< T >::Normalize(), Keos::CVector2< T >::operator *(), Keos::CVector2< T >::operator *=(), Keos::CVector2< T >::operator+(), Keos::CVector2< T >::operator+=(), Keos::CVector2< T >::operator-(), Keos::CVector2< T >::operator-=(), Keos::CVector2< T >::operator/(), Keos::CVector2< T >::operator/=(), Keos::CVector2< T >::operator==(), Keos::CImagesLoader::SaveToFile(), Keos::CVector2< T >::Set(), Keos::CImage::SubImage(), Keos::CRectangle::Top(), Keos::COGLTexture::Update(), and Keos::CD3D9Texture::Update().

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

- KeosEngine/KeosVector2.h