Skip to content

Commit

Permalink
Adjust flush refresh rate
Browse files Browse the repository at this point in the history
  • Loading branch information
leonmavr committed Sep 16, 2024
1 parent 3060373 commit 15e370b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ int main() {
particles[ip].vely = CLAMP(particles[ip].vely, 40);
particles[ip].point.x += particles[ip].velx * dt;
particles[ip].point.y += particles[ip].vely * dt;
// reflection
// reflection left and right, wrapping up and down
particles[ip].point.x %= boundary.x1;
particles[ip].point.y %= boundary.y1;
if (particles[ip].point.x <= boundary.x0)
Expand All @@ -64,9 +64,9 @@ int main() {
}
qtree_graph(qtree.root);
viz_flush();
usleep(33000);
qtree_delete(qtree.root);
}
free(qtree.root);
sleep(1);
viz_close();
}
4 changes: 2 additions & 2 deletions src/quad.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ int point_get_quadrant(rect_t* rect, point_t* point) {
else if ((rect->x0 + w/2 <= x) && (x < rect->x1) && (rect->y0 <= y) && (y < rect->y0 + h/2))
return IND_NE;
else if ((rect->x0 + w/2 <= x) && (x < rect->x1) && (rect->y0 + h/2 <= y) && (y < rect->y1))
return IND_SE;
else if ((rect->x0 <= x) && (x < rect->x0 + w/2) && (rect->y0 + h/2 <= y) && (y < rect->y1))
return IND_SE;
else if ((rect->x0 <= x) && (x < rect->x0 + w/2) && (rect->y0 + h/2 <= y) && (y < rect->y1))
return IND_SW;
return -1; // error - not in rectangle
}
Expand Down
2 changes: 1 addition & 1 deletion src/viz.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void viz_flush() {
fprintf(viz_plot_pipe, "replot\n");
irect = ipoint = 0;
fflush(viz_plot_pipe);
usleep(16000);
usleep(25000);
}


Expand Down

0 comments on commit 15e370b

Please sign in to comment.