Trying to switch to more object-oriented
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
#ifndef SDLPP_HPP_GEOMETRY_VECTOR
|
||||
#define SDLPP_HPP_GEOMETRY_VECTOR
|
||||
|
||||
#include "sdlpp_common.hpp"
|
||||
#include "sdlpp_vector.hpp"
|
||||
#include <cmath>
|
||||
|
||||
namespace SDLPP {
|
||||
template<typename T>
|
||||
double vecDotProduct( const Vec2D<T> &a, const Vec2D<T> &b ) {
|
||||
return a * b;
|
||||
}
|
||||
template<typename T>
|
||||
double vecLengthSquared( const Vec2D<T> &vec ) {
|
||||
return vecDotProduct( vec, vec );
|
||||
}
|
||||
template<typename T>
|
||||
double vecLength( const Vec2D<T> &vec ) {
|
||||
return std::sqrt( vecLengthSquared( vec ) );
|
||||
}
|
||||
template<typename T>
|
||||
double vecDistanceSquared( const Vec2D<T> &a, const Vec2D<T> &b ) {
|
||||
return vecLengthSquared( a - b );
|
||||
}
|
||||
template<typename T>
|
||||
double vecDistance( const Vec2D<T> &a, const Vec2D<T> &b ) {
|
||||
return vecLength( a - b );
|
||||
}
|
||||
} // namespace SDLPP
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user