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

#include <Karto.h>

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
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 
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

class boost::serialization::access
 
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 1000 of file Karto.h.

Constructor & Destructor Documentation

◆ Vector2() [1/2]

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

Default constructor

Definition at line 1006 of file Karto.h.

◆ Vector2() [2/2]

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

Constructor initializing vector location

Parameters
x
y

Definition at line 1017 of file Karto.h.

Member Function Documentation

◆ Distance()

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 1112 of file Karto.h.

◆ GetX()

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 1028 of file Karto.h.

◆ GetY()

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 1046 of file Karto.h.

◆ Length()

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 1093 of file Karto.h.

◆ MakeCeil()

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

Ceiling point operator

Parameters
rOther

Definition at line 1074 of file Karto.h.

◆ MakeFloor()

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

Floor point operator

Parameters
rOther

Definition at line 1064 of file Karto.h.

◆ operator!=()

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 1227 of file Karto.h.

◆ operator*() [1/2]

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 1181 of file Karto.h.

◆ operator*() [2/2]

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

Scales the vector by the given scalar

Parameters
scalar

Definition at line 1190 of file Karto.h.

◆ operator*=()

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

In place scalar multiplication operator

Parameters
scalar

Definition at line 1208 of file Karto.h.

◆ operator+()

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 1141 of file Karto.h.

◆ operator+=()

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

In place Vector2 addition.

Definition at line 1121 of file Karto.h.

◆ operator-() [1/2]

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 1151 of file Karto.h.

◆ operator-() [2/2]

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

Subtract the vector by the given scalar

Parameters
scalar

Definition at line 1199 of file Karto.h.

◆ operator-=()

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

In place Vector2 subtraction.

Definition at line 1130 of file Karto.h.

◆ operator/()

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

Divides a Vector2

Parameters
scalar
Returns
scalar product

Definition at line 1171 of file Karto.h.

◆ operator/=()

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

In place scalar division operator

Parameters
scalar

Definition at line 1160 of file Karto.h.

◆ operator<()

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 1237 of file Karto.h.

◆ operator==()

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 1218 of file Karto.h.

◆ serialize()

template<typename T >
template<class Archive >
void karto::Vector2< T >::serialize ( Archive &  ar,
const unsigned int  version 
)
inline

Definition at line 1270 of file Karto.h.

◆ SetX()

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 1037 of file Karto.h.

◆ SetY()

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 1055 of file Karto.h.

◆ SquaredDistance()

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 1102 of file Karto.h.

◆ SquaredLength()

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 1084 of file Karto.h.

Friends And Related Function Documentation

◆ boost::serialization::access

template<typename T >
friend class boost::serialization::access
friend

Definition at line 1268 of file Karto.h.

◆ operator<<

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 1252 of file Karto.h.

◆ operator>>

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

Read Vector2 from input stream

Parameters
rStreaminput stream

Definition at line 1262 of file Karto.h.

Member Data Documentation

◆ m_Values

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

Definition at line 1277 of file Karto.h.


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


slam_toolbox
Author(s): Steve Macenski
autogenerated on Thu Jan 11 2024 03:37:56