Write kaleidocycle nudge in uniform coordinates
In the previous commit, the nudge was written in standard coordinates, so the example shouldn't have worked. However, by sheer dumb luck, the standard and uniform coordinates match for this particular nudge. In fact, the expression used before to get the standard coordinates may even produce equivalent floating point values as the expression used here to get the uniform coordinates. That would explain why the example prints exactly the same output in this commit.
This commit is contained in:
parent
a05a2e1d54
commit
01261aed91
@ -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