From 5610db2054755d6f8f4fb726c477cdcd791b8be1 Mon Sep 17 00:00:00 2001 From: Orestis <orestis.malaspinas@pm.me> Date: Wed, 6 Apr 2022 00:37:56 +0200 Subject: [PATCH] updated last slide --- slides/cours_21.md | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/slides/cours_21.md b/slides/cours_21.md index 94f4d3e..dbf1deb 100644 --- a/slides/cours_21.md +++ b/slides/cours_21.md @@ -813,26 +813,14 @@ Pour calculer la force sur un corps `c`, on parcourt l'arbre en commençant par ```C rien maj_force_sur_etoile(arbre, e, theta) - si est_vide(arbre) ou !existe(e) + si est_vide(arbre) retourne - if (!n || !p) { - return; - } - // if the node is a leaf and contains a particle which and the particle is not - // in the bounding box of the node (this means that we are at a particle on - // a different leaf). - if (node_is_leaf(n) && !node_is_empty(n) && !is_inside(n->b, p->pos)) { - update_acceleration(p, n->p); - } - // else if the node is far enough of the particle - else if (node_is_far_enough(n, p, theta)) { - update_acceleration(p, n->super_p); - } - else { // else just update the acceleration recurively - for (int i = 0; i < 4; ++i) { - update_acceleration_from_node_on_particle(n->children[i], p, theta); - } - } -} + si est_feuille(arbre) && contient_etoile(n) && dans_le_quadrant(arbre.q, e.x) + maj_force(e, arbre.e) + sinon si noed_assez_loin(arbre, e, theta) + maj_force(e, arbre.sup_etoile) + sinon + pour enfant dans enfants + maj_force_sur_etoile(enfant, e, theta) ``` -- GitLab