Point2< T > Class Template Reference

A 2D Point template. More...

#include <Math/Point.h>

List of all members.

Public Member Functions

 Point2 ()
 Defualt constructer. Constructs the origin (0,0).
 Point2 (T _x, T _y)
 Constructs a spacific point.
 Point2 (const Vector2< T > &v)
 Constructer to convert a 2D vector to a point.
void Set (T _x, T _y)
 Sets the (x,y) data of th point.
Point2 operator+ (const Point2 &p) const
 Overloaded point addition operator.
Point2 operator+ (const Vector2< T > &v) const
 Overloaded point-vector addition operator.
Point2operator+= (const Point2 &p)
 Overloaded sum assignment operator. Adds the given Point to this Point.
Vector2< T > operator- (const Point2 &p) const
 Overloaded Point subtraction operator.
Point2< T > operator- () const
 Overloaded Point negation operator.
Point2operator-= (const Point2 &p)
 Overloaded subtraction assignment operator. Subtracts the given Point from this Point.
T & operator[] (int i)
 Overloaded array access operator.
operator[] (int i) const
 Overloaded array access operator.
Point2 operator* (T c) const
 Overloaded constant multiplication operator.

Public Attributes

x
 The (x,y) point data.

Friends

Point2 operator* (float c, const Point2 &p)
 Overloaded constant-point multiplication operator.

Detailed Description

template<class T>
class Point2< T >

A 2D Point template.

Template Parameters:
T the type that x and y take. Usually float, double, int or byte.

A 2D Point template that provides useful methods for manipulating 2D Points.


Constructor & Destructor Documentation

template<class T>
Point2< T >::Point2 ( _x,
_y 
) [inline]

Constructs a spacific point.

Parameters:
[in] _x the x position.
[in] _y the y position.
template<class T>
Point2< T >::Point2 ( const Vector2< T > &  v  )  [inline]

Constructer to convert a 2D vector to a point.

Parameters:
[in] v the vector to convert.

Member Function Documentation

template<class T>
Point2 Point2< T >::operator* ( c  )  const [inline]

Overloaded constant multiplication operator.

Parameters:
[in] c the constant to multiply by.
Returns:
The point result of multiply this point by c.
template<class T>
Point2 Point2< T >::operator+ ( const Vector2< T > &  v  )  const [inline]

Overloaded point-vector addition operator.

Parameters:
[in] v the vector to add to.
Returns:
The Point result of adding this point to the vector v.
template<class T>
Point2 Point2< T >::operator+ ( const Point2< T > &  p  )  const [inline]

Overloaded point addition operator.

Parameters:
[in] p the point to add to.
Returns:
The Point result of adding this point and p.
template<class T>
Point2& Point2< T >::operator+= ( const Point2< T > &  p  )  [inline]

Overloaded sum assignment operator. Adds the given Point to this Point.

Parameters:
[in] p the point to add.
Returns:
A referance to this Point.
template<class T>
Point2<T> Point2< T >::operator- (  )  const [inline]

Overloaded Point negation operator.

Returns:
The negation of this point.
template<class T>
Vector2<T> Point2< T >::operator- ( const Point2< T > &  p  )  const [inline]

Overloaded Point subtraction operator.

Parameters:
[in] p the point to subtract from.
Returns:
The Vector result of subtracting p from this point.
template<class T>
Point2& Point2< T >::operator-= ( const Point2< T > &  p  )  [inline]

Overloaded subtraction assignment operator. Subtracts the given Point from this Point.

Parameters:
[in] p the point to subtract.
Returns:
A referance to this Point.
template<class T>
T Point2< T >::operator[] ( int  i  )  const [inline]

Overloaded array access operator.

Parameters:
[in] i must be either 0 for x or 1 for y
Returns:
Either x if i = 0 or y if i = 1
template<class T>
T& Point2< T >::operator[] ( int  i  )  [inline]

Overloaded array access operator.

Parameters:
[in] i must be either 0 for x or 1 for y
Returns:
Either a referance to x if i = 0 or a referance to y if i = 1
template<class T>
void Point2< T >::Set ( _x,
_y 
) [inline]

Sets the (x,y) data of th point.

Parameters:
[in] _x the value to set x to.
[in] _y the value to set y to.

Friends And Related Function Documentation

template<class T>
Point2 operator* ( float  c,
const Point2< T > &  p 
) [friend]

Overloaded constant-point multiplication operator.

Parameters:
[in] c the constant.
[in] p the point.
Returns:
The Point result c*p.

The documentation for this class was generated from the following file:
Generated on Mon Apr 5 19:08:06 2010 for BrickOut |ReDuX| by  doxygen 1.6.3