Menge
Modular Pedestrian Simulation Framework for Research and Development
|
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... | |
Vector2d & | operator*= (float s) |
Perform in-place scalar multiplication on this vector. More... | |
Vector2d & | operator/= (float s) |
Perform in-place scalar division on this vector. More... | |
Vector2d & | operator+= (const Vector2d &v) |
Perform in-place vector addition on this vector. More... | |
Vector2d & | operator-= (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 | |
Templated vector in R2.
|
inline |
Constructor with arguments.
x | The x-value of the vector. |
y | The y-value of the vector. |
|
inline |
Copy constructor.
v | The vector to copy from. |
|
inline |
Compute the distance from this vector to another point.
p | The point whose distance from this vector (interpreted as a point) is to be computed |
|
inline |
Compute the distance from this vector to another point.
x | The x-value of the other point. |
y | The y-value of the other point. |
|
inline |
Compute the squared-distance from this vector to another point.
p | The point whose distance from this vector (interpreted as a point) is to be computed |
|
inline |
Compute the squared-distance from this vector to another point.
x | The x-value of the other point. |
y | The y-value of the other point. |
|
inline |
Compute the magnitude (aka length) of the vector.
|
inline |
Reports if this vector is the different from the given vector.
v | The second operand. |
|
inline |
Computes the dot product of this vector with the given vector.
v | The two-dimensional vector with which the dot product should be computed. |
|
inline |
Computes the scalar multiplication of this vector with the given scalar value.
s | The scalar value |
|
inline |
Perform in-place scalar multiplication on this vector.
s | The scalar mutliplicand. |
|
inline |
Computes the vector sum of this vector with the given vector.
v | The second operand. |
|
inline |
Perform in-place vector addition on this vector.
v | The second vector operand. |
|
inline |
Vector negation. Creates a new vector which is the negation of this vector.
|
inline |
Computes the vector difference of this vector with the given vector.
v | The second operand. |
|
inline |
Perform in-place vector subtraction on this vector.
v | The second vector operand. |
|
inline |
Computes the scalar division of this vector with the given scalar value.
s | The scalar value |
|
inline |
Perform in-place scalar division on this vector.
s | The scalar divisor. |
|
inline |
Reports if this vector is the same as the given vector.
v | The second operand. |
|
inline |
Set the x- and y-values from scalar values.
x | The value for the x-component |
y | The value for the y-component |
|
inline |
Set the x- and y-values from a vector.
v | The vector containing the x- and y-values |
|
inline |
Set the x-value.
x | The x-value. |
|
inline |
Set the y-value.
y | The y-value. |
|
inline |
Get the x-value.
|
inline |
Get the y-value.