Skip to content
Snippets Groups Projects
Commit 80cde58b authored by gawen.ackerman's avatar gawen.ackerman :robot:
Browse files

draw_field_line done

parent 825378f2
Branches
No related tags found
No related merge requests found
......@@ -22,7 +22,7 @@ int main(int argc, char *argv[]) {
double x1 = 1;
double y1 = 1;
int num_charges = 2;
int num_charges = 2, num_points = 100;
charge_t *charges = (charge_t *)malloc(sizeof(charge_t) * num_charges);
charges[0] = charge_create(-ELEMENTARY_CHARGE, vector2_create(.25, .5));
charges[1] = charge_create(ELEMENTARY_CHARGE, vector2_create(.75, .5));
......@@ -31,7 +31,10 @@ int main(int argc, char *argv[]) {
gfx_clear(canvas, COLOR_BLACK);
draw_charges(canvas, charges, num_charges, x0, x1, y0, y1);
draw_field_lines(canvas, charges, num_charges, dx, vector2_create(.5, .25), x0, x1, y0, y1);
for (int i = 0; i < num_points; i += 1) {
draw_field_lines(canvas, charges, num_charges, dx, vector2_create(rand_one(), rand_one()), x0, x1, y0, y1);
}
gfx_present(canvas);
while (true) {
......
......@@ -5,8 +5,8 @@
#include "vector2.h"
const int SCREEN_WIDTH = 500;
const int SCREEN_HEIGHT = 500;
const int SCREEN_WIDTH = 750;
const int SCREEN_HEIGHT = 750;
coordinates_t coordinates_create(int row_, int column_) {
coordinates_t c = {.row = row_, .column = column_};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment