Switch to Euclidean-invariant projection onto tangent space of solution variety #34

Open
Vectornaut wants to merge 4 commits from uniform-projection into main
Showing only changes of commit 01261aed91 - Show all commits

View File

@ -1,4 +1,4 @@
use nalgebra::DMatrix;
use nalgebra::{DMatrix, DVector};
use std::{array, f64::consts::PI};
use dyna3::engine::{Q, point, realize_gram, PartialMatrix};
@ -59,22 +59,13 @@ fn main() {
println!("Loss: {}\n", history.scaled_loss.last().unwrap());
// find the kaleidocycle's twist motion
let up = DVector::from_column_slice(&[0.0, 0.0, 1.0, 0.0, 0.0]);
let down = -&up;
let twist_motion: DMatrix<_> = (0..N_POINTS).step_by(4).flat_map(
|n| {
let up_field = {
DMatrix::from_column_slice(5, 5, &[
0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 1.0,
0.0, 0.0, 2.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0
])
};
[
tangent.proj(&(&up_field * config.column(n)).as_view(), n),
tangent.proj(&(-&up_field * config.column(n+1)).as_view(), n+1)
|n| [
tangent.proj(&up.as_view(), n),
tangent.proj(&down.as_view(), n+1)
]
}
).sum();
let normalization = 5.0 / twist_motion[(2, 0)];
print!("Twist motion:{}", normalization * twist_motion);