Add more functions, add example, fix ray collision detection
All checks were successful
CI / build-and-analyze (push) Successful in 41s

This commit is contained in:
2026-07-03 23:28:17 +03:00
parent aef2932ce4
commit b6481a26bc
12 changed files with 500 additions and 14 deletions

10
Vec2i.c
View File

@@ -40,3 +40,13 @@ void CgeVec2iMax(const int a[2], const int b[2], int out[2]) {
if (a[0] > b[0]) out[0] = a[0]; else out[0] = b[0];
if (a[1] > b[1]) out[1] = a[1]; else out[1] = b[1];
}
void CgeVec2iClamp(const int in[2], int minVal, int maxVal, int out[2]) {
out[0] = in[0] < minVal ? minVal : (in[0] > maxVal ? maxVal : in[0]);
out[1] = in[1] < minVal ? minVal : (in[1] > maxVal ? maxVal : in[1]);
}
void CgeVec2iAbs(const int in[2], int out[2]) {
out[0] = in[0] < 0 ? -in[0] : in[0];
out[1] = in[1] < 0 ? -in[1] : in[1];
}