forked from StudioInfinity/dyna3
Refactor: rename loaders and adopt 'Self' type convention (#111)
Resolves #109. Resolves #110. Co-authored-by: Aaron Fenyes <aaron.fenyes@fareycircles.ooo> Reviewed-on: StudioInfinity/dyna3#111 Co-authored-by: Vectornaut <vectornaut@nobody@nowhere.net> Co-committed-by: Vectornaut <vectornaut@nobody@nowhere.net>
This commit is contained in:
parent
ef1a579ac0
commit
a4565281d5
7 changed files with 64 additions and 64 deletions
|
@ -26,7 +26,7 @@ use crate::{
|
|||
// done more work on saving and loading assemblies, we should come back to this
|
||||
// code to see if it can be simplified
|
||||
|
||||
fn load_gen_assemb(assembly: &Assembly) {
|
||||
fn load_general(assembly: &Assembly) {
|
||||
let _ = assembly.try_insert_element(
|
||||
Sphere::new(
|
||||
String::from("gemini_a"),
|
||||
|
@ -77,7 +77,7 @@ fn load_gen_assemb(assembly: &Assembly) {
|
|||
);
|
||||
}
|
||||
|
||||
fn load_low_curv_assemb(assembly: &Assembly) {
|
||||
fn load_low_curvature(assembly: &Assembly) {
|
||||
// create the spheres
|
||||
let a = 0.75_f64.sqrt();
|
||||
let _ = assembly.try_insert_element(
|
||||
|
@ -196,7 +196,7 @@ fn load_low_curv_assemb(assembly: &Assembly) {
|
|||
}
|
||||
}
|
||||
|
||||
fn load_pointed_assemb(assembly: &Assembly) {
|
||||
fn load_pointed(assembly: &Assembly) {
|
||||
let _ = assembly.try_insert_element(
|
||||
Point::new(
|
||||
format!("point_front"),
|
||||
|
@ -246,7 +246,7 @@ fn load_pointed_assemb(assembly: &Assembly) {
|
|||
// B-C "
|
||||
// C-C "
|
||||
// A-C -0.25 * φ^2 = -0.6545084971874737
|
||||
fn load_tridim_icosahedron_assemb(assembly: &Assembly) {
|
||||
fn load_tridiminished_icosahedron(assembly: &Assembly) {
|
||||
// create the vertices
|
||||
const COLOR_A: ElementColor = [1.00_f32, 0.25_f32, 0.25_f32];
|
||||
const COLOR_B: ElementColor = [0.75_f32, 0.75_f32, 0.75_f32];
|
||||
|
@ -409,7 +409,7 @@ fn load_tridim_icosahedron_assemb(assembly: &Assembly) {
|
|||
|
||||
// to finish describing the dodecahedral circle packing, set the inversive
|
||||
// distance regulators to -1. some of the regulators have already been set
|
||||
fn load_dodeca_packing_assemb(assembly: &Assembly) {
|
||||
fn load_dodecahedral_packing(assembly: &Assembly) {
|
||||
// add the substrate
|
||||
let _ = assembly.try_insert_element(
|
||||
Sphere::new(
|
||||
|
@ -550,7 +550,7 @@ fn load_dodeca_packing_assemb(assembly: &Assembly) {
|
|||
|
||||
// the initial configuration of this test assembly deliberately violates the
|
||||
// constraints, so loading the assembly will trigger a non-trivial realization
|
||||
fn load_balanced_assemb(assembly: &Assembly) {
|
||||
fn load_balanced(assembly: &Assembly) {
|
||||
// create the spheres
|
||||
const R_OUTER: f64 = 10.0;
|
||||
const R_INNER: f64 = 4.0;
|
||||
|
@ -611,7 +611,7 @@ fn load_balanced_assemb(assembly: &Assembly) {
|
|||
|
||||
// the initial configuration of this test assembly deliberately violates the
|
||||
// constraints, so loading the assembly will trigger a non-trivial realization
|
||||
fn load_off_center_assemb(assembly: &Assembly) {
|
||||
fn load_off_center(assembly: &Assembly) {
|
||||
// create a point almost at the origin and a sphere centered on the origin
|
||||
let _ = assembly.try_insert_element(
|
||||
Point::new(
|
||||
|
@ -648,7 +648,7 @@ fn load_off_center_assemb(assembly: &Assembly) {
|
|||
// sqrt(1/6) and sqrt(3/2), respectively. to measure those radii, set an
|
||||
// inversive distance of -1 between the insphere and each face, and then set an
|
||||
// inversive distance of 0 between the circumsphere and each vertex
|
||||
fn load_radius_ratio_assemb(assembly: &Assembly) {
|
||||
fn load_radius_ratio(assembly: &Assembly) {
|
||||
let index_range = 1..=4;
|
||||
|
||||
// create the spheres
|
||||
|
@ -789,7 +789,7 @@ fn load_radius_ratio_assemb(assembly: &Assembly) {
|
|||
// conditions are exactly representable as floats, unlike the analogous numbers
|
||||
// in the scaled-up problem. the inexact representations might break the
|
||||
// symmetry that's getting the engine stuck
|
||||
fn load_irisawa_hexlet_assemb(assembly: &Assembly) {
|
||||
fn load_irisawa_hexlet(assembly: &Assembly) {
|
||||
let index_range = 1..=6;
|
||||
let colors = [
|
||||
[1.00_f32, 0.00_f32, 0.25_f32],
|
||||
|
@ -909,15 +909,15 @@ pub fn TestAssemblyChooser() -> View {
|
|||
|
||||
// load assembly
|
||||
match name.as_str() {
|
||||
"general" => load_gen_assemb(assembly),
|
||||
"low-curv" => load_low_curv_assemb(assembly),
|
||||
"pointed" => load_pointed_assemb(assembly),
|
||||
"tridim-icosahedron" => load_tridim_icosahedron_assemb(assembly),
|
||||
"dodeca-packing" => load_dodeca_packing_assemb(assembly),
|
||||
"balanced" => load_balanced_assemb(assembly),
|
||||
"off-center" => load_off_center_assemb(assembly),
|
||||
"radius-ratio" => load_radius_ratio_assemb(assembly),
|
||||
"irisawa-hexlet" => load_irisawa_hexlet_assemb(assembly),
|
||||
"general" => load_general(assembly),
|
||||
"low-curvature" => load_low_curvature(assembly),
|
||||
"pointed" => load_pointed(assembly),
|
||||
"tridiminished-icosahedron" => load_tridiminished_icosahedron(assembly),
|
||||
"dodecahedral-packing" => load_dodecahedral_packing(assembly),
|
||||
"balanced" => load_balanced(assembly),
|
||||
"off-center" => load_off_center(assembly),
|
||||
"radius-ratio" => load_radius_ratio(assembly),
|
||||
"irisawa-hexlet" => load_irisawa_hexlet(assembly),
|
||||
_ => (),
|
||||
};
|
||||
});
|
||||
|
@ -927,10 +927,10 @@ pub fn TestAssemblyChooser() -> View {
|
|||
view! {
|
||||
select(bind:value = assembly_name) {
|
||||
option(value = "general") { "General" }
|
||||
option(value = "low-curv") { "Low-curvature" }
|
||||
option(value = "low-curvature") { "Low-curvature" }
|
||||
option(value = "pointed") { "Pointed" }
|
||||
option(value = "tridim-icosahedron") { "Tridiminished icosahedron" }
|
||||
option(value = "dodeca-packing") { "Dodecahedral packing" }
|
||||
option(value = "tridiminished-icosahedron") { "Tridiminished icosahedron" }
|
||||
option(value = "dodecahedral-packing") { "Dodecahedral packing" }
|
||||
option(value = "balanced") { "Balanced" }
|
||||
option(value = "off-center") { "Off-center" }
|
||||
option(value = "radius-ratio") { "Radius ratio" }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue