VectorAlgebra3D.hpp File Reference

Algebraic operations on three-dimensional vectors (dot and cross product, vector length and angles, ...) More...

Go to the source code of this file.

## Functions

template<typename T >
thor::length (const sf::Vector3< T > &vector)
Returns the length of the 3D vector.

template<typename T >
thor::squaredLength (const sf::Vector3< T > &vector)
Returns the square of vector's length. More...

template<typename T >
sf::Vector3< T > thor::unitVector (const sf::Vector3< T > &vector)
Returns a vector with same direction as the argument, but with length 1. More...

template<typename T >
thor::polarAngle (const sf::Vector3< T > &vector)
Returns the angle between the projection of vector onto the XY-plane and the X-axis. More...

template<typename T >
thor::elevationAngle (const sf::Vector3< T > &vector)
Returns the elevation angle of vector. More...

template<typename T >
thor::dotProduct (const sf::Vector3< T > &lhs, const sf::Vector3< T > &rhs)
Computes the dot product of two 3D vectors.

template<typename T >
sf::Vector3< T > thor::crossProduct (const sf::Vector3< T > &lhs, const sf::Vector3< T > &rhs)
Computes the cross product of two 3D vectors.

template<typename T >
sf::Vector3< T > thor::cwiseProduct (const sf::Vector3< T > &lhs, const sf::Vector3< T > &rhs)
Returns the component-wise product of lhs and rhs. More...

template<typename T >
sf::Vector3< T > thor::cwiseQuotient (const sf::Vector3< T > &lhs, const sf::Vector3< T > &rhs)
Returns the component-wise quotient of lhs and rhs. More...

template<typename T >
sf::Vector3< T > thor::toVector3 (const sf::Vector2< T > &vector2)
Constructs a 3D vector from a 2D vector by setting the Z component to zero.

## Detailed Description

Algebraic operations on three-dimensional vectors (dot and cross product, vector length and angles, ...)

Here is an overview over the functionality:

 dotProduct(v,w) length(v) unitVector(v) crossProduct(v,w) squaredLength(v) toVector3(v) cwiseProduct(v,w) polarAngle(v) cwiseQuotient(v,w) elevationAngle(v)