Add TMatrix2.
This commit is contained in:
parent
2bbeff1e23
commit
f137d6ba8a
@ -86,6 +86,11 @@ namespace Phanes::Core::Math {
|
|||||||
typedef TVector4<double, SIMD::use_simd<double, 4, true>::value> Vector4Regd;
|
typedef TVector4<double, SIMD::use_simd<double, 4, true>::value> Vector4Regd;
|
||||||
typedef TVector4<double, SIMD::use_simd<double, 4, true>::value> Vector4Regf64;
|
typedef TVector4<double, SIMD::use_simd<double, 4, true>::value> Vector4Regf64;
|
||||||
|
|
||||||
|
// Matrix2
|
||||||
|
|
||||||
|
typedef TMatrix2<float> Matrix2;
|
||||||
|
typedef TMatrix2<float> Matrix2f;
|
||||||
|
typedef TMatrix2<double> Matrix2d;
|
||||||
|
|
||||||
} // Phanes::Core::Math::coretypes
|
} // Phanes::Core::Math::coretypes
|
||||||
|
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
// ============================================= //
|
// ============================================= //
|
||||||
// Function to convert types into each other //
|
// Function to convert types into each other //
|
||||||
// //
|
// //
|
||||||
// @ref [FILE]MathUnitConversion //
|
// @ref [FILE]MathUnitConversion //
|
||||||
// ============================================= //
|
// ============================================= //
|
||||||
|
|
||||||
#ifdef P_BUILD_LIB
|
#ifdef P_BUILD_LIB
|
||||||
#include "PhanesEnginePCH.h"
|
#include "PhanesEnginePCH.h"
|
||||||
#else
|
#else
|
||||||
#include <string>
|
#include <string>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "Core/public/Math/Boilerplate.h"
|
#include "Core/public/Math/Boilerplate.h"
|
||||||
@ -31,77 +31,81 @@
|
|||||||
|
|
||||||
namespace Phanes::Core::Math {
|
namespace Phanes::Core::Math {
|
||||||
|
|
||||||
// =================================================== //
|
// =================================================== //
|
||||||
// std::to_string wrapper //
|
// std::to_string wrapper //
|
||||||
// //
|
// //
|
||||||
// This is, to make using ToString more general //
|
// This is, to make using ToString more general //
|
||||||
// and allow usage of one function instead of two, //
|
// and allow usage of one function instead of two, //
|
||||||
// for converting a mathmatical type to a string. //
|
// for converting a mathmatical type to a string. //
|
||||||
// =================================================== //
|
// =================================================== //
|
||||||
|
|
||||||
FORCEINLINE std::string ToString(long long val) { return std::to_string(val); };
|
FORCEINLINE std::string ToString(long long val) { return std::to_string(val); };
|
||||||
|
|
||||||
FORCEINLINE std::string ToString(double val) { return std::to_string(val); };
|
FORCEINLINE std::string ToString(double val) { return std::to_string(val); };
|
||||||
|
|
||||||
FORCEINLINE std::string ToString(float val) { return std::to_string(val); };
|
FORCEINLINE std::string ToString(float val) { return std::to_string(val); };
|
||||||
|
|
||||||
FORCEINLINE std::string ToString(int val) { return std::to_string(val); };
|
FORCEINLINE std::string ToString(int val) { return std::to_string(val); };
|
||||||
|
|
||||||
FORCEINLINE std::string ToString(long val) { return std::to_string(val); };
|
FORCEINLINE std::string ToString(long val) { return std::to_string(val); };
|
||||||
|
|
||||||
FORCEINLINE std::string ToString(long double val) { return std::to_string(val); };
|
FORCEINLINE std::string ToString(long double val) { return std::to_string(val); };
|
||||||
|
|
||||||
FORCEINLINE std::string ToString(unsigned long long val) { return std::to_string(val); };
|
FORCEINLINE std::string ToString(unsigned long long val) { return std::to_string(val); };
|
||||||
|
|
||||||
FORCEINLINE std::string ToString(unsigned int val) { return std::to_string(val); };
|
FORCEINLINE std::string ToString(unsigned int val) { return std::to_string(val); };
|
||||||
|
|
||||||
FORCEINLINE std::string ToString(unsigned long val) { return std::to_string(val); };
|
FORCEINLINE std::string ToString(unsigned long val) { return std::to_string(val); };
|
||||||
|
|
||||||
|
|
||||||
// ============ //
|
// ============ //
|
||||||
// ToString //
|
// ToString //
|
||||||
// ============ //
|
// ============ //
|
||||||
|
|
||||||
template<RealType T, bool S>
|
template<RealType T, bool S>
|
||||||
std::string ToString(const TVector2<T, S>& v)
|
std::string ToString(const TVector2<T, S>& v)
|
||||||
{
|
{
|
||||||
return "(" + ToString(v.x) + ", " + ToString(v.y) + ")";
|
return "(" + ToString(v.x) + ", " + ToString(v.y) + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
template<IntType T, bool S>
|
template<IntType T, bool S>
|
||||||
std::string ToString(const TIntVector2<T, S>& v)
|
std::string ToString(const TIntVector2<T, S>& v)
|
||||||
{
|
{
|
||||||
return "(" + ToString(v.x) + ", " + ToString(v.y) + ")";
|
return "(" + ToString(v.x) + ", " + ToString(v.y) + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
template<RealType T, bool S>
|
template<RealType T, bool S>
|
||||||
std::string ToString(const TVector3<T, S>& v)
|
std::string ToString(const TVector3<T, S>& v)
|
||||||
{
|
{
|
||||||
return "(" + ToString(v.x) + ", " + ToString(v.y) + ", " + ToString(v.z) + ")";
|
return "(" + ToString(v.x) + ", " + ToString(v.y) + ", " + ToString(v.z) + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
template<IntType T, bool S>
|
template<IntType T, bool S>
|
||||||
std::string ToString(const TIntVector3<T, S>& v)
|
std::string ToString(const TIntVector3<T, S>& v)
|
||||||
{
|
{
|
||||||
return "(" + ToString(v.x) + ", " + ToString(v.y) + ", " + ToString(v.z) + ")";
|
return "(" + ToString(v.x) + ", " + ToString(v.y) + ", " + ToString(v.z) + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
template<RealType T, bool S>
|
template<RealType T, bool S>
|
||||||
std::string ToString(const TVector4<T, S>& v)
|
std::string ToString(const TVector4<T, S>& v)
|
||||||
{
|
{
|
||||||
return "(" + ToString(v.x) + ", " + ToString(v.y) + ", " + ToString(v.z) + ", " + ToString(v.w) + ")";
|
return "(" + ToString(v.x) + ", " + ToString(v.y) + ", " + ToString(v.z) + ", " + ToString(v.w) + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
template<IntType T, bool S>
|
template<IntType T, bool S>
|
||||||
std::string ToString(const TIntVector4<T, S>& v)
|
std::string ToString(const TIntVector4<T, S>& v)
|
||||||
{
|
{
|
||||||
return "(" + ToString(v.x) + ", " + ToString(v.y) + ", " + ToString(v.z) + ", " + ToString(v.w) + ")";
|
return "(" + ToString(v.x) + ", " + ToString(v.y) + ", " + ToString(v.z) + ", " + ToString(v.w) + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
//std::string toString(const Vector4& v);
|
template<RealType T>
|
||||||
|
std::string ToString(const TMatrix2<T>& m)
|
||||||
|
{
|
||||||
|
return "([" + ToString(m(0, 0)) + ", " + ToString(m(0, 1)) + "], [" + ToString(m(1, 0)) + ", " + ToString(m(1, 1)) + "])";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//std::string toString(const Matrix3& v);
|
//std::string toString(const Matrix3& v);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user