reconstruct_mutable = {
if (viz_inputs.options.includes("reconstruct")) {
if (viz_inputs.options.includes("random order")) {
if (iteration_counter % (25 * 25) == 0) {
mutable shuffled_order = d3.shuffle(shuffled_order);
}
let index = shuffled_order[iteration_counter % 625];
let probe_x = (index % 25) * 4;
let probe_y = ((index / 25) | 0 % 25) * 4;
mutable reconstruct_xy = [probe_x, probe_y];
} else {
let index = unshuffled_order[iteration_counter % 625];
let probe_x = (index % 25) * 4;
let probe_y = ((index / 25) | 0 % 25) * 4;
mutable reconstruct_xy = [probe_x, probe_y];
}
if (viz_inputs.visualization_checkboxes.includes("probe")) {
mutable probe_xy = reconstruct_xy;
}
let gr_step = gradient_descent(potential, reconstruct_xy, 1.0);
if (viz_inputs.options.includes("object positivity")) {
mutable potential = positivity_constraint(gr_step);
} else {
mutable potential = gr_step;
}
mutable iteration_counter += 1;
} else if (!probe_moving) {
mutable potential_static = potential.clone();
}
}