WIP: Manipulate the assembly #29

Draft
Vectornaut wants to merge 8 commits from tangent-space into main
Showing only changes of commit 9f85ce5608 - Show all commits

View File

@ -5,7 +5,7 @@ use std::{collections::BTreeSet, sync::atomic::{AtomicU64, Ordering}};
use sycamore::prelude::*; use sycamore::prelude::*;
use web_sys::{console, wasm_bindgen::JsValue}; /* DEBUG */ use web_sys::{console, wasm_bindgen::JsValue}; /* DEBUG */
use crate::engine::{realize_gram, ConfigSubspace, PartialMatrix}; use crate::engine::{realize_gram, ConfigSubspace, PartialMatrix, Q};
// the types of the keys we use to access an assembly's elements and constraints // the types of the keys we use to access an assembly's elements and constraints
pub type ElementKey = usize; pub type ElementKey = usize;
@ -312,12 +312,16 @@ impl Assembly {
motion_proj += self.tangent.with(|tan| tan.proj(&elt_motion, column_index)); motion_proj += self.tangent.with(|tan| tan.proj(&elt_motion, column_index));
} }
// step the configuration linearly along the tangent space of the // step each element along the mass shell geodesic that matches its
// solution variety // velocity in the deformation found above
/* KLUDGE */
// since our test assemblies only involve spheres, we assume that every
// element is on the 1 mass shell
for (_, elt) in self.elements.get_clone_untracked() { for (_, elt) in self.elements.get_clone_untracked() {
elt.representation.update_silent(|rep| { elt.representation.update_silent(|rep| {
let rep_next = &*rep + motion_proj.column(elt.column_index); let rep_next = &*rep + motion_proj.column(elt.column_index);
rep.set_column(0, &rep_next); let normalizer = rep_next.dot(&(&*Q * &rep_next));
rep.set_column(0, &(rep_next / normalizer));
}); });
} }