-
Notifications
You must be signed in to change notification settings - Fork 0
/
ParticleLife.h
46 lines (37 loc) · 846 Bytes
/
ParticleLife.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//
// Created by Jason on 3/18/24.
//
#ifndef EXAMPLE_PARTICLELIFE_H
#define EXAMPLE_PARTICLELIFE_H
#include "raylib.h"
#include <math.h>
#include <time.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <pthread.h>
#define n 7000
typedef struct {
Vector2 position;
Vector2 velocity;
int color;
int partition;
int id;
} Particle;
typedef struct {
Particle particles[n];
int numParticles;
} Partition;
void updateParticles();
double force(double, double);
int getPartition(Vector2);
void generatePartitionHash();
int modulo(int, int);
void removeFromPartition(Particle*);
void addToPartition(Particle*);
void getSubPartitions(int *, Particle*);
void clearPartitions();
void updateForce(Particle *);
void updatePosition(Particle *);
void updateParameters();
#endif //EXAMPLE_PARTICLELIFE_H