Menge Modular Pedestrian Simulation Framework for Research and Development
Menge::Math::Vector2d< Type > Class Template Reference

Templated vector in R2. More...

`#include <Vector2.h>`

## Public Member Functions

Vector2d ()
Default constructor. It does NOT initialize the fields.

Vector2d (Type x, Type y)
Constructor with arguments. More...

Vector2d (const Vector2d &v)
Copy constructor. More...

Type x () const
Get the x-value. More...

Type y () const
Get the y-value. More...

void set (Type x, Type y)
Set the x- and y-values from scalar values. More...

void set (const Vector2d &v)
Set the x- and y-values from a vector. More...

void setX (Type x)
Set the x-value. More...

void setY (Type y)
Set the y-value. More...

void zero ()
Set the vector to zero.

Vector2d< Type > operator- () const
Vector negation. Creates a new vector which is the negation of this vector. More...

float operator* (const Vector2d &v) const
Computes the dot product of this vector with the given vector. More...

Vector2d< Type > operator* (float s) const
Computes the scalar multiplication of this vector with the given scalar value. More...

Vector2d< Type > operator/ (float s) const
Computes the scalar division of this vector with the given scalar value. More...

Vector2d operator+ (const Vector2d &v) const
Computes the vector sum of this vector with the given vector. More...

Vector2d operator- (const Vector2d &v) const
Computes the vector difference of this vector with the given vector. More...

bool operator== (const Vector2d &v) const
Reports if this vector is the same as the given vector. More...

bool operator!= (const Vector2d &v) const
Reports if this vector is the different from the given vector. More...

Vector2doperator*= (float s)
Perform in-place scalar multiplication on this vector. More...

Vector2doperator/= (float s)
Perform in-place scalar division on this vector. More...

Vector2doperator+= (const Vector2d &v)
Perform in-place vector addition on this vector. More...

Vector2doperator-= (const Vector2d &v)
Perform in-place vector subtraction on this vector. More...

void negate ()
Negate the vector in place.

void normalize ()
Normalize the vector in place.

Type Length () const
Compute the magnitude (aka length) of the vector. More...

float distance (const Vector2d &p) const
Compute the distance from this vector to another point. More...

float distance (float x, float y) const
Compute the distance from this vector to another point. More...

float distanceSq (const Vector2d &p) const
Compute the squared-distance from this vector to another point. More...

float distanceSq (float x, float y) const
Compute the squared-distance from this vector to another point. More...

## Public Attributes

Type _x
x-component of the vector

Type _y
y-component of the vector

## Detailed Description

### template<class Type> class Menge::Math::Vector2d< Type >

Templated vector in R2.

## Constructor & Destructor Documentation

template<class Type>
 Menge::Math::Vector2d< Type >::Vector2d ( Type x, Type y )
inline

Constructor with arguments.

Parameters
 x The x-value of the vector. y The y-value of the vector.
template<class Type>
 Menge::Math::Vector2d< Type >::Vector2d ( const Vector2d< Type > & v )
inline

Copy constructor.

Parameters
 v The vector to copy from.

## Member Function Documentation

template<class Type>
 float Menge::Math::Vector2d< Type >::distance ( const Vector2d< Type > & p ) const
inline

Compute the distance from this vector to another point.

Parameters
 p The point whose distance from this vector (interpreted as a point) is to be computed
Returns
The distance between this vector and p.
template<class Type>
 float Menge::Math::Vector2d< Type >::distance ( float x, float y ) const
inline

Compute the distance from this vector to another point.

Parameters
 x The x-value of the other point. y The y-value of the other point.
Returns
The distance between this vector and (x, y).
template<class Type>
 float Menge::Math::Vector2d< Type >::distanceSq ( const Vector2d< Type > & p ) const
inline

Compute the squared-distance from this vector to another point.

Parameters
 p The point whose distance from this vector (interpreted as a point) is to be computed
Returns
The squared-distance between this vector and p.
template<class Type>
 float Menge::Math::Vector2d< Type >::distanceSq ( float x, float y ) const
inline

Compute the squared-distance from this vector to another point.

Parameters
 x The x-value of the other point. y The y-value of the other point.
Returns
The squared-distance between this vector and (x, y).
template<class Type>
 Type Menge::Math::Vector2d< Type >::Length ( ) const
inline

Compute the magnitude (aka length) of the vector.

Returns
The magnitude of the vector.
template<class Type>
 bool Menge::Math::Vector2d< Type >::operator!= ( const Vector2d< Type > & v ) const
inline

Reports if this vector is the different from the given vector.

Parameters
 v The second operand.
Returns
True if the vectors are at all different, false otherwise
template<class Type>
 float Menge::Math::Vector2d< Type >::operator* ( const Vector2d< Type > & v ) const
inline

Computes the dot product of this vector with the given vector.

Parameters
 v The two-dimensional vector with which the dot product should be computed.
Returns
The dot product of this two-dimensional vector with the specified two-dimensional vector.
template<class Type>
 Vector2d Menge::Math::Vector2d< Type >::operator* ( float s ) const
inline

Computes the scalar multiplication of this vector with the given scalar value.

Parameters
 s The scalar value
Returns
The scalar multiplication of this vector with the specified scalar value.
template<class Type>
 Vector2d& Menge::Math::Vector2d< Type >::operator*= ( float s )
inline

Perform in-place scalar multiplication on this vector.

Parameters
 s The scalar mutliplicand.
Returns
A reference to the vector.
template<class Type>
 Vector2d Menge::Math::Vector2d< Type >::operator+ ( const Vector2d< Type > & v ) const
inline

Computes the vector sum of this vector with the given vector.

Parameters
 v The second operand.
Returns
The vector sum of this vector with the given vector.
template<class Type>
 Vector2d& Menge::Math::Vector2d< Type >::operator+= ( const Vector2d< Type > & v )
inline

Perform in-place vector addition on this vector.

Parameters
 v The second vector operand.
Returns
A reference to the vector.
template<class Type>
 Vector2d Menge::Math::Vector2d< Type >::operator- ( ) const
inline

Vector negation. Creates a new vector which is the negation of this vector.

Returns
The vector in the opposite direction of this vector
template<class Type>
 Vector2d Menge::Math::Vector2d< Type >::operator- ( const Vector2d< Type > & v ) const
inline

Computes the vector difference of this vector with the given vector.

Parameters
 v The second operand.
Returns
The vector difference of this vector with the given vector.
template<class Type>
 Vector2d& Menge::Math::Vector2d< Type >::operator-= ( const Vector2d< Type > & v )
inline

Perform in-place vector subtraction on this vector.

Parameters
 v The second vector operand.
Returns
A reference to the vector.
template<class Type>
 Vector2d Menge::Math::Vector2d< Type >::operator/ ( float s ) const
inline

Computes the scalar division of this vector with the given scalar value.

Parameters
 s The scalar value
Returns
The scalar division of this vector with the specified scalar value.
template<class Type>
 Vector2d& Menge::Math::Vector2d< Type >::operator/= ( float s )
inline

Perform in-place scalar division on this vector.

Parameters
 s The scalar divisor.
Returns
A reference to the vector.
template<class Type>
 bool Menge::Math::Vector2d< Type >::operator== ( const Vector2d< Type > & v ) const
inline

Reports if this vector is the same as the given vector.

Parameters
 v The second operand.
Returns
True if the vectors are exactly identical, False otherwise
template<class Type>
 void Menge::Math::Vector2d< Type >::set ( Type x, Type y )
inline

Set the x- and y-values from scalar values.

Parameters
 x The value for the x-component y The value for the y-component
template<class Type>
 void Menge::Math::Vector2d< Type >::set ( const Vector2d< Type > & v )
inline

Set the x- and y-values from a vector.

Parameters
 v The vector containing the x- and y-values
template<class Type>
 void Menge::Math::Vector2d< Type >::setX ( Type x )
inline

Set the x-value.

Parameters
 x The x-value.
template<class Type>
 void Menge::Math::Vector2d< Type >::setY ( Type y )
inline

Set the y-value.

Parameters
 y The y-value.
template<class Type>
 Type Menge::Math::Vector2d< Type >::x ( ) const
inline

Get the x-value.

Returns
The x-value of the vector.
template<class Type>
 Type Menge::Math::Vector2d< Type >::y ( ) const
inline

Get the y-value.

Returns
The y-value of the vector.

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