chore: further reformatting per review
All checks were successful
/ test (pull_request) Successful in 3m42s
All checks were successful
/ test (pull_request) Successful in 3m42s
This commit is contained in:
parent
760e811ee4
commit
e71b0944f6
5 changed files with 36 additions and 42 deletions
|
|
@ -587,7 +587,7 @@ impl ProblemPoser for PointCoordinateRegulator {
|
|||
problem.frozen.push(
|
||||
Point::NORM_COMPONENT,
|
||||
col,
|
||||
point(x,y,z)[Point::NORM_COMPONENT]
|
||||
point(x,y,z)[Point::NORM_COMPONENT],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -938,7 +938,7 @@ impl Assembly {
|
|||
None => {
|
||||
console_log!(
|
||||
"No velocity to unpack for fresh element \"{}\"",
|
||||
elt.id()
|
||||
elt.id(),
|
||||
)
|
||||
},
|
||||
};
|
||||
|
|
@ -973,9 +973,9 @@ mod tests {
|
|||
inversive distance regulator writes problem data")]
|
||||
fn unindexed_subject_test_inversive_distance() {
|
||||
let _ = create_root(|| {
|
||||
let subjects = [0, 1]
|
||||
.map(|k| Rc::new(Sphere::default(format!("sphere{k}"), k))
|
||||
as Rc<dyn Element>);
|
||||
let subjects = [0, 1].map(
|
||||
|k| Rc::new(Sphere::default(format!("sphere{k}"), k)) as Rc<dyn Element>
|
||||
);
|
||||
subjects[0].set_column_index(0);
|
||||
InversiveDistanceRegulator {
|
||||
subjects: subjects,
|
||||
|
|
|
|||
|
|
@ -128,14 +128,10 @@ impl DisplayItem for Sphere {
|
|||
const HIGHLIGHT: f32 = 0.2;
|
||||
|
||||
let representation = self.representation.get_clone_untracked();
|
||||
let color = if selected {
|
||||
self.color.map(|channel| 0.2 + 0.8*channel)
|
||||
} else {
|
||||
self.color
|
||||
};
|
||||
let opacity = if self.ghost.get() {
|
||||
GHOST_OPACITY
|
||||
} else { DEFAULT_OPACITY };
|
||||
let color = if selected { self.color.map(|channel| 0.2 + 0.8*channel) }
|
||||
else { self.color };
|
||||
let opacity = if self.ghost.get() { GHOST_OPACITY }
|
||||
else { DEFAULT_OPACITY };
|
||||
let highlight = if selected { 1.0 } else { HIGHLIGHT };
|
||||
scene.spheres.push(representation, color, opacity, highlight);
|
||||
}
|
||||
|
|
@ -194,9 +190,8 @@ impl DisplayItem for Point {
|
|||
const HIGHLIGHT: f32 = 0.5;
|
||||
|
||||
let representation = self.representation.get_clone_untracked();
|
||||
let color = if selected {
|
||||
self.color.map(|channel| 0.2 + 0.8*channel)
|
||||
} else { self.color };
|
||||
let color = if selected { self.color.map(|channel| 0.2 + 0.8*channel) }
|
||||
else { self.color };
|
||||
let opacity = if self.ghost.get() { GHOST_OPACITY } else { 1.0 };
|
||||
let highlight = if selected { 1.0 } else { HIGHLIGHT };
|
||||
scene.points.push(representation, color, opacity, highlight, selected);
|
||||
|
|
@ -637,7 +632,7 @@ pub fn Display() -> View {
|
|||
!realization_successful && on_init_step
|
||||
|| realization_successful && on_last_step;
|
||||
if on_manipulable_step
|
||||
&& state.selection.with(|sel| sel.len() == 1)
|
||||
&& state.selection.with(|sel| sel.len() == 1)
|
||||
{
|
||||
let sel = state.selection.with(
|
||||
|sel| sel.into_iter().next().unwrap().clone()
|
||||
|
|
@ -683,8 +678,8 @@ pub fn Display() -> View {
|
|||
// measure mean frame interval
|
||||
frames_since_last_sample += 1;
|
||||
if frames_since_last_sample >= SAMPLE_PERIOD {
|
||||
let SP64 = SAMPLE_PERIOD as f64;
|
||||
mean_frame_interval.set((time - last_sample_time) / SP64);
|
||||
mean_frame_interval
|
||||
.set((time - last_sample_time) / SAMPLE_PERIOD as f64);
|
||||
last_sample_time = time;
|
||||
frames_since_last_sample = 0;
|
||||
}
|
||||
|
|
@ -726,9 +721,9 @@ pub fn Display() -> View {
|
|||
|
||||
// write the spheres in world coordinates
|
||||
let sphere_reps_world: Vec<_> = scene.spheres.representations
|
||||
.into_iter().map(
|
||||
|rep| (&asm_to_world * rep).cast::<f32>()
|
||||
).collect();
|
||||
.into_iter()
|
||||
.map(|rep| (&asm_to_world * rep).cast::<f32>())
|
||||
.collect();
|
||||
|
||||
// set the resolution
|
||||
let width = canvas.width() as f32;
|
||||
|
|
@ -803,7 +798,8 @@ pub fn Display() -> View {
|
|||
&ctx, point_position_attr,
|
||||
SPACE_DIM as i32, point_positions.as_slice(),
|
||||
);
|
||||
bind_new_buffer_to_attribute(&ctx, point_color_attr,
|
||||
bind_new_buffer_to_attribute(
|
||||
&ctx, point_color_attr,
|
||||
(COLOR_SIZE + 1) as i32,
|
||||
scene.points.colors_with_opacity.concat().as_slice());
|
||||
bind_new_buffer_to_attribute(
|
||||
|
|
@ -969,9 +965,9 @@ pub fn Display() -> View {
|
|||
.into_iter()
|
||||
.filter(|elt| !elt.ghost().get());
|
||||
for elt in tangible_elts {
|
||||
let hit = assembly_to_world.with(
|
||||
let cast = assembly_to_world.with(
|
||||
|asm_to_world| elt.cast(dir, asm_to_world, pixel_size));
|
||||
match hit {
|
||||
match cast {
|
||||
Some(depth) => match clicked {
|
||||
Some((_, best_depth)) => {
|
||||
if depth < best_depth {
|
||||
|
|
|
|||
|
|
@ -63,10 +63,9 @@ fn RegulatorInput(regulator: Rc<dyn Regulator>) -> View {
|
|||
placeholder = measurement.with(|result| result.to_string()),
|
||||
bind:value = value,
|
||||
on:change = move |_| {
|
||||
let specification
|
||||
= SpecifiedValue::try_from(value.get_clone_untracked());
|
||||
let val = SpecifiedValue::try_from(value.get_clone_untracked());
|
||||
valid.set(
|
||||
match specification {
|
||||
match val {
|
||||
Ok(set_pt) => {
|
||||
set_point.set(set_pt);
|
||||
true
|
||||
|
|
|
|||
|
|
@ -333,7 +333,7 @@ fn load_tridiminished_icosahedron(assembly: &Assembly) {
|
|||
COLOR_FACE,
|
||||
engine::sphere_with_offset(
|
||||
frac_2_sqrt_6, -frac_1_sqrt_6, -frac_1_sqrt_6,
|
||||
-frac_1_sqrt_6, 0.0
|
||||
-frac_1_sqrt_6, 0.0,
|
||||
),
|
||||
),
|
||||
Sphere::new(
|
||||
|
|
@ -342,7 +342,7 @@ fn load_tridiminished_icosahedron(assembly: &Assembly) {
|
|||
COLOR_FACE,
|
||||
engine::sphere_with_offset(
|
||||
-frac_1_sqrt_6, frac_2_sqrt_6, -frac_1_sqrt_6,
|
||||
-frac_1_sqrt_6, 0.0
|
||||
-frac_1_sqrt_6, 0.0,
|
||||
),
|
||||
),
|
||||
Sphere::new(
|
||||
|
|
@ -351,7 +351,7 @@ fn load_tridiminished_icosahedron(assembly: &Assembly) {
|
|||
COLOR_FACE,
|
||||
engine::sphere_with_offset(
|
||||
-frac_1_sqrt_6, -frac_1_sqrt_6, frac_2_sqrt_6,
|
||||
-frac_1_sqrt_6, 0.0
|
||||
-frac_1_sqrt_6, 0.0,
|
||||
),
|
||||
),
|
||||
];
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ pub fn point(x: f64, y: f64, z: f64) -> DVector<f64> {
|
|||
}
|
||||
|
||||
// the sphere with the given center and radius, with inward-pointing normals
|
||||
pub fn sphere(center_x: f64, center_y: f64, center_z: f64, radius: f64)
|
||||
-> DVector<f64> {
|
||||
pub fn sphere(center_x: f64, center_y: f64, center_z: f64, radius: f64
|
||||
) -> DVector<f64> {
|
||||
let center_norm_sq
|
||||
= center_x * center_x + center_y * center_y + center_z * center_z;
|
||||
DVector::from_column_slice(&[
|
||||
|
|
@ -202,8 +202,8 @@ impl ConfigSubspace {
|
|||
// with the given column index has velocity `v`. the velocity is given in
|
||||
// projection coordinates, and the projection is done with respect to the
|
||||
// projection inner product
|
||||
pub fn proj(&self, v: &DVectorView<f64>, column_index: usize)
|
||||
-> DMatrix<f64> {
|
||||
pub fn proj(&self, v: &DVectorView<f64>, column_index: usize
|
||||
) -> DMatrix<f64> {
|
||||
if self.dim() == 0 {
|
||||
const ELEMENT_DIM: usize = 5;
|
||||
DMatrix::zeros(ELEMENT_DIM, self.assembly_dim)
|
||||
|
|
@ -294,9 +294,8 @@ impl SearchState {
|
|||
}
|
||||
}
|
||||
|
||||
fn basis_matrix(index: (usize, usize), nrows: usize, ncols: usize)
|
||||
-> DMatrix<f64>
|
||||
{
|
||||
fn basis_matrix(index: (usize, usize), nrows: usize, ncols: usize
|
||||
) -> DMatrix<f64> {
|
||||
let mut result = DMatrix::<f64>::zeros(nrows, ncols);
|
||||
result[index] = 1.0;
|
||||
result
|
||||
|
|
@ -624,7 +623,7 @@ pub mod examples {
|
|||
problem.gram.push_sym(
|
||||
block + j,
|
||||
block + k,
|
||||
if j == k { 0.0 } else { -0.5 }
|
||||
if j == k { 0.0 } else { -0.5 },
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -721,7 +720,7 @@ mod tests {
|
|||
for k in j..2 {
|
||||
problem.gram.push_sym(
|
||||
j, k,
|
||||
if (j, k) == (1, 1) { 1.0 } else { 0.0 }
|
||||
if (j, k) == (1, 1) { 1.0 } else { 0.0 },
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -829,8 +828,8 @@ mod tests {
|
|||
}
|
||||
}
|
||||
|
||||
fn translation_motion_unif(vel: &Vector3<f64>, assembly_dim: usize)
|
||||
-> Vec<DVector<f64>> {
|
||||
fn translation_motion_unif(vel: &Vector3<f64>, assembly_dim: usize
|
||||
) -> Vec<DVector<f64>> {
|
||||
let mut elt_motion = DVector::zeros(4);
|
||||
elt_motion.fixed_rows_mut::<3>(0).copy_from(vel);
|
||||
iter::repeat(elt_motion).take(assembly_dim).collect()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue