Main Page | Class List | Directories | File List | Class Members | File Members

vector2.h File Reference

#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.


Detailed Description


Function Documentation

bool below vector2 u,
vector2 vStart,
vector2 vEnd
 

Checks if a given point is below a given segment.

Parameters:
u the point
vStart start point of the segment
vEnd the end point of the segment
Returns:
true iff the point is below the segment

ostream& operator<< ostream &  os,
const vector2 u
 

Writes a vector to a given output stream.

Parameters:
os the output stream
u the vector
Returns:
the written-to output stream

vector2 perpendicular const vector2 u  ) 
 

Returns the normalized perpendicular of a given vector.

Parameters:
u the vector of which the perpendicular is computed
Returns:
the normalized perpendicular

vector2 perturbate vector2 u,
component  sigma1,
component  theta,
component  sigma2
 

Perturbates a given vector approximately according to a normal distribution.

The following steps are performed:

  • perturbate the length with a given standard deviation
  • rotate the vector around an angle with given mean and standard deviation
    Parameters:
    u the vector to be perturbated
    sigma1 the standard deviation for the length perturbation
    theta the mean roation angle
    sigma2 the standard deviation of the rotation angle
    Returns:
    the perturbated vector
    See also:
    perturbate(component, component)

vector2 perturbate vector2 mu,
component  sigma
 

Perturbates a given vector approximately according to a normal distribution.

Equivalent to applying perturbate(mu.x, sigma) and perturbate(mu.y, sigma).

Parameters:
mu the mean vector
sigma the standard deviation
Returns:
the approximatly normally perturbated vector
See also:
perturbate(component, component)

component perturbate component  mu,
component  sigma
 

Computes an approximated sample of a normal distribution.

Parameters:
mu the mean
sigma the standard deviation
Returns:
an approximated sample of the normal distribution N(mu, sigma)

vector2 project vector2 u,
vector2 vStart,
vector2 vEnd
 

Projects point onto a line.

Parameters:
u the point to be projected
vStart the start point of the line
vEnd the end point of the line
Returns:
the projected point

vector2 rotate vector2 u,
component  theta
 

Rotates a given vector around the origin by a given angle.

Parameters:
u the vector to be rotated
theta the rotation angle
Returns:
the rotated vector

vector2 signSquare vector2 v  ) 
 

Computes the component-wise square of a given vector retaining the sign.

Parameters:
v the vector
Returns:
the component-wise square of the vector with the sign retained


Generated on Sun Jul 10 22:32:04 2005 for S12 by  doxygen 1.4.2