WIP: Switch to Euclidean-invariant projection onto tangent space of solution variety #34
@ -1,4 +1,4 @@
|
|||||||
use nalgebra::DMatrix;
|
use nalgebra::{DMatrix, DVector};
|
||||||
use std::{array, f64::consts::PI};
|
use std::{array, f64::consts::PI};
|
||||||
|
|
||||||
use dyna3::engine::{Q, point, realize_gram, PartialMatrix};
|
use dyna3::engine::{Q, point, realize_gram, PartialMatrix};
|
||||||
@ -59,22 +59,13 @@ fn main() {
|
|||||||
println!("Loss: {}\n", history.scaled_loss.last().unwrap());
|
println!("Loss: {}\n", history.scaled_loss.last().unwrap());
|
||||||
|
|
||||||
// find the kaleidocycle's twist motion
|
// 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(
|
let twist_motion: DMatrix<_> = (0..N_POINTS).step_by(4).flat_map(
|
||||||
|n| {
|
|n| [
|
||||||
let up_field = {
|
tangent.proj(&up.as_view(), n),
|
||||||
DMatrix::from_column_slice(5, 5, &[
|
tangent.proj(&down.as_view(), n+1)
|
||||||
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)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
).sum();
|
).sum();
|
||||||
let normalization = 5.0 / twist_motion[(2, 0)];
|
let normalization = 5.0 / twist_motion[(2, 0)];
|
||||||
print!("Twist motion:{}", normalization * twist_motion);
|
print!("Twist motion:{}", normalization * twist_motion);
|
||||||
|
Loading…
Reference in New Issue
Block a user