Improve the naming of the normalization methods

This commit is contained in:
Aaron Fenyes 2025-06-01 10:49:50 -07:00
parent e19792d961
commit f332f755e0
2 changed files with 14 additions and 13 deletions

View file

@ -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<BTreeSet<Rc<dyn Regulator>>>;
// normalize a representation vector for this kind of element
fn normalize_mut_rep(&self, rep: &mut DVector<f64>);
// project a representation vector for this kind of element onto its
// normalization variety
fn project_to_normalized(&self, rep: &mut DVector<f64>);
// 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<f64>) {
normalize_mut_sphere(rep);
fn project_to_normalized(&self, rep: &mut DVector<f64>) {
project_sphere_to_normalized(rep);
}
fn column_index(&self) -> Option<usize> {
@ -321,8 +322,8 @@ impl Element for Point {
self.regulators
}
fn normalize_mut_rep(&self, rep: &mut DVector<f64>) {
normalize_mut_point(rep);
fn project_to_normalized(&self, rep: &mut DVector<f64>) {
project_point_to_normalized(rep);
}
fn column_index(&self) -> Option<usize> {
@ -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())

View file

@ -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<f64>) {
// 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<f64>) {
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<f64>) {
}
// normalize a point's representation vector by scaling
pub fn normalize_mut_point(rep: &mut DVector<f64>) {
pub fn project_point_to_normalized(rep: &mut DVector<f64>) {
rep.scale_mut(0.5 / rep[3]);
}