Commit cf885463 authored by nicolas.albanesi's avatar nicolas.albanesi
Browse files

Added some randomisation

parent 3f1285ba
......@@ -15,12 +15,7 @@
#include "../includes/gfx.h"
#include "../includes/elec_charge.h"
#define X_CHARGE_1 0.3
#define Y_CHARGE_1 0.5
#define X_CHARGE_2 0.7
#define Y_CHARGE_2 0.5
#define NB_OF_LINES 100
#define NB_OF_LINES 1000
#define NB_OF_CHARGES 3
#define MIN(a,b) (((a)<(b))?(a):(b))
......@@ -60,12 +55,13 @@ int main()
// ! INIT CHARGES
charge_t *charges = malloc(NB_OF_CHARGES * sizeof(*charges));
charges[0].pos = (vec2){X_CHARGE_1, Y_CHARGE_1};
charges[0].q = 1.6E-19;
charges[1].pos = (vec2){X_CHARGE_2, Y_CHARGE_2};
charges[1].q = 1.6E-19;
charges[2].pos = (vec2){X_CHARGE_2, Y_CHARGE_2};
charges[2].q = 1.6E-19;
for (int i = 0; i < NB_OF_CHARGES; i++)
{
charges[i].pos = (vec2){(double)rand() / (double)RAND_MAX, (double)rand() / (double)RAND_MAX};
charges[i].q = 1.6E-19;
}
// ! INIT LISTE DE POINTS
......@@ -73,7 +69,7 @@ int main()
vec2 *lines = malloc(NB_OF_LINES * sizeof(*lines));
for (int i = 0; i < NB_OF_LINES; i++)
{
vec2 p = {.x = (double)(rand() % 10)/10.0+0.01 , .y = (double)(rand() % 10)/10.0+0.01};
vec2 p = {.x = (double)rand() / (double)RAND_MAX , .y = (double)rand() / (double)RAND_MAX};
lines[i] = p;
}
......@@ -268,6 +264,8 @@ void draw_lines(SDL_Renderer* renderer, charge_t* charges, vec2* lines, int nb_o
int side = 0;
vec2 og_p = p;
while (rendering)
{
vec2 e = {.x = 0, .y = 0};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment