Trying to switch to more object-oriented

This commit is contained in:
2021-03-12 22:33:46 +01:00
parent fbe122a5b9
commit 258ce51cfe
32 changed files with 693 additions and 249 deletions
+31
View File
@@ -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