Public Member Functions | Private Attributes | Friends
karto::Vector2< T > Class Template Reference

#include <Karto.h>

List of all members.

Public Member Functions

kt_double Distance (const Vector2 &rOther) const
const T & GetX () const
const T & GetY () const
kt_double Length () const
void MakeCeil (const Vector2 &rOther)
void MakeFloor (const Vector2 &rOther)
kt_bool operator!= (const Vector2 &rOther) const
kt_double operator* (const Vector2 &rOther) const
const Vector2 operator* (T scalar) const
void operator*= (T scalar)
const Vector2 operator+ (const Vector2 &rOther) const
void operator+= (const Vector2 &rOther)
const Vector2 operator- (const Vector2 &rOther) const
const Vector2 operator- (T scalar) const
void operator-= (const Vector2 &rOther)
const Vector2 operator/ (T scalar) const
void operator/= (T scalar)
kt_bool operator< (const Vector2 &rOther) const
kt_bool operator== (const Vector2 &rOther) const
void SetX (const T &x)
void SetY (const T &y)
kt_double SquaredDistance (const Vector2 &rOther) const
kt_double SquaredLength () const
 Vector2 ()
 Vector2 (T x, T y)

Private Attributes

m_Values [2]

Friends

std::ostream & operator<< (std::ostream &rStream, const Vector2 &rVector)
std::istream & operator>> (std::istream &rStream, const Vector2 &)

Detailed Description

template<typename T>
class karto::Vector2< T >

Represents a vector (x, y) in 2-dimensional real space.

Definition at line 929 of file Karto.h.


Constructor & Destructor Documentation

template<typename T>
karto::Vector2< T >::Vector2 ( ) [inline]

Default constructor

Definition at line 935 of file Karto.h.

template<typename T>
karto::Vector2< T >::Vector2 ( x,
y 
) [inline]

Constructor initializing vector location

Parameters:
x
y

Definition at line 946 of file Karto.h.


Member Function Documentation

template<typename T>
kt_double karto::Vector2< T >::Distance ( const Vector2< T > &  rOther) const [inline]

Gets the distance to the other vector2

Parameters:
rOther
Returns:
distance to other vector2

Definition at line 1041 of file Karto.h.

template<typename T>
const T& karto::Vector2< T >::GetX ( ) const [inline]

Gets the x-coordinate of this vector2

Returns:
the x-coordinate of the vector2

Definition at line 957 of file Karto.h.

template<typename T>
const T& karto::Vector2< T >::GetY ( ) const [inline]

Gets the y-coordinate of this vector2

Returns:
the y-coordinate of the vector2

Definition at line 975 of file Karto.h.

template<typename T>
kt_double karto::Vector2< T >::Length ( ) const [inline]

Returns the length of the vector (x and y).

Returns:
length of the vector

Definition at line 1022 of file Karto.h.

template<typename T>
void karto::Vector2< T >::MakeCeil ( const Vector2< T > &  rOther) [inline]

Ceiling point operator

Parameters:
rOther

Definition at line 1003 of file Karto.h.

template<typename T>
void karto::Vector2< T >::MakeFloor ( const Vector2< T > &  rOther) [inline]

Floor point operator

Parameters:
rOther

Definition at line 993 of file Karto.h.

template<typename T>
kt_bool karto::Vector2< T >::operator!= ( const Vector2< T > &  rOther) const [inline]

Inequality operator returns true if any of the corresponding x, y values of each Vector2 not the same.

Parameters:
rOther

Definition at line 1156 of file Karto.h.

template<typename T>
kt_double karto::Vector2< T >::operator* ( const Vector2< T > &  rOther) const [inline]

Computes the dot product between the two vectors

Parameters:
rOther
Returns:
dot product

Definition at line 1110 of file Karto.h.

template<typename T>
const Vector2 karto::Vector2< T >::operator* ( scalar) const [inline]

Scales the vector by the given scalar

Parameters:
scalar

Definition at line 1119 of file Karto.h.

template<typename T>
void karto::Vector2< T >::operator*= ( scalar) [inline]

In place scalar multiplication operator

Parameters:
scalar

Definition at line 1137 of file Karto.h.

template<typename T>
const Vector2 karto::Vector2< T >::operator+ ( const Vector2< T > &  rOther) const [inline]

Addition operator

Parameters:
rOther
Returns:
vector resulting from adding this vector with the given vector

Definition at line 1070 of file Karto.h.

template<typename T>
void karto::Vector2< T >::operator+= ( const Vector2< T > &  rOther) [inline]

In place Vector2 addition.

Definition at line 1050 of file Karto.h.

template<typename T>
const Vector2 karto::Vector2< T >::operator- ( const Vector2< T > &  rOther) const [inline]

Subtraction operator

Parameters:
rOther
Returns:
vector resulting from subtracting this vector from the given vector

Definition at line 1080 of file Karto.h.

template<typename T>
const Vector2 karto::Vector2< T >::operator- ( scalar) const [inline]

Subtract the vector by the given scalar

Parameters:
scalar

Definition at line 1128 of file Karto.h.

template<typename T>
void karto::Vector2< T >::operator-= ( const Vector2< T > &  rOther) [inline]

In place Vector2 subtraction.

Definition at line 1059 of file Karto.h.

template<typename T>
const Vector2 karto::Vector2< T >::operator/ ( scalar) const [inline]

Divides a Vector2

Parameters:
scalar
Returns:
scalar product

Definition at line 1100 of file Karto.h.

template<typename T>
void karto::Vector2< T >::operator/= ( scalar) [inline]

In place scalar division operator

Parameters:
scalar

Definition at line 1089 of file Karto.h.

template<typename T>
kt_bool karto::Vector2< T >::operator< ( const Vector2< T > &  rOther) const [inline]

Less than operator

Parameters:
rOther
Returns:
true if left vector is less than right vector

Definition at line 1166 of file Karto.h.

template<typename T>
kt_bool karto::Vector2< T >::operator== ( const Vector2< T > &  rOther) const [inline]

Equality operator returns true if the corresponding x, y values of each Vector2 are the same values.

Parameters:
rOther

Definition at line 1147 of file Karto.h.

template<typename T>
void karto::Vector2< T >::SetX ( const T &  x) [inline]

Sets the x-coordinate of this vector2

Parameters:
xthe x-coordinate of the vector2

Definition at line 966 of file Karto.h.

template<typename T>
void karto::Vector2< T >::SetY ( const T &  y) [inline]

Sets the y-coordinate of this vector2

Parameters:
ythe y-coordinate of the vector2

Definition at line 984 of file Karto.h.

template<typename T>
kt_double karto::Vector2< T >::SquaredDistance ( const Vector2< T > &  rOther) const [inline]

Returns the square distance to the given vector

Returns:
square distance to the given vector

Definition at line 1031 of file Karto.h.

template<typename T>
kt_double karto::Vector2< T >::SquaredLength ( ) const [inline]

Returns the square of the length of the vector

Returns:
square of the length of the vector

Definition at line 1013 of file Karto.h.


Friends And Related Function Documentation

template<typename T>
std::ostream& operator<< ( std::ostream &  rStream,
const Vector2< T > &  rVector 
) [friend]

Write Vector2 onto output stream

Parameters:
rStreamoutput stream
rVectorto write

Definition at line 1181 of file Karto.h.

template<typename T>
std::istream& operator>> ( std::istream &  rStream,
const Vector2< T > &   
) [friend]

Read Vector2 from input stream

Parameters:
rStreaminput stream

Definition at line 1191 of file Karto.h.


Member Data Documentation

template<typename T>
T karto::Vector2< T >::m_Values[2] [private]

Definition at line 1198 of file Karto.h.


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


open_karto
Author(s):
autogenerated on Thu Jun 6 2019 21:02:57