Browse Source

Replace div with mul

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

+ 2
- 2
src/barnes_hut.rs View File

@ -74,8 +74,8 @@ impl Octree {
if d_squared < 0.1 { return; } // Worse, but higher-performance, method of smoothing
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 / dist * dis_vec;
let v = G * self.mass[cur_node] * delta / (dist * d_squared); // / (d_squared + 0.1).sqrt(); // Uncomment this to enable smoothing for short distances
particle.velocity += v * dis_vec;
}
else {
//println!("A{}", self.nodes[cur_node].num_particles);


Loading…
Cancel
Save