Application prototype #14
@ -31,8 +31,8 @@ impl AppState {
|
||||
fn main() {
|
||||
sycamore::render(|| {
|
||||
let state = AppState::new();
|
||||
let key_a = state.assembly.elements.update(
|
||||
|elts| elts.insert(
|
||||
let assemb = &state.assembly;
|
||||
let _ = assemb.try_insert_element(
|
||||
Element {
|
||||
id: String::from("wing_a"),
|
||||
label: String::from("Wing A"),
|
||||
@ -40,21 +40,17 @@ fn main() {
|
||||
rep: DVector::<f64>::from_column_slice(&[0.5, 0.5, 0.0, 0.5, -0.25]),
|
||||
constraints: BTreeSet::default()
|
||||
}
|
||||
)
|
||||
);
|
||||
let key_b = state.assembly.elements.update(
|
||||
|elts| elts.insert(
|
||||
let _ = assemb.try_insert_element(
|
||||
Element {
|
||||
id: String::from("wing_b"),
|
||||
label: String::from("Wing B"),
|
||||
color: [0.00_f32, 0.25_f32, 1.00_f32],
|
||||
rep: DVector::<f64>::from_column_slice(&[-0.5, -0.5, 0.0, 0.5, -0.25]),
|
||||
constraints: BTreeSet::default()
|
||||
},
|
||||
)
|
||||
}
|
||||
);
|
||||
state.assembly.elements.update(
|
||||
|elts| elts.insert(
|
||||
let _ = assemb.try_insert_element(
|
||||
Element {
|
||||
id: String::from("central"),
|
||||
label: String::from("Central"),
|
||||
@ -62,12 +58,16 @@ fn main() {
|
||||
rep: DVector::<f64>::from_column_slice(&[0.0, 0.0, 0.0, 0.4, -0.625]),
|
||||
constraints: BTreeSet::default()
|
||||
}
|
||||
)
|
||||
);
|
||||
state.assembly.insert_constraint(Constraint {
|
||||
args: (key_a, key_b),
|
||||
assemb.insert_constraint(
|
||||
Constraint {
|
||||
args: (
|
||||
assemb.elements_by_id.with(|elts_by_id| elts_by_id["wing_a"]),
|
||||
assemb.elements_by_id.with(|elts_by_id| elts_by_id["wing_b"])
|
||||
),
|
||||
rep: 0.5
|
||||
});
|
||||
}
|
||||
);
|
||||
provide_context(state);
|
||||
|
||||
view! {
|
||||
|
Loading…
Reference in New Issue
Block a user