forked from StudioInfinity/dyna3
refactor: Code formatting (#108)
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>
This commit is contained in:
parent
2eba80fb69
commit
ef1a579ac0
12 changed files with 310 additions and 297 deletions
|
@ -6,17 +6,17 @@ use web_sys::{console, wasm_bindgen::JsValue};
|
|||
|
||||
use crate::{
|
||||
AppState,
|
||||
engine,
|
||||
engine::DescentHistory,
|
||||
assembly::{
|
||||
Assembly,
|
||||
Element,
|
||||
ElementColor,
|
||||
InversiveDistanceRegulator,
|
||||
Point,
|
||||
Sphere
|
||||
Sphere,
|
||||
},
|
||||
specified::SpecifiedValue
|
||||
engine,
|
||||
engine::DescentHistory,
|
||||
specified::SpecifiedValue,
|
||||
};
|
||||
|
||||
// --- loaders ---
|
||||
|
@ -32,7 +32,7 @@ fn load_gen_assemb(assembly: &Assembly) {
|
|||
String::from("gemini_a"),
|
||||
String::from("Castor"),
|
||||
[1.00_f32, 0.25_f32, 0.00_f32],
|
||||
engine::sphere(0.5, 0.5, 0.0, 1.0)
|
||||
engine::sphere(0.5, 0.5, 0.0, 1.0),
|
||||
)
|
||||
);
|
||||
let _ = assembly.try_insert_element(
|
||||
|
@ -40,7 +40,7 @@ fn load_gen_assemb(assembly: &Assembly) {
|
|||
String::from("gemini_b"),
|
||||
String::from("Pollux"),
|
||||
[0.00_f32, 0.25_f32, 1.00_f32],
|
||||
engine::sphere(-0.5, -0.5, 0.0, 1.0)
|
||||
engine::sphere(-0.5, -0.5, 0.0, 1.0),
|
||||
)
|
||||
);
|
||||
let _ = assembly.try_insert_element(
|
||||
|
@ -48,7 +48,7 @@ fn load_gen_assemb(assembly: &Assembly) {
|
|||
String::from("ursa_major"),
|
||||
String::from("Ursa major"),
|
||||
[0.25_f32, 0.00_f32, 1.00_f32],
|
||||
engine::sphere(-0.5, 0.5, 0.0, 0.75)
|
||||
engine::sphere(-0.5, 0.5, 0.0, 0.75),
|
||||
)
|
||||
);
|
||||
let _ = assembly.try_insert_element(
|
||||
|
@ -56,7 +56,7 @@ fn load_gen_assemb(assembly: &Assembly) {
|
|||
String::from("ursa_minor"),
|
||||
String::from("Ursa minor"),
|
||||
[0.25_f32, 1.00_f32, 0.00_f32],
|
||||
engine::sphere(0.5, -0.5, 0.0, 0.5)
|
||||
engine::sphere(0.5, -0.5, 0.0, 0.5),
|
||||
)
|
||||
);
|
||||
let _ = assembly.try_insert_element(
|
||||
|
@ -64,7 +64,7 @@ fn load_gen_assemb(assembly: &Assembly) {
|
|||
String::from("moon_deimos"),
|
||||
String::from("Deimos"),
|
||||
[0.75_f32, 0.75_f32, 0.00_f32],
|
||||
engine::sphere(0.0, 0.15, 1.0, 0.25)
|
||||
engine::sphere(0.0, 0.15, 1.0, 0.25),
|
||||
)
|
||||
);
|
||||
let _ = assembly.try_insert_element(
|
||||
|
@ -72,7 +72,7 @@ fn load_gen_assemb(assembly: &Assembly) {
|
|||
String::from("moon_phobos"),
|
||||
String::from("Phobos"),
|
||||
[0.00_f32, 0.75_f32, 0.50_f32],
|
||||
engine::sphere(0.0, -0.15, -1.0, 0.25)
|
||||
engine::sphere(0.0, -0.15, -1.0, 0.25),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ fn load_low_curv_assemb(assembly: &Assembly) {
|
|||
"central".to_string(),
|
||||
"Central".to_string(),
|
||||
[0.75_f32, 0.75_f32, 0.75_f32],
|
||||
engine::sphere(0.0, 0.0, 0.0, 1.0)
|
||||
engine::sphere(0.0, 0.0, 0.0, 1.0),
|
||||
)
|
||||
);
|
||||
let _ = assembly.try_insert_element(
|
||||
|
@ -93,7 +93,7 @@ fn load_low_curv_assemb(assembly: &Assembly) {
|
|||
"assemb_plane".to_string(),
|
||||
"Assembly plane".to_string(),
|
||||
[0.75_f32, 0.75_f32, 0.75_f32],
|
||||
engine::sphere_with_offset(0.0, 0.0, 1.0, 0.0, 0.0)
|
||||
engine::sphere_with_offset(0.0, 0.0, 1.0, 0.0, 0.0),
|
||||
)
|
||||
);
|
||||
let _ = assembly.try_insert_element(
|
||||
|
@ -101,7 +101,7 @@ fn load_low_curv_assemb(assembly: &Assembly) {
|
|||
"side1".to_string(),
|
||||
"Side 1".to_string(),
|
||||
[1.00_f32, 0.00_f32, 0.25_f32],
|
||||
engine::sphere_with_offset(1.0, 0.0, 0.0, 1.0, 0.0)
|
||||
engine::sphere_with_offset(1.0, 0.0, 0.0, 1.0, 0.0),
|
||||
)
|
||||
);
|
||||
let _ = assembly.try_insert_element(
|
||||
|
@ -109,7 +109,7 @@ fn load_low_curv_assemb(assembly: &Assembly) {
|
|||
"side2".to_string(),
|
||||
"Side 2".to_string(),
|
||||
[0.25_f32, 1.00_f32, 0.00_f32],
|
||||
engine::sphere_with_offset(-0.5, a, 0.0, 1.0, 0.0)
|
||||
engine::sphere_with_offset(-0.5, a, 0.0, 1.0, 0.0),
|
||||
)
|
||||
);
|
||||
let _ = assembly.try_insert_element(
|
||||
|
@ -117,7 +117,7 @@ fn load_low_curv_assemb(assembly: &Assembly) {
|
|||
"side3".to_string(),
|
||||
"Side 3".to_string(),
|
||||
[0.00_f32, 0.25_f32, 1.00_f32],
|
||||
engine::sphere_with_offset(-0.5, -a, 0.0, 1.0, 0.0)
|
||||
engine::sphere_with_offset(-0.5, -a, 0.0, 1.0, 0.0),
|
||||
)
|
||||
);
|
||||
let _ = assembly.try_insert_element(
|
||||
|
@ -125,7 +125,7 @@ fn load_low_curv_assemb(assembly: &Assembly) {
|
|||
"corner1".to_string(),
|
||||
"Corner 1".to_string(),
|
||||
[0.75_f32, 0.75_f32, 0.75_f32],
|
||||
engine::sphere(-4.0/3.0, 0.0, 0.0, 1.0/3.0)
|
||||
engine::sphere(-4.0/3.0, 0.0, 0.0, 1.0/3.0),
|
||||
)
|
||||
);
|
||||
let _ = assembly.try_insert_element(
|
||||
|
@ -133,7 +133,7 @@ fn load_low_curv_assemb(assembly: &Assembly) {
|
|||
"corner2".to_string(),
|
||||
"Corner 2".to_string(),
|
||||
[0.75_f32, 0.75_f32, 0.75_f32],
|
||||
engine::sphere(2.0/3.0, -4.0/3.0 * a, 0.0, 1.0/3.0)
|
||||
engine::sphere(2.0/3.0, -4.0/3.0 * a, 0.0, 1.0/3.0),
|
||||
)
|
||||
);
|
||||
let _ = assembly.try_insert_element(
|
||||
|
@ -141,7 +141,7 @@ fn load_low_curv_assemb(assembly: &Assembly) {
|
|||
String::from("corner3"),
|
||||
String::from("Corner 3"),
|
||||
[0.75_f32, 0.75_f32, 0.75_f32],
|
||||
engine::sphere(2.0/3.0, 4.0/3.0 * a, 0.0, 1.0/3.0)
|
||||
engine::sphere(2.0/3.0, 4.0/3.0 * a, 0.0, 1.0/3.0),
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -202,7 +202,7 @@ fn load_pointed_assemb(assembly: &Assembly) {
|
|||
format!("point_front"),
|
||||
format!("Front point"),
|
||||
[0.75_f32, 0.75_f32, 0.75_f32],
|
||||
engine::point(0.0, 0.0, FRAC_1_SQRT_2)
|
||||
engine::point(0.0, 0.0, FRAC_1_SQRT_2),
|
||||
)
|
||||
);
|
||||
let _ = assembly.try_insert_element(
|
||||
|
@ -210,7 +210,7 @@ fn load_pointed_assemb(assembly: &Assembly) {
|
|||
format!("point_back"),
|
||||
format!("Back point"),
|
||||
[0.75_f32, 0.75_f32, 0.75_f32],
|
||||
engine::point(0.0, 0.0, -FRAC_1_SQRT_2)
|
||||
engine::point(0.0, 0.0, -FRAC_1_SQRT_2),
|
||||
)
|
||||
);
|
||||
for index_x in 0..=1 {
|
||||
|
@ -223,7 +223,7 @@ fn load_pointed_assemb(assembly: &Assembly) {
|
|||
format!("sphere{index_x}{index_y}"),
|
||||
format!("Sphere {index_x}{index_y}"),
|
||||
[0.5*(1.0 + x) as f32, 0.5*(1.0 + y) as f32, 0.5*(1.0 - x*y) as f32],
|
||||
engine::sphere(x, y, 0.0, 1.0)
|
||||
engine::sphere(x, y, 0.0, 1.0),
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -232,7 +232,7 @@ fn load_pointed_assemb(assembly: &Assembly) {
|
|||
format!("point{index_x}{index_y}"),
|
||||
format!("Point {index_x}{index_y}"),
|
||||
[0.5*(1.0 + x) as f32, 0.5*(1.0 + y) as f32, 0.5*(1.0 - x*y) as f32],
|
||||
engine::point(x, y, 0.0)
|
||||
engine::point(x, y, 0.0),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -256,56 +256,56 @@ fn load_tridim_icosahedron_assemb(assembly: &Assembly) {
|
|||
"a1".to_string(),
|
||||
"A₁".to_string(),
|
||||
COLOR_A,
|
||||
engine::point(0.25, 0.75, 0.75)
|
||||
engine::point(0.25, 0.75, 0.75),
|
||||
),
|
||||
Point::new(
|
||||
"a2".to_string(),
|
||||
"A₂".to_string(),
|
||||
COLOR_A,
|
||||
engine::point(0.75, 0.25, 0.75)
|
||||
engine::point(0.75, 0.25, 0.75),
|
||||
),
|
||||
Point::new(
|
||||
"a3".to_string(),
|
||||
"A₃".to_string(),
|
||||
COLOR_A,
|
||||
engine::point(0.75, 0.75, 0.25)
|
||||
engine::point(0.75, 0.75, 0.25),
|
||||
),
|
||||
Point::new(
|
||||
"b1".to_string(),
|
||||
"B₁".to_string(),
|
||||
COLOR_B,
|
||||
engine::point(0.75, -0.25, -0.25)
|
||||
engine::point(0.75, -0.25, -0.25),
|
||||
),
|
||||
Point::new(
|
||||
"b2".to_string(),
|
||||
"B₂".to_string(),
|
||||
COLOR_B,
|
||||
engine::point(-0.25, 0.75, -0.25)
|
||||
engine::point(-0.25, 0.75, -0.25),
|
||||
),
|
||||
Point::new(
|
||||
"b3".to_string(),
|
||||
"B₃".to_string(),
|
||||
COLOR_B,
|
||||
engine::point(-0.25, -0.25, 0.75)
|
||||
engine::point(-0.25, -0.25, 0.75),
|
||||
),
|
||||
Point::new(
|
||||
"c1".to_string(),
|
||||
"C₁".to_string(),
|
||||
COLOR_C,
|
||||
engine::point(0.0, -1.0, -1.0)
|
||||
engine::point(0.0, -1.0, -1.0),
|
||||
),
|
||||
Point::new(
|
||||
"c2".to_string(),
|
||||
"C₂".to_string(),
|
||||
COLOR_C,
|
||||
engine::point(-1.0, 0.0, -1.0)
|
||||
engine::point(-1.0, 0.0, -1.0),
|
||||
),
|
||||
Point::new(
|
||||
"c3".to_string(),
|
||||
"C₃".to_string(),
|
||||
COLOR_C,
|
||||
engine::point(-1.0, -1.0, 0.0)
|
||||
)
|
||||
engine::point(-1.0, -1.0, 0.0),
|
||||
),
|
||||
];
|
||||
for vertex in vertices {
|
||||
let _ = assembly.try_insert_element(vertex);
|
||||
|
@ -320,20 +320,20 @@ fn load_tridim_icosahedron_assemb(assembly: &Assembly) {
|
|||
"face1".to_string(),
|
||||
"Face 1".to_string(),
|
||||
COLOR_FACE,
|
||||
engine::sphere_with_offset(frac_2_sqrt_6, -frac_1_sqrt_6, -frac_1_sqrt_6, -frac_1_sqrt_6, 0.0)
|
||||
engine::sphere_with_offset(frac_2_sqrt_6, -frac_1_sqrt_6, -frac_1_sqrt_6, -frac_1_sqrt_6, 0.0),
|
||||
),
|
||||
Sphere::new(
|
||||
"face2".to_string(),
|
||||
"Face 2".to_string(),
|
||||
COLOR_FACE,
|
||||
engine::sphere_with_offset(-frac_1_sqrt_6, frac_2_sqrt_6, -frac_1_sqrt_6, -frac_1_sqrt_6, 0.0)
|
||||
engine::sphere_with_offset(-frac_1_sqrt_6, frac_2_sqrt_6, -frac_1_sqrt_6, -frac_1_sqrt_6, 0.0),
|
||||
),
|
||||
Sphere::new(
|
||||
"face3".to_string(),
|
||||
"Face 3".to_string(),
|
||||
COLOR_FACE,
|
||||
engine::sphere_with_offset(-frac_1_sqrt_6, -frac_1_sqrt_6, frac_2_sqrt_6, -frac_1_sqrt_6, 0.0)
|
||||
)
|
||||
engine::sphere_with_offset(-frac_1_sqrt_6, -frac_1_sqrt_6, frac_2_sqrt_6, -frac_1_sqrt_6, 0.0),
|
||||
),
|
||||
];
|
||||
for face in faces {
|
||||
face.ghost().set(true);
|
||||
|
@ -416,7 +416,7 @@ fn load_dodeca_packing_assemb(assembly: &Assembly) {
|
|||
"substrate".to_string(),
|
||||
"Substrate".to_string(),
|
||||
[0.75_f32, 0.75_f32, 0.75_f32],
|
||||
engine::sphere(0.0, 0.0, 0.0, 1.0)
|
||||
engine::sphere(0.0, 0.0, 0.0, 1.0),
|
||||
)
|
||||
);
|
||||
let substrate = assembly.elements_by_id.with_untracked(
|
||||
|
@ -456,7 +456,7 @@ fn load_dodeca_packing_assemb(assembly: &Assembly) {
|
|||
id_a.clone(),
|
||||
format!("A{label_sub}"),
|
||||
COLOR_A,
|
||||
engine::sphere(0.0, small_coord, big_coord, face_radii[k])
|
||||
engine::sphere(0.0, small_coord, big_coord, face_radii[k]),
|
||||
)
|
||||
);
|
||||
faces.push(
|
||||
|
@ -472,7 +472,7 @@ fn load_dodeca_packing_assemb(assembly: &Assembly) {
|
|||
id_b.clone(),
|
||||
format!("B{label_sub}"),
|
||||
COLOR_B,
|
||||
engine::sphere(small_coord, big_coord, 0.0, face_radii[k])
|
||||
engine::sphere(small_coord, big_coord, 0.0, face_radii[k]),
|
||||
)
|
||||
);
|
||||
faces.push(
|
||||
|
@ -488,7 +488,7 @@ fn load_dodeca_packing_assemb(assembly: &Assembly) {
|
|||
id_c.clone(),
|
||||
format!("C{label_sub}"),
|
||||
COLOR_C,
|
||||
engine::sphere(big_coord, 0.0, small_coord, face_radii[k])
|
||||
engine::sphere(big_coord, 0.0, small_coord, face_radii[k]),
|
||||
)
|
||||
);
|
||||
faces.push(
|
||||
|
@ -559,19 +559,19 @@ fn load_balanced_assemb(assembly: &Assembly) {
|
|||
"outer".to_string(),
|
||||
"Outer".to_string(),
|
||||
[0.75_f32, 0.75_f32, 0.75_f32],
|
||||
engine::sphere(0.0, 0.0, 0.0, R_OUTER)
|
||||
engine::sphere(0.0, 0.0, 0.0, R_OUTER),
|
||||
),
|
||||
Sphere::new(
|
||||
"a".to_string(),
|
||||
"A".to_string(),
|
||||
[1.00_f32, 0.00_f32, 0.25_f32],
|
||||
engine::sphere(0.0, 4.0, 0.0, R_INNER)
|
||||
engine::sphere(0.0, 4.0, 0.0, R_INNER),
|
||||
),
|
||||
Sphere::new(
|
||||
"b".to_string(),
|
||||
"B".to_string(),
|
||||
[0.00_f32, 0.25_f32, 1.00_f32],
|
||||
engine::sphere(0.0, -4.0, 0.0, R_INNER)
|
||||
engine::sphere(0.0, -4.0, 0.0, R_INNER),
|
||||
),
|
||||
];
|
||||
for sphere in spheres {
|
||||
|
@ -589,7 +589,7 @@ fn load_balanced_assemb(assembly: &Assembly) {
|
|||
for (sphere, radius) in [
|
||||
(outer.clone(), R_OUTER),
|
||||
(a.clone(), R_INNER),
|
||||
(b.clone(), R_INNER)
|
||||
(b.clone(), R_INNER),
|
||||
] {
|
||||
let curvature_regulator = sphere.regulators().with_untracked(
|
||||
|regs| regs.first().unwrap().clone()
|
||||
|
@ -618,7 +618,7 @@ fn load_off_center_assemb(assembly: &Assembly) {
|
|||
"point".to_string(),
|
||||
"Point".to_string(),
|
||||
[0.75_f32, 0.75_f32, 0.75_f32],
|
||||
engine::point(1e-9, 0.0, 0.0)
|
||||
engine::point(1e-9, 0.0, 0.0),
|
||||
),
|
||||
);
|
||||
let _ = assembly.try_insert_element(
|
||||
|
@ -626,7 +626,7 @@ fn load_off_center_assemb(assembly: &Assembly) {
|
|||
"sphere".to_string(),
|
||||
"Sphere".to_string(),
|
||||
[0.75_f32, 0.75_f32, 0.75_f32],
|
||||
engine::sphere(0.0, 0.0, 0.0, 1.0)
|
||||
engine::sphere(0.0, 0.0, 0.0, 1.0),
|
||||
),
|
||||
);
|
||||
|
||||
|
@ -658,14 +658,14 @@ fn load_radius_ratio_assemb(assembly: &Assembly) {
|
|||
"sphere_faces".to_string(),
|
||||
"Insphere".to_string(),
|
||||
GRAY,
|
||||
engine::sphere(0.0, 0.0, 0.0, 0.5)
|
||||
engine::sphere(0.0, 0.0, 0.0, 0.5),
|
||||
),
|
||||
Sphere::new(
|
||||
"sphere_vertices".to_string(),
|
||||
"Circumsphere".to_string(),
|
||||
GRAY,
|
||||
engine::sphere(0.0, 0.0, 0.0, 0.25)
|
||||
)
|
||||
engine::sphere(0.0, 0.0, 0.0, 0.25),
|
||||
),
|
||||
];
|
||||
for sphere in spheres {
|
||||
let _ = assembly.try_insert_element(sphere);
|
||||
|
@ -678,13 +678,13 @@ fn load_radius_ratio_assemb(assembly: &Assembly) {
|
|||
[1.00_f32, 0.50_f32, 0.75_f32],
|
||||
[1.00_f32, 0.75_f32, 0.50_f32],
|
||||
[1.00_f32, 1.00_f32, 0.50_f32],
|
||||
[0.75_f32, 0.50_f32, 1.00_f32]
|
||||
[0.75_f32, 0.50_f32, 1.00_f32],
|
||||
].into_iter(),
|
||||
[
|
||||
engine::point(-0.6, -0.8, -0.6),
|
||||
engine::point(-0.6, 0.8, 0.6),
|
||||
engine::point(0.6, -0.8, 0.6),
|
||||
engine::point(0.6, 0.8, -0.6)
|
||||
engine::point(0.6, 0.8, -0.6),
|
||||
].into_iter()
|
||||
).map(
|
||||
|(k, color, representation)| {
|
||||
|
@ -692,7 +692,7 @@ fn load_radius_ratio_assemb(assembly: &Assembly) {
|
|||
format!("v{k}"),
|
||||
format!("Vertex {k}"),
|
||||
color,
|
||||
representation
|
||||
representation,
|
||||
)
|
||||
}
|
||||
);
|
||||
|
@ -709,13 +709,13 @@ fn load_radius_ratio_assemb(assembly: &Assembly) {
|
|||
[1.00_f32, 0.00_f32, 0.25_f32],
|
||||
[1.00_f32, 0.25_f32, 0.00_f32],
|
||||
[0.75_f32, 0.75_f32, 0.00_f32],
|
||||
[0.25_f32, 0.00_f32, 1.00_f32]
|
||||
[0.25_f32, 0.00_f32, 1.00_f32],
|
||||
].into_iter(),
|
||||
[
|
||||
engine::sphere_with_offset(base_dir[0], base_dir[1], base_dir[2], offset, 0.0),
|
||||
engine::sphere_with_offset(base_dir[0], -base_dir[1], -base_dir[2], offset, 0.0),
|
||||
engine::sphere_with_offset(-base_dir[0], base_dir[1], -base_dir[2], offset, 0.0),
|
||||
engine::sphere_with_offset(-base_dir[0], -base_dir[1], base_dir[2], offset, 0.0)
|
||||
engine::sphere_with_offset(-base_dir[0], -base_dir[1], base_dir[2], offset, 0.0),
|
||||
].into_iter()
|
||||
).map(
|
||||
|(k, color, representation)| {
|
||||
|
@ -723,7 +723,7 @@ fn load_radius_ratio_assemb(assembly: &Assembly) {
|
|||
format!("f{k}"),
|
||||
format!("Face {k}"),
|
||||
color,
|
||||
representation
|
||||
representation,
|
||||
)
|
||||
}
|
||||
);
|
||||
|
@ -736,7 +736,7 @@ fn load_radius_ratio_assemb(assembly: &Assembly) {
|
|||
for j in index_range.clone() {
|
||||
let [face_j, vertex_j] = [
|
||||
format!("f{j}"),
|
||||
format!("v{j}")
|
||||
format!("v{j}"),
|
||||
].map(
|
||||
|id| assembly.elements_by_id.with_untracked(
|
||||
|elts_by_id| elts_by_id[&id].clone()
|
||||
|
@ -797,7 +797,7 @@ fn load_irisawa_hexlet_assemb(assembly: &Assembly) {
|
|||
[0.75_f32, 0.75_f32, 0.00_f32],
|
||||
[0.25_f32, 1.00_f32, 0.00_f32],
|
||||
[0.00_f32, 0.25_f32, 1.00_f32],
|
||||
[0.25_f32, 0.00_f32, 1.00_f32]
|
||||
[0.25_f32, 0.00_f32, 1.00_f32],
|
||||
].into_iter();
|
||||
|
||||
// create the spheres
|
||||
|
@ -806,19 +806,19 @@ fn load_irisawa_hexlet_assemb(assembly: &Assembly) {
|
|||
"outer".to_string(),
|
||||
"Outer".to_string(),
|
||||
[0.5_f32, 0.5_f32, 0.5_f32],
|
||||
engine::sphere(0.0, 0.0, 0.0, 1.5)
|
||||
engine::sphere(0.0, 0.0, 0.0, 1.5),
|
||||
),
|
||||
Sphere::new(
|
||||
"sun".to_string(),
|
||||
"Sun".to_string(),
|
||||
[0.75_f32, 0.75_f32, 0.75_f32],
|
||||
engine::sphere(0.0, -0.75, 0.0, 0.75)
|
||||
engine::sphere(0.0, -0.75, 0.0, 0.75),
|
||||
),
|
||||
Sphere::new(
|
||||
"moon".to_string(),
|
||||
"Moon".to_string(),
|
||||
[0.25_f32, 0.25_f32, 0.25_f32],
|
||||
engine::sphere(0.0, 0.75, 0.0, 0.75)
|
||||
engine::sphere(0.0, 0.75, 0.0, 0.75),
|
||||
),
|
||||
].into_iter().chain(
|
||||
index_range.clone().zip(colors).map(
|
||||
|
@ -828,7 +828,7 @@ fn load_irisawa_hexlet_assemb(assembly: &Assembly) {
|
|||
format!("chain{k}"),
|
||||
format!("Chain {k}"),
|
||||
color,
|
||||
engine::sphere(1.0 * ang.sin(), 0.0, 1.0 * ang.cos(), 0.5)
|
||||
engine::sphere(1.0 * ang.sin(), 0.0, 1.0 * ang.cos(), 0.5),
|
||||
)
|
||||
}
|
||||
)
|
||||
|
@ -865,7 +865,7 @@ fn load_irisawa_hexlet_assemb(assembly: &Assembly) {
|
|||
(outer.clone(), "1"),
|
||||
(sun.clone(), "-1"),
|
||||
(moon.clone(), "-1"),
|
||||
(chain_sphere_next.clone(), "-1")
|
||||
(chain_sphere_next.clone(), "-1"),
|
||||
] {
|
||||
let tangency = InversiveDistanceRegulator::new([chain_sphere.clone(), other_sphere]);
|
||||
tangency.set_point.set(SpecifiedValue::try_from(inversive_distance.to_string()).unwrap());
|
||||
|
@ -918,24 +918,24 @@ pub fn TestAssemblyChooser() -> View {
|
|||
"off-center" => load_off_center_assemb(assembly),
|
||||
"radius-ratio" => load_radius_ratio_assemb(assembly),
|
||||
"irisawa-hexlet" => load_irisawa_hexlet_assemb(assembly),
|
||||
_ => ()
|
||||
_ => (),
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
// build the chooser
|
||||
view! {
|
||||
select(bind:value=assembly_name) {
|
||||
option(value="general") { "General" }
|
||||
option(value="low-curv") { "Low-curvature" }
|
||||
option(value="pointed") { "Pointed" }
|
||||
option(value="tridim-icosahedron") { "Tridiminished icosahedron" }
|
||||
option(value="dodeca-packing") { "Dodecahedral packing" }
|
||||
option(value="balanced") { "Balanced" }
|
||||
option(value="off-center") { "Off-center" }
|
||||
option(value="radius-ratio") { "Radius ratio" }
|
||||
option(value="irisawa-hexlet") { "Irisawa hexlet" }
|
||||
option(value="empty") { "Empty" }
|
||||
select(bind:value = assembly_name) {
|
||||
option(value = "general") { "General" }
|
||||
option(value = "low-curv") { "Low-curvature" }
|
||||
option(value = "pointed") { "Pointed" }
|
||||
option(value = "tridim-icosahedron") { "Tridiminished icosahedron" }
|
||||
option(value = "dodeca-packing") { "Dodecahedral packing" }
|
||||
option(value = "balanced") { "Balanced" }
|
||||
option(value = "off-center") { "Off-center" }
|
||||
option(value = "radius-ratio") { "Radius ratio" }
|
||||
option(value = "irisawa-hexlet") { "Irisawa hexlet" }
|
||||
option(value = "empty") { "Empty" }
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue