#include <iostream>
#include <cmath>
Go to the source code of this file.
Typedefs | |
typedef double | component |
The type of the vector components. | |
Functions | |
vector2 | operator+ (const vector2 &u, const vector2 &v) |
Component-wise addition. | |
vector2 | operator+ (const vector2 &u, const component c) |
Per-component addition of a scalar. | |
vector2 | operator+ (const component c, const vector2 &u) |
Per-component addition of a scalar. | |
vector2 | operator- (const vector2 &u, const vector2 &v) |
Component-wise subtraction. | |
vector2 | operator- (const vector2 &u, const component c) |
Per-component subtraction of a scalar. | |
vector2 | operator- (const component c, const vector2 &u) |
Per-component subtraction from a scalar. | |
vector2 | operator- (const vector2 &u) |
Negation. | |
component | operator * (const vector2 &u, const vector2 &v) |
Scalar product. | |
vector2 | operator * (const component c, const vector2 &u) |
Multiplication with a scalar. | |
vector2 | operator * (const vector2 &u, const component c) |
Multiplication with a scalar. | |
vector2 | operator/ (const vector2 &u, const vector2 &v) |
Component-wise division. | |
vector2 | operator/ (const vector2 &u, const component c) |
Division by a scalar. | |
vector2 | operator/ (const component c, const vector2 &u) |
Component-wise scalar division. | |
component | operator% (const vector2 &u, const vector2 &v) |
2D cross product. | |
bool | operator== (const vector2 &u, const vector2 &v) |
Equality test. | |
bool | operator!= (const vector2 &u, const vector2 &v) |
Inequality test. | |
component | length (const vector2 &u) |
Euclidean length. | |
vector2 | normalize (const vector2 &u) |
Normalization. | |
vector2 | signSquare (vector2 &v) |
Computes the component-wise square of a given vector retaining the sign. | |
vector2 | project (vector2 &u, vector2 &vStart, vector2 &vEnd) |
Projects point onto a line. | |
bool | below (vector2 &u, vector2 &vStart, vector2 &vEnd) |
Checks if a given point is below a given segment. | |
vector2 | perpendicular (const vector2 &u) |
Returns the normalized perpendicular of a given vector. | |
vector2 | rotate (vector2 &u, component theta) |
Rotates a given vector around the origin by a given angle. | |
component | perturbate (component mu, component sigma) |
Computes an approximated sample of a normal distribution. | |
vector2 | perturbate (vector2 &mu, component sigma) |
Perturbates a given vector approximately according to a normal distribution. | |
vector2 | perturbate (vector2 &u, component sigma1, component theta, component sigma2) |
Perturbates a given vector approximately according to a normal distribution. | |
ostream & | operator<< (ostream &os, const vector2 &u) |
Writes a vector to a given output stream. |
|
Checks if a given point is below a given segment.
|
|
Writes a vector to a given output stream.
|
|
Returns the normalized perpendicular of a given vector.
|
|
Perturbates a given vector approximately according to a normal distribution. The following steps are performed:
|
|
Perturbates a given vector approximately according to a normal distribution. Equivalent to applying perturbate(mu.x, sigma) and perturbate(mu.y, sigma).
|
|
Computes an approximated sample of a normal distribution.
|
|
Projects point onto a line.
|
|
Rotates a given vector around the origin by a given angle.
|
|
Computes the component-wise square of a given vector retaining the sign.
|