1
0
Files
BasaltMeter/BasaltPresenter/Shared/basalt/math.hpp
2026-01-08 19:23:19 +08:00

42 lines
1012 B
C++

#pragma once
#include <stdexcept>
#include <array> // Include array for std::array::at
namespace Basalt::Shared::Math {
using FloatPoint = float;
struct Vector3 {
FloatPoint x, y, z;
FloatPoint& operator[](size_t index);
const FloatPoint& operator[](size_t index) const;
};
struct Vector4 {
FloatPoint x, y, z, w;
FloatPoint& operator[](size_t index);
const FloatPoint& operator[](size_t index) const;
};
struct Matrix4x4 {
private:
std::array<Vector4, 4> data; // Use std::array instead of raw array for .at() method
public:
Vector4& operator[](size_t index);
const Vector4& operator[](size_t index) const;
};
#define NOT_IMPLEMENTED throw std::logic_error("not implemented function");
template<typename TNum, typename TVec>
struct Vector3Traits {};
template<typename TNum, typename TMat>
struct Matrix4x4Traits {};
#undef NOT_IMPLEMENTED
} // namespace Basalt::Shared::Math