diff options
author | eug-vs <eugene@eug-vs.xyz> | 2024-12-14 20:15:31 +0100 |
---|---|---|
committer | eug-vs <eugene@eug-vs.xyz> | 2024-12-14 20:15:31 +0100 |
commit | 297efa5127e83bea57132c503680dd348a725db5 (patch) | |
tree | 667ee37e7398cc3321a784550477d1e4174ab36c /src/constraint/slider.rs | |
parent | bd9424635e997ce70504b564a3561506ee6d51df (diff) | |
download | particle-physics-297efa5127e83bea57132c503680dd348a725db5.tar.gz |
feat: add generic Subspace struct with distance calculation
Diffstat (limited to 'src/constraint/slider.rs')
-rw-r--r-- | src/constraint/slider.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/constraint/slider.rs b/src/constraint/slider.rs index ceea4ea..9f7973b 100644 --- a/src/constraint/slider.rs +++ b/src/constraint/slider.rs @@ -3,7 +3,7 @@ use std::usize; use nalgebra::{DVector, RowDVector}; use crate::{ - algebra::line::Line, + algebra::subspace::Line, particle_system::{Scalar, N}, ParticleSystem, Point, Vector, }; @@ -23,7 +23,7 @@ impl ParticleSystem { let point = self.particles[particle_id].position; self.constraints.push(Box::new(SliderConstraint { particle_id, - line: Line::new(point, direction), + line: Line::new(point, [direction]), jacobian: RowDVector::zeros(self.particles.len() * N), })); } @@ -37,7 +37,7 @@ impl Constraint for SliderConstraint { fn c(&self, q: &DVector<Scalar>) -> Scalar { let position = q.fixed_rows::<N>(self.particle_id * N); let point = Point::from_coordinates(position.into()); - self.line.distance_to_point(point) + self.line.distance(point) } fn set_jacobian(&mut self, jacobian: RowDVector<Scalar>) { |