Browse Source

Reduce number of div operations when updating the velocities

opt
Björn Steinbrink 8 months ago
parent
commit
09b24760b5
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      src/barnes_hut.rs

+ 1
- 1
src/barnes_hut.rs View File

@ -76,7 +76,7 @@ impl Octree {
let dist = d_squared.sqrt();
let v = G * self.mass[cur_node] * delta / d_squared; // / (d_squared + 0.1).sqrt(); // Uncomment this to enable smoothing for short distances
particle.velocity += v * dis_vec / dist;
particle.velocity += v / dist * dis_vec;
}
else {
//println!("A{}", self.nodes[cur_node].num_particles);


Loading…
Cancel
Save