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

12
Vec3i.c
View File

@@ -48,3 +48,15 @@ void CgeVec3iMax(const int a[3], const int b[3], int out[3]) {
if (a[1] > b[1]) out[1] = a[1]; else out[1] = b[1];
if (a[2] > b[2]) out[2] = a[2]; else out[2] = b[2];
}
void CgeVec3iClamp(const int in[3], int minVal, int maxVal, int out[3]) {
out[0] = in[0] < minVal ? minVal : (in[0] > maxVal ? maxVal : in[0]);
out[1] = in[1] < minVal ? minVal : (in[1] > maxVal ? maxVal : in[1]);
out[2] = in[2] < minVal ? minVal : (in[2] > maxVal ? maxVal : in[2]);
}
void CgeVec3iAbs(const int in[3], int out[3]) {
out[0] = in[0] < 0 ? -in[0] : in[0];
out[1] = in[1] < 0 ? -in[1] : in[1];
out[2] = in[2] < 0 ? -in[2] : in[2];
}