forked from StudioInfinity/dyna3
Primarily, switch to using trailing commas. Also uniformizes commas with respect to switch branches, makes function call layout more consistent, line breaking more consistent, alphabetizes imports, uses the field init shorthand when possible, etc. Resolves #99. Co-authored-by: Aaron Fenyes <aaron.fenyes@fareycircles.ooo> Reviewed-on: StudioInfinity/dyna3#108 Co-authored-by: Vectornaut <vectornaut@nobody@nowhere.net> Co-committed-by: Vectornaut <vectornaut@nobody@nowhere.net>
34 lines
No EOL
870 B
Rust
34 lines
No EOL
870 B
Rust
#[path = "common/print.rs"]
|
|
mod print;
|
|
|
|
use dyna3::engine::{
|
|
realize_gram,
|
|
sphere,
|
|
ConfigNeighborhood,
|
|
ConstraintProblem,
|
|
};
|
|
|
|
fn main() {
|
|
let mut problem = ConstraintProblem::from_guess({
|
|
let a: f64 = 0.75_f64.sqrt();
|
|
&[
|
|
sphere(1.0, 0.0, 0.0, 1.0),
|
|
sphere(-0.5, a, 0.0, 1.0),
|
|
sphere(-0.5, -a, 0.0, 1.0),
|
|
]
|
|
});
|
|
for j in 0..3 {
|
|
for k in j..3 {
|
|
problem.gram.push_sym(j, k, if j == k { 1.0 } else { -1.0 });
|
|
}
|
|
}
|
|
let realization = realize_gram(
|
|
&problem, 1.0e-12, 0.5, 0.9, 1.1, 200, 110
|
|
);
|
|
print::title("Three spheres");
|
|
print::realization_diagnostics(&realization);
|
|
if let Ok(ConfigNeighborhood { config, .. }) = realization.result {
|
|
print::gram_matrix(&config);
|
|
}
|
|
print::loss_history(&realization.history);
|
|
} |