![]() |
xyginext
0.2.0
Second generation of xygine game creation framework
|
Vector math utility functions. More...
Functions | |
static float | dot (const sf::Vector2f &lv, const sf::Vector2f &rv) |
Calculates the dot product of 2 vectors. | |
static sf::Vector2f | normalise (sf::Vector2f source) |
Returns a given vector with its length normalized to 1. | |
static float | lengthSquared (const sf::Vector2f &source) |
Returns length of a vector squared. More... | |
static float | length (const sf::Vector2f &source) |
Returns length of a given vector. More... | |
static sf::Vector2f | reflect (const sf::Vector2f &velocity, const sf::Vector2f &normal) |
Reflects a velocity vector about a given normal. | |
static sf::Vector2f | rotate (const sf::Vector2f &v, float degrees) |
Rotates a vector (not very accurately) More... | |
static float | rotation (const sf::Vector2f v) |
Gets the rotation (in degrees) of a vector. | |
template<typename T > | |
static sf::Vector2< T > | vec2FromString (const std::string &str) |
Converts a comma delimited string to vector 2. | |
template<typename T > | |
sf::Vector2< T > | operator* (const sf::Vector2< T > &l, const sf::Vector2< T > &r) |
Vector math utility functions.
|
inlinestatic |
Returns length of a given vector.
If comparing the length of two vectors it is mroe efficient to use the squared lengths
|
inlinestatic |
Returns length of a vector squared.
When comparing the length of two vectors it is less expensive to compare the squared lengths, which will return the same result
|
inlinestatic |
Rotates a vector (not very accurately)
v | Vector to rotate |
degrees | Number of degrees to rotate vector |