chore: typographical improvements per review
All checks were successful
/ test (pull_request) Successful in 3m45s
All checks were successful
/ test (pull_request) Successful in 3m45s
This commit is contained in:
parent
ecbbe2068c
commit
46ffd6c285
3 changed files with 11 additions and 10 deletions
|
@ -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
|
||||
|
|
|
@ -123,10 +123,11 @@ impl OutlineItem for HalfCurvatureRegulator {
|
|||
|
||||
impl OutlineItem for PointCoordinateRegulator {
|
||||
fn outline_item(self: Rc<Self>, _element: &Rc<dyn Element>) -> 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")
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ pub fn project_sphere_to_normalized(rep: &mut DVector<f64>) {
|
|||
|
||||
// normalize a point's representation vector by scaling
|
||||
pub fn project_point_to_normalized(rep: &mut DVector<f64>) {
|
||||
rep.scale_mut(0.5 / rep[3]); //FIXME: This 3 should be Point::WEIGHT_COMPONENT
|
||||
rep.scale_mut(0.5 / rep[3]);
|
||||
}
|
||||
|
||||
// --- partial matrices ---
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue