DescentDevelopers / DescentDevelopers/Descent3
[Feature Request]: vecmat osiris fusion into one modernized linalg math library adding aligned matrix type
- Dominant language
- C++
- Stars
- 3k
- Forks
- 285
- PR merge metrics
- No merged PRs in 30d
Description
- integrate existing math library code into one single header file
- add aligned ROWxCOL mat type based on std::array of aligned vec
- use `rvec`,`uvec`,`fvec`,`pos` component accessor functions using `()` instead of vec type
- add C++26 mdspan/submdspan minor/laplace splice or C++17 kokkos
- use vector4/vector/scalar for polyeffect
- switch to `vec`, `vec` based colour types
- add 16-bit bitfield colour types for RGB565, RGBA4444 and RGBA5551 with convert to standard vector colour types
```cpp
template)>
struct alignas((((ROW * COL == ROW_POW2 * COL_POW2) && A != align::scalar) || (A == align::matrix)) ? ROW_POW2 * V_A : V_A) mat : std::array, ROW>
{
constexpr static const size_t RIGHT_HAND = 0;
constexpr static const size_t UP = 1;
constexpr static const size_t FORWARD = 2;
constexpr static const size_t POSITION = 3;
vec& rvec() { return (*this)[0]; }
vec& uvec() { static_assert(ROW >= 2); return (*this)[1]; }
vec& fvec() { static_assert(ROW >= 3); return (*this)[2]; }
vec& pos() { static_assert(ROW >= 4); return (*this)[3]; }
constexpr inline mat minor(size_t i, size_t p = 0) const
{
static_assert(ROW == COL);
mat dst{};
for(size_t j = 0; j < ROW; j++)
{
if(j == i) continue;
dst[p++] = (*this)[j].splice(j);
}
return dst;
}
constexpr inline T det() const
{
return (vec::id_alt_sign() * (*this)[0] * laplace()).sum();
}
constexpr inline vec laplace() const
{
vec dst;
for(size_t i = 0; i < COL; i++)
dst[i] = (*this)[i]->minor(i).det();
return dst;
}
};
using matrix2 = mat;
using matrix3 = mat;
using mat_aligned_matrix3 = mat /* stores 3x3 aligned to 4x4 */
using vec_aligned_matrix3 = mat /* stores 3x3 aligned to 3x4 */
using matrix4 = mat;
using matrix = matrix3;
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.