Skip to content
Snippets Groups Projects
Commit af2b1331 authored by JM's avatar JM
Browse files

Warnings retirés

parent 39826c63
No related branches found
No related tags found
No related merge requests found
......@@ -4,9 +4,9 @@
#include "field.h"
void gfx_draw_line(struct gfx_context_t *ctxt, coordinates_t p0, coordinates_t p1, uint32_t color) {
int dx = abs(p1.column - p0.column);
int dx = abs((int)p1.column - (int)p0.column);
int sx = p0.column < p1.column ? 1 : -1;
int dy = -abs(p1.row - p0.row);
int dy = -abs((int)p1.row - (int)p0.row);
int sy = p0.row < p1.row ? 1 : -1;
int error = dx + dy;
......@@ -50,7 +50,7 @@ void gfx_draw_circle(struct gfx_context_t *ctxt, coordinates c, uint32_t r, uint
if(d >= 2*x){
d = d-2*x-1;
x++;
}else if(d < 2 * (r-y)){
}else if(d < 2 * ((int)r-y)){
d = d + 2*y-1;
y--;
}else {
......
#include <stdbool.h>
#include <stdlib.h>
#include <time.h>
#include "draw.h"
#include "field.h"
......@@ -41,10 +42,10 @@ double compute_delta_x(){
}
bool is_in_screen(coordinates_t pos){
if(pos.column > WID || pos.column < 0)
if(pos.column > WID)
return false;
if(pos.row > HEI || pos.row < 0)
if(pos.row > HEI)
return false;
return true;
......
......@@ -18,17 +18,6 @@ bool compute_e(charge_t c, vec2 p, double eps, vec2 *e);
// Return false if for some qiP, norm(qiP) < eps
bool compute_total_normalized_e(charge_t *charges, int num_charges, vec2 p, double eps, vec2 *e);
// Compute and then draw all the points belonging to a field line,
// starting from pos0.
// Returns false if pos0 is not a valid position
// (for example if pos0 is too close to a charge).
static bool draw_field_line(struct gfx_context_t *ctxt, charge_t *charges, int num_charges, double dx, vec2 pos0, double x0, double x1, double y0, double y1);
// Draw all the charges
// A circle with minus sign for negative charges
// A circle with a plus sign for positive charges
static void draw_charges(struct gfx_context_t *context, charge_t *charges, int num_charges, double x0, double x1, double y0, double y1);
void draw_everything(
struct gfx_context_t *ctxt,
charge_t *charges,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment