From 70afc5a7d871919776a64782e8b93404e6b0defd Mon Sep 17 00:00:00 2001 From: eug-vs Date: Sun, 15 Dec 2024 13:17:43 +0100 Subject: feat!: add raylib rendering --- src/constraint/anchor.rs | 42 ------------------------------------------ 1 file changed, 42 deletions(-) delete mode 100644 src/constraint/anchor.rs (limited to 'src/constraint/anchor.rs') diff --git a/src/constraint/anchor.rs b/src/constraint/anchor.rs deleted file mode 100644 index 3ef94ff..0000000 --- a/src/constraint/anchor.rs +++ /dev/null @@ -1,42 +0,0 @@ -use nalgebra::{DVector, RowDVector}; - -use crate::particle_system::{ParticleSystem, Point, Scalar, N}; - -use super::Constraint; - -pub struct AnchorConstraint { - pub particle_id: usize, - pub anchor: Point, - - jacobian: RowDVector, -} - -impl ParticleSystem { - pub fn add_anchor_constraint(&mut self, particle_id: usize) { - let anchor = self.particles[particle_id].position; - self.constraints.push(Box::new(AnchorConstraint { - particle_id, - anchor, - jacobian: RowDVector::zeros(self.particles.len() * N), - })); - } -} - -impl Constraint for AnchorConstraint { - fn get_particles(&self) -> Vec { - vec![self.particle_id] - } - - fn c(&self, q: &DVector) -> Scalar { - let position = q.fixed_rows(self.particle_id * N); - (position - self.anchor.coords).norm() - } - - fn set_jacobian(&mut self, jacobian: RowDVector) { - self.jacobian = jacobian - } - - fn jacobian_prev(&self) -> RowDVector { - self.jacobian.clone() - } -} -- cgit v1.2.3