Steeriously  0.1
 All Classes Namespaces Functions Variables Typedefs Enumerations Pages
Public Member Functions | Static Public Member Functions | List of all members
steer::VectorMath Class Reference

Stateless VectorMath class utilizing static methods to manipulate vectors.
Copies of Vector2 are cheap, therefore all functions are "pass by value" at this time. More...

#include <VectorMath.hpp>

Public Member Functions

 VectorMath ()
 Constructor.
 
 ~VectorMath ()
 Destructor.
 

Static Public Member Functions

static Vector2 componentProduct (Vector2 a, Vector2 b)
 A static method returning a vector that is the component product of two vectors.
 
static Vector2 truncate (Vector2 v, float max)
 A static method returning a truncated vector based on some maximum value.
 
static float dotProduct (Vector2 a, Vector2 b)
 A static method returning the dot product of two vectors.
 
static Vector2 perpendicular (Vector2 a)
 A static method returning a vector that is perpendicular to the vector supplied.
 
static Vector2 direction (Vector2 a, Vector2 b)
 A static method returning the directional vector that vector a needs to be transformed to in order to point towards vector b.
 
static float distance (Vector2 a, Vector2 b)
 A static method returning the distance between two given vectors, a and b.
 
static float distanceSquared (Vector2 a, Vector2 b)
 A static method returning the distance squared between two given vectors, a and b - avoids the overhead of sqrt when necessary.
 
static float findAngle (Vector2 v)
 A static method returning the angle resolved from a vector (pass in vector1 - vector2 or a precomputed vector) - useful for finding the angle of a target, for example.
Internally, this function converts from radians to degrees so you don't have to.
 
static float length (Vector2 v)
 A static method returning the length (or magnitude) of a vector.
 
static float lengthSquared (Vector2 v)
 A static method returning the squared length of a vector.
 
static Vector2 normalize (Vector2 v)
 A static method returning a normalized (or unit) vector.
 
static bool lineIntersectsCircle (Vector2 ahead, Vector2 ahead2, SphereObstacle obstacle, Vector2 agentPosition)
 A static method returning a boolean to test whether a vector intersects a circle.
 

Detailed Description

Stateless VectorMath class utilizing static methods to manipulate vectors.
Copies of Vector2 are cheap, therefore all functions are "pass by value" at this time.

Member Function Documentation

Vector2 steer::VectorMath::componentProduct ( Vector2  a,
Vector2  b 
)
static

A static method returning a vector that is the component product of two vectors.

See Also
static Vector2 componentProduct(Vector2 a, Vector2 b)
Parameters
a- a vector of doubles.
b- a vector of doubles.
Vector2 steer::VectorMath::direction ( Vector2  a,
Vector2  b 
)
static

A static method returning the directional vector that vector a needs to be transformed to in order to point towards vector b.

See Also
static Vector2 direction(Vector2 a, Vector2 b)
Parameters
a- a vector of doubles.
b- a vector of doubles.
float steer::VectorMath::distance ( Vector2  a,
Vector2  b 
)
static

A static method returning the distance between two given vectors, a and b.

See Also
static float distance(Vector2 a, Vector2 b)
Parameters
a- a vector of doubles.
b- a vector of doubles.
float steer::VectorMath::distanceSquared ( Vector2  a,
Vector2  b 
)
static

A static method returning the distance squared between two given vectors, a and b - avoids the overhead of sqrt when necessary.

See Also
static float distanceSquared(Vector2 a, Vector2 b)
Parameters
a- a vector of doubles.
b- a vector of doubles.
float steer::VectorMath::dotProduct ( Vector2  a,
Vector2  b 
)
static

A static method returning the dot product of two vectors.

See Also
static float dotProduct(Vector2 a, Vector2 b)
Parameters
a- a vector of doubles.
b- a vector of doubles.
float steer::VectorMath::findAngle ( Vector2  v)
static

A static method returning the angle resolved from a vector (pass in vector1 - vector2 or a precomputed vector) - useful for finding the angle of a target, for example.
Internally, this function converts from radians to degrees so you don't have to.

See Also
static float findAngle(Vector2 v)
Parameters
v- a vector of doubles.
float steer::VectorMath::length ( Vector2  v)
static

A static method returning the length (or magnitude) of a vector.

See Also
static float length(Vector2 v)
Parameters
v- a vector of doubles.
float steer::VectorMath::lengthSquared ( Vector2  v)
static

A static method returning the squared length of a vector.

See Also
static float lengthSquared(Vector2 v)
Parameters
v- a vector of doubles.
bool steer::VectorMath::lineIntersectsCircle ( Vector2  ahead,
Vector2  ahead2,
steer::SphereObstacle  obstacle,
Vector2  agentPosition 
)
static

A static method returning a boolean to test whether a vector intersects a circle.

See Also
static Vector2 lineIntersectsCircle(Vector2 ahead, Vector2 ahead2, SphereObstacle obstacle)
Parameters
ahead- a vector of doubles.
ahead2- a vector of doubles.
obstacle- an steer::SphereObstacle.
Vector2 steer::VectorMath::normalize ( Vector2  v)
static

A static method returning a normalized (or unit) vector.

See Also
static Vector2 normalize(Vector2 v)
Parameters
v- a vector of doubles.
Vector2 steer::VectorMath::perpendicular ( Vector2  a)
static

A static method returning a vector that is perpendicular to the vector supplied.

See Also
static Vector2 perpendicular(Vector2 a)
Parameters
a- a vector of doubles.
Vector2 steer::VectorMath::truncate ( Vector2  v,
float  max 
)
static

A static method returning a truncated vector based on some maximum value.

See Also
static Vector2 truncate(Vector2 v, float max)
Parameters
a- a vector of doubles.
max- a plain old float.

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