write shit
This commit is contained in:
@@ -1,7 +1,37 @@
|
||||
#include "math.hpp"
|
||||
#include <stdexcept> // Include for std::out_of_range
|
||||
|
||||
namespace Basalt::Shared::Math {
|
||||
namespace basalt::shared::math {
|
||||
|
||||
#pragma region Triangle
|
||||
|
||||
Index& Triangle::operator[](size_t index) {
|
||||
switch (index) {
|
||||
case 0:
|
||||
return i;
|
||||
case 1:
|
||||
return j;
|
||||
case 2:
|
||||
return k;
|
||||
default:
|
||||
throw std::out_of_range("Triangle index out of range");
|
||||
}
|
||||
}
|
||||
|
||||
const Index& Triangle::operator[](size_t index) const {
|
||||
switch (index) {
|
||||
case 0:
|
||||
return i;
|
||||
case 1:
|
||||
return j;
|
||||
case 2:
|
||||
return k;
|
||||
default:
|
||||
throw std::out_of_range("Triangle index out of range");
|
||||
}
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
||||
#pragma region Vector3
|
||||
|
||||
@@ -33,9 +63,9 @@ namespace Basalt::Shared::Math {
|
||||
|
||||
#pragma endregion
|
||||
|
||||
#pragma region Vector4
|
||||
#pragma region Quaternion
|
||||
|
||||
FloatPoint& Vector4::operator[](size_t index) {
|
||||
FloatPoint& Quaternion::operator[](size_t index) {
|
||||
switch (index) {
|
||||
case 0:
|
||||
return x;
|
||||
@@ -46,11 +76,11 @@ namespace Basalt::Shared::Math {
|
||||
case 3:
|
||||
return w;
|
||||
default:
|
||||
throw std::out_of_range("Vector4 index out of range");
|
||||
throw std::out_of_range("Quaternion index out of range");
|
||||
}
|
||||
}
|
||||
|
||||
const FloatPoint& Vector4::operator[](size_t index) const {
|
||||
const FloatPoint& Quaternion::operator[](size_t index) const {
|
||||
switch (index) {
|
||||
case 0:
|
||||
return x;
|
||||
@@ -61,22 +91,56 @@ namespace Basalt::Shared::Math {
|
||||
case 3:
|
||||
return w;
|
||||
default:
|
||||
throw std::out_of_range("Vector4 index out of range");
|
||||
throw std::out_of_range("Quaternion index out of range");
|
||||
}
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
//
|
||||
//#pragma region Vector4
|
||||
//
|
||||
// FloatPoint& Vector4::operator[](size_t index) {
|
||||
// switch (index) {
|
||||
// case 0:
|
||||
// return x;
|
||||
// case 1:
|
||||
// return y;
|
||||
// case 2:
|
||||
// return z;
|
||||
// case 3:
|
||||
// return w;
|
||||
// default:
|
||||
// throw std::out_of_range("Vector4 index out of range");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// const FloatPoint& Vector4::operator[](size_t index) const {
|
||||
// switch (index) {
|
||||
// case 0:
|
||||
// return x;
|
||||
// case 1:
|
||||
// return y;
|
||||
// case 2:
|
||||
// return z;
|
||||
// case 3:
|
||||
// return w;
|
||||
// default:
|
||||
// throw std::out_of_range("Vector4 index out of range");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//#pragma endregion
|
||||
//
|
||||
//#pragma region Matrix4x4
|
||||
//
|
||||
// Vector4& Matrix4x4::operator[](size_t index) {
|
||||
// return data.at(index);
|
||||
// }
|
||||
//
|
||||
// const Vector4& Matrix4x4::operator[](size_t index) const {
|
||||
// return data.at(index);
|
||||
// }
|
||||
//
|
||||
//#pragma endregion
|
||||
|
||||
#pragma region Matrix4x4
|
||||
|
||||
Vector4& Matrix4x4::operator[](size_t index) {
|
||||
return data.at(index);
|
||||
}
|
||||
|
||||
const Vector4& Matrix4x4::operator[](size_t index) const {
|
||||
return data.at(index);
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
||||
} // namespace Basalt::Shared::Math
|
||||
} // namespace basalt::shared::math
|
||||
Reference in New Issue
Block a user