Improve the naming of the normalization methods
All checks were successful
/ test (pull_request) Successful in 2m26s
All checks were successful
/ test (pull_request) Successful in 2m26s
This commit is contained in:
parent
8732cb77c2
commit
54b34e0582
2 changed files with 14 additions and 13 deletions
|
@ -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,
|
||||
|
@ -107,8 +107,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
|
||||
|
@ -218,8 +219,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> {
|
||||
|
@ -308,8 +309,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> {
|
||||
|
@ -776,7 +777,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())
|
||||
|
|
|
@ -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]);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue