Use ghost mode to put key elements within reach

Also, remove formatting errors and old code.
This commit is contained in:
Aaron Fenyes 2025-06-12 11:51:47 -07:00
parent 6928ac8765
commit f1fea9e40e

View file

@ -9,6 +9,7 @@ use crate::{
AppState, AppState,
assembly::{ assembly::{
Assembly, Assembly,
Element,
ElementColor, ElementColor,
InversiveDistanceRegulator, InversiveDistanceRegulator,
Point, Point,
@ -253,15 +254,16 @@ fn load_irisawa_hexlet_assemb(assembly: &Assembly) {
let _ = assembly.try_insert_element(sphere); let _ = assembly.try_insert_element(sphere);
} }
// fix the curvature of the outer sphere // put the outer sphere in ghost mode and fix its curvature
let outer = assembly.elements_by_id.with_untracked( let outer = assembly.elements_by_id.with_untracked(
|elts_by_id| elts_by_id["outer"].clone() |elts_by_id| elts_by_id["outer"].clone()
); );
outer.ghost().set(true);
let outer_curvature_regulator = outer.regulators().with_untracked( let outer_curvature_regulator = outer.regulators().with_untracked(
|regs| regs.first().unwrap().clone() |regs| regs.first().unwrap().clone()
); );
outer_curvature_regulator.set_point().set( outer_curvature_regulator.set_point().set(
SpecifiedValue::try_from((1.0 / 3.0/*30.0*/).to_string()).unwrap() SpecifiedValue::try_from((1.0 / 3.0).to_string()).unwrap()
); );
// impose the desired tangencies // impose the desired tangencies
@ -355,7 +357,7 @@ fn load_radius_ratio_assemb(assembly: &Assembly) {
// create the faces // create the faces
let base_dir = Vector3::new(1.0, 0.75, 1.0).normalize(); let base_dir = Vector3::new(1.0, 0.75, 1.0).normalize();
let offset = base_dir.dot(&Vector3::new(-0.6, 0.8, 0.6)); let offset = base_dir.dot(&Vector3::new(-0.6, 0.8, 0.6));
let faces =izip!( let faces = izip!(
index_range.clone(), index_range.clone(),
[ [
[1.00_f32, 0.00_f32, 0.25_f32], [1.00_f32, 0.00_f32, 0.25_f32],
@ -380,6 +382,7 @@ fn load_radius_ratio_assemb(assembly: &Assembly) {
} }
); );
for face in faces { for face in faces {
face.ghost().set(true);
let _ = assembly.try_insert_element(face); let _ = assembly.try_insert_element(face);
} }