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/slider.rs | 50 ------------------------------------------------ 1 file changed, 50 deletions(-) delete mode 100644 src/constraint/slider.rs (limited to 'src/constraint/slider.rs') diff --git a/src/constraint/slider.rs b/src/constraint/slider.rs deleted file mode 100644 index 9f7973b..0000000 --- a/src/constraint/slider.rs +++ /dev/null @@ -1,50 +0,0 @@ -use std::usize; - -use nalgebra::{DVector, RowDVector}; - -use crate::{ - algebra::subspace::Line, - particle_system::{Scalar, N}, - ParticleSystem, Point, Vector, -}; - -use super::Constraint; - -pub struct SliderConstraint { - pub particle_id: usize, - - pub line: Line, - - jacobian: RowDVector, -} - -impl ParticleSystem { - pub fn add_slider_constraint(&mut self, particle_id: usize, direction: Vector) { - let point = self.particles[particle_id].position; - self.constraints.push(Box::new(SliderConstraint { - particle_id, - line: Line::new(point, [direction]), - jacobian: RowDVector::zeros(self.particles.len() * N), - })); - } -} - -impl Constraint for SliderConstraint { - fn get_particles(&self) -> Vec { - vec![self.particle_id] - } - - fn c(&self, q: &DVector) -> Scalar { - let position = q.fixed_rows::(self.particle_id * N); - let point = Point::from_coordinates(position.into()); - self.line.distance(point) - } - - fn set_jacobian(&mut self, jacobian: RowDVector) { - self.jacobian = jacobian - } - - fn jacobian_prev(&self) -> RowDVector { - self.jacobian.clone() - } -} -- cgit v1.2.3