utilitiec/tests/QuadTree.test.c

26 lines
747 B
C
Raw Normal View History

2025-02-28 17:50:36 +01:00
#include "../src/rand/xoshiro256.h"
#include <stdio.h>
#include "../src/QuadTree/QuadTree.h"
static QuadTree tree;
typedef struct Particle_s {
QuadTreeLeaf position;
} Particle;
static Particle particles[100];
int main()
{
QuadTree_Create(&tree, 10000, 10000, NULL);
Xoshiro256State rand_state = { 0, 10, 0, 0 };
for (size_t i = 0; i < sizeof(particles) / sizeof(particles[0]); i++) {
particles[i].position.x = xoshiro256_next(&rand_state) % 10000;
particles[i].position.y = xoshiro256_next(&rand_state) % 10000;
2025-02-28 23:13:30 +01:00
// printf("%f %f\n", particles[i].position.y, particles[i].position.x);
2025-02-28 17:50:36 +01:00
QuadTree_Insert(&tree, &particles[i].position);
}
}