From 46ffd6c285b6a6b924a1083f67057bdff5206379 Mon Sep 17 00:00:00 2001 From: Glen Whitney Date: Mon, 6 Oct 2025 16:31:02 -0600 Subject: [PATCH] chore: typographical improvements per review --- app-proto/src/assembly.rs | 14 +++++++------- app-proto/src/components/outline.rs | 5 +++-- app-proto/src/engine.rs | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/app-proto/src/assembly.rs b/app-proto/src/assembly.rs index c263692..8e4b96f 100644 --- a/app-proto/src/assembly.rs +++ b/app-proto/src/assembly.rs @@ -514,8 +514,7 @@ impl ProblemPoser for HalfCurvatureRegulator { pub enum Axis {X = 0, Y = 1, Z = 2} impl Axis { - pub const N_AXIS: usize = (Axis::Z as usize) + 1; - pub const NAME: [&str; Axis::N_AXIS] = ["X", "Y", "Z"]; + pub const NAME: [&str; Axis::CARDINALITY] = ["X", "Y", "Z"]; } pub struct PointCoordinateRegulator { @@ -553,17 +552,17 @@ impl ProblemPoser for PointCoordinateRegulator { let col = self.subject.column_index().expect( "Subject must be indexed before point-coordinate regulator poses."); problem.frozen.push(self.axis as usize, col, val); - // Check if all three coordinates have been frozen, and if so, - // freeze the coradius as well - let mut coords = [0.0; Axis::N_AXIS]; + // Check if all three spatial coordinates have been frozen, and if so, + // freeze the norm component as well + let mut coords = [0.0; Axis::CARDINALITY]; let mut nset: usize = 0; for &MatrixEntry {index, value} in &(problem.frozen) { - if index.1 == col && index.0 < Axis::N_AXIS { + if index.1 == col && index.0 < Axis::CARDINALITY { nset += 1; coords[index.0] = value } } - if nset == Axis::N_AXIS { + if nset == Axis::CARDINALITY { let [x, y, z] = coords; problem.frozen.push( Point::NORM_COMPONENT, col, point(x,y,z)[Point::NORM_COMPONENT]); @@ -773,6 +772,7 @@ impl Assembly { /* DEBUG */ // log the Gram matrix console_log!("Gram matrix:\n{}", problem.gram); + console_log!("Frozen entries:\n{}", problem.frozen); /* DEBUG */ // log the initial configuration matrix diff --git a/app-proto/src/components/outline.rs b/app-proto/src/components/outline.rs index 79781fa..d9ab71d 100644 --- a/app-proto/src/components/outline.rs +++ b/app-proto/src/components/outline.rs @@ -123,10 +123,11 @@ impl OutlineItem for HalfCurvatureRegulator { impl OutlineItem for PointCoordinateRegulator { fn outline_item(self: Rc, _element: &Rc) -> View { + let name = format!("{} coordinate", Axis::NAME[self.axis as usize]); view! { li(class = "regulator") { - div(class = "regulator-label") { (Axis::NAME[self.axis as usize]) } - div(class = "regulator-type") { "Coordinate" } + div(class = "regulator-label") // for spacing + div(class = "regulator-type") { (name) } RegulatorInput(regulator = self) div(class = "status") } diff --git a/app-proto/src/engine.rs b/app-proto/src/engine.rs index feb23cf..0f26f02 100644 --- a/app-proto/src/engine.rs +++ b/app-proto/src/engine.rs @@ -46,7 +46,7 @@ pub fn project_sphere_to_normalized(rep: &mut DVector) { // normalize a point's representation vector by scaling pub fn project_point_to_normalized(rep: &mut DVector) { - rep.scale_mut(0.5 / rep[3]); //FIXME: This 3 should be Point::WEIGHT_COMPONENT + rep.scale_mut(0.5 / rep[3]); } // --- partial matrices ---