Created and tested vec3.

This commit is contained in:
2025-06-12 12:19:36 +01:00
parent 5dfe527b27
commit b2c8aaaf09
6 changed files with 122 additions and 2 deletions
+23 -1
View File
@@ -1,7 +1,29 @@
#include <iostream>
// Include the vector utilities header file
#include "vector/utils_vec.hpp"
int main()
{
std::cout << "Hello, World!" << std::endl;
vec3 *v1 = (vec3 *)malloc(sizeof(vec3) * 2);
if (v1 == nullptr)
{
fprintf(stderr, "Error: Memory allocation failed for vec3 array.\n");
return 1; // Exit with error code
}
for (int i = 0; i < 2; i++)
{
v1[i].setX(i + 1.0f);
v1[i].setY(i + 2.0f);
v1[i].setZ(i + 3.0f);
}
vec3 v2 = v1[0] + v1[1];
std::cout << "v2: (" << v2.getX() << ", " << v2.getY() << ", " << v2.getZ() << ")" << std::endl;
free(v1); // Free the allocated memory
return 0;
}