From 297efa5127e83bea57132c503680dd348a725db5 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Sat, 14 Dec 2024 20:15:31 +0100 Subject: feat: add generic Subspace struct with distance calculation --- src/constraint/slider.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/constraint') 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 { let position = q.fixed_rows::(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) { -- cgit v1.2.3