From f332f755e0966ef8e643e82d13860d3cc18fac86 Mon Sep 17 00:00:00 2001 From: Aaron Fenyes Date: Sun, 1 Jun 2025 10:49:50 -0700 Subject: [PATCH] Improve the naming of the normalization methods --- app-proto/src/assembly.rs | 19 ++++++++++--------- app-proto/src/engine.rs | 8 ++++---- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/app-proto/src/assembly.rs b/app-proto/src/assembly.rs index 2a23b4a..6c91fc0 100644 --- a/app-proto/src/assembly.rs +++ b/app-proto/src/assembly.rs @@ -18,9 +18,9 @@ use crate::{ Q, change_half_curvature, local_unif_to_std, - normalize_mut_point, - normalize_mut_sphere, point, + project_point_to_normalized, + project_sphere_to_normalized, realize_gram, sphere, ConfigSubspace, @@ -108,8 +108,9 @@ pub trait Element: Serial + ProblemPoser + DisplayItem { // element is responsible for keeping this set up to date fn regulators(&self) -> Signal>>; - // normalize a representation vector for this kind of element - fn normalize_mut_rep(&self, rep: &mut DVector); + // project a representation vector for this kind of element onto its + // normalization variety + fn project_to_normalized(&self, rep: &mut DVector); // the configuration matrix column index that was assigned to the element // last time the assembly was realized, or `None` if the element has never @@ -225,8 +226,8 @@ impl Element for Sphere { self.regulators } - fn normalize_mut_rep(&self, rep: &mut DVector) { - normalize_mut_sphere(rep); + fn project_to_normalized(&self, rep: &mut DVector) { + project_sphere_to_normalized(rep); } fn column_index(&self) -> Option { @@ -321,8 +322,8 @@ impl Element for Point { self.regulators } - fn normalize_mut_rep(&self, rep: &mut DVector) { - normalize_mut_point(rep); + fn project_to_normalized(&self, rep: &mut DVector) { + project_point_to_normalized(rep); } fn column_index(&self) -> Option { @@ -789,7 +790,7 @@ impl Assembly { // step the element along the deformation and then // restore its normalization *rep += motion_proj.column(column_index); - elt.normalize_mut_rep(rep); + elt.project_to_normalized(rep); }, None => { console_log!("No velocity to unpack for fresh element \"{}\"", elt.id()) diff --git a/app-proto/src/engine.rs b/app-proto/src/engine.rs index 03d13a9..c5d7b00 100644 --- a/app-proto/src/engine.rs +++ b/app-proto/src/engine.rs @@ -35,9 +35,9 @@ pub fn sphere_with_offset(dir_x: f64, dir_y: f64, dir_z: f64, off: f64, curv: f6 ]) } -// normalize a sphere's representation vector by contracting toward the last -// coordinate axis -pub fn normalize_mut_sphere(rep: &mut DVector) { +// project a sphere's representation vector to the normalization variety by +// contracting toward the last coordinate axis +pub fn project_sphere_to_normalized(rep: &mut DVector) { let q_sp = rep.fixed_rows::<3>(0).norm_squared(); let half_q_lt = -2.0 * rep[3] * rep[4]; let half_q_lt_sq = half_q_lt * half_q_lt; @@ -46,7 +46,7 @@ pub fn normalize_mut_sphere(rep: &mut DVector) { } // normalize a point's representation vector by scaling -pub fn normalize_mut_point(rep: &mut DVector) { +pub fn project_point_to_normalized(rep: &mut DVector) { rep.scale_mut(0.5 / rep[3]); }