diff options
author | eug-vs <eugene@eug-vs.xyz> | 2024-12-15 13:17:43 +0100 |
---|---|---|
committer | eug-vs <eugene@eug-vs.xyz> | 2024-12-15 13:17:43 +0100 |
commit | 70afc5a7d871919776a64782e8b93404e6b0defd (patch) | |
tree | c3d8a273bddf4cbc3c55d06c751766b93b961a1f /src/particle_system.rs | |
parent | 297efa5127e83bea57132c503680dd348a725db5 (diff) | |
download | particle-physics-70afc5a7d871919776a64782e8b93404e6b0defd.tar.gz |
feat!: add raylib rendering
Diffstat (limited to 'src/particle_system.rs')
-rw-r--r-- | src/particle_system.rs | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/src/particle_system.rs b/src/particle_system.rs deleted file mode 100644 index a3d7a4b..0000000 --- a/src/particle_system.rs +++ /dev/null @@ -1,47 +0,0 @@ -use nalgebra::{Point as PointBase, SVector}; - -use crate::{constraint::Constraint, force::Force}; - -pub const N: usize = 2; -pub type Scalar = f64; - -pub type Vector = SVector<Scalar, N>; -pub type Point = PointBase<Scalar, N>; - -#[derive(Debug)] -pub struct Particle { - pub mass: Scalar, - pub position: Point, - pub velocity: Vector, - - /// Force accumulator - pub force: Vector, -} - -impl Particle { - pub fn new(position: Point, mass: Scalar) -> Self { - Self { - mass, - position, - velocity: Vector::zeros(), - force: Vector::zeros(), - } - } - - pub fn apply_force(&mut self, force: Vector) { - self.force += force; - } - pub fn reset_force(&mut self) { - self.force = Vector::zeros() - } -} - -// #[derive(Debug)] -pub struct ParticleSystem { - pub particles: Vec<Particle>, - pub constraints: Vec<Box<dyn Constraint>>, - pub forces: Vec<Box<dyn Force>>, - - /// Simulation clock - pub t: Scalar, -} |