forked from StudioInfinity/dyna3
Print the vertex coordinates
This commit is contained in:
parent
cc2da3406b
commit
1054f4e85b
2 changed files with 19 additions and 5 deletions
|
@ -125,7 +125,7 @@ pub trait Element: Serial + ProblemPoser + DisplayItem {
|
||||||
fn set_column_index(&self, index: usize);
|
fn set_column_index(&self, index: usize);
|
||||||
|
|
||||||
/* KLUDGE */
|
/* KLUDGE */
|
||||||
fn has_distortion(&self) -> bool {
|
fn is_point(&self) -> bool {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -341,7 +341,7 @@ impl Element for Point {
|
||||||
self.column_index.set(Some(index));
|
self.column_index.set(Some(index));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn has_distortion(&self) -> bool {
|
fn is_point(&self) -> bool {
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -422,7 +422,7 @@ impl InversiveDistanceRegulator {
|
||||||
});
|
});
|
||||||
|
|
||||||
let set_point = create_signal(SpecifiedValue::from_empty_spec());
|
let set_point = create_signal(SpecifiedValue::from_empty_spec());
|
||||||
let distortion = if subjects.iter().all(|subj| subj.has_distortion()) {
|
let distortion = if subjects.iter().all(|subj| subj.is_point()) {
|
||||||
Some(create_memo(move || {
|
Some(create_memo(move || {
|
||||||
let set_point_opt = set_point.with(|set_pt| set_pt.value);
|
let set_point_opt = set_point.with(|set_pt| set_pt.value);
|
||||||
let measurement_val = measurement.get();
|
let measurement_val = measurement.get();
|
||||||
|
|
|
@ -134,11 +134,13 @@ fn DistortionGauge() -> View {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
fn DistortionPrintButton() -> View {
|
fn PrintButton() -> View {
|
||||||
view! {
|
view! {
|
||||||
button(
|
button(
|
||||||
on:click = |_| {
|
on:click = |_| {
|
||||||
let state = use_context::<AppState>();
|
let state = use_context::<AppState>();
|
||||||
|
|
||||||
|
// print the edge length distortions
|
||||||
let mut hard_distortion_table = String::new();
|
let mut hard_distortion_table = String::new();
|
||||||
let mut soft_distortion_table = String::new();
|
let mut soft_distortion_table = String::new();
|
||||||
let mut highest_distortion = f64::NEG_INFINITY;
|
let mut highest_distortion = f64::NEG_INFINITY;
|
||||||
|
@ -180,6 +182,18 @@ fn DistortionPrintButton() -> View {
|
||||||
Largest absolute: {largest_hard_distortion}\n\n\
|
Largest absolute: {largest_hard_distortion}\n\n\
|
||||||
--- Table ---\n\n{hard_distortion_table}\
|
--- Table ---\n\n{hard_distortion_table}\
|
||||||
");
|
");
|
||||||
|
|
||||||
|
// print the vertex coordinates
|
||||||
|
let mut coords_table = String::new();
|
||||||
|
state.assembly.elements.with_untracked(|elts| {
|
||||||
|
for elt in elts.iter().filter(|elt| elt.is_point()) {
|
||||||
|
let (x, y, z) = elt.representation().with(
|
||||||
|
|rep| (rep[0], rep[1], rep[2])
|
||||||
|
);
|
||||||
|
coords_table += &format!("{}: {x}, {y}, {z}\n", elt.id());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
console_log!("=== Vertex coordinates ===\n\n{coords_table}");
|
||||||
},
|
},
|
||||||
) { "Print" }
|
) { "Print" }
|
||||||
}
|
}
|
||||||
|
@ -391,7 +405,7 @@ pub fn Diagnostics() -> View {
|
||||||
DiagnosticsPanel(name = "spectrum") { SpectrumHistory {} }
|
DiagnosticsPanel(name = "spectrum") { SpectrumHistory {} }
|
||||||
div(id = "distortion-bar") {
|
div(id = "distortion-bar") {
|
||||||
DistortionGauge {}
|
DistortionGauge {}
|
||||||
DistortionPrintButton {}
|
PrintButton {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue