summaryrefslogtreecommitdiff
path: root/physics/src/force/drag.rs
blob: c54dc407c76edddac0028f7b840f8c2edf0d0823 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use crate::algebra::Scalar;

use super::Force;

pub struct Drag {
    pub coefficient: Scalar,
}

impl Force for Drag {
    fn apply(&self, particles: &mut Vec<crate::particle_system::Particle>) {
        for particle in particles {
            particle.apply_force(-self.coefficient * particle.velocity);
        }
    }
}