@@ -21,6 +21,7 @@ use core::f64::consts::PI;
2121use get_size:: GetSize ;
2222use itertools:: Itertools ;
2323use nalgebra:: Matrix3 ;
24+ use std:: fmt:: Display ;
2425use std:: io:: Write ;
2526use std:: path:: Path ;
2627use std:: sync:: { Arc , OnceLock } ;
@@ -130,7 +131,7 @@ impl<T: Clone + GetSize> IcoTable2D<T> {
130131
131132 pub fn angle_resolution ( & self ) -> f64 {
132133 let n_points = self . data . len ( ) ;
133- ( 4.0 * std :: f64 :: consts :: PI / n_points as f64 ) . sqrt ( )
134+ ( 4.0 * PI / n_points as f64 ) . sqrt ( )
134135 }
135136
136137 /// Number of vertices in the table
@@ -146,7 +147,7 @@ impl<T: Clone + GetSize> IcoTable2D<T> {
146147 /// Set data associated with each vertex using a generator function
147148 /// The function takes the index of the vertex and its position
148149 /// Due to the `OnceLock` wrap, this can be done only once!
149- pub fn set_vertex_data ( & self , f : impl Fn ( usize , & Vector3 ) -> T ) -> anyhow :: Result < ( ) > {
150+ pub fn set_vertex_data ( & self , f : impl Fn ( usize , & Vector3 ) -> T ) -> Result < ( ) > {
150151 ensure ! (
151152 self . data. iter( ) . any( |v| v. get( ) . is_none( ) ) ,
152153 "Data already set for some vertices"
@@ -326,7 +327,7 @@ impl<T: Clone + GetSize> IcoTable2D<T> {
326327 }
327328}
328329
329- impl std :: fmt :: Display for IcoTable2D < f64 > {
330+ impl Display for IcoTable2D < f64 > {
330331 fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
331332 writeln ! ( f, "# x y z θ φ data" ) ?;
332333 for ( pos, _, data) in self . iter ( ) {
@@ -372,7 +373,7 @@ impl IcoTable4D {
372373 bary_a : & Vector3 ,
373374 bary_b : & Vector3 ,
374375 ) -> f64 {
375- let data_ab = Matrix3 :: < f64 > :: from_fn ( |i, j| {
376+ let data_ab = Matrix3 :: from_fn ( |i, j| {
376377 * self
377378 . get_data ( face_a[ i] )
378379 . get ( )
@@ -404,7 +405,7 @@ impl Table6D {
404405 // Vertex positions and neighbors are shared across all tables w. thread-safe smart pointer.
405406 // Oncelocked data on the innermost table1 is left uninitialized and should be set later
406407 let vertices = Arc :: new ( vertices) ;
407- let table_b = IcoTable2D :: < f64 > :: from_vertices ( vertices. clone ( ) , None ) ; // B: 𝜃 and 𝜑
408+ let table_b = IcoTable2D :: from_vertices ( vertices. clone ( ) , None ) ; // B: 𝜃 and 𝜑
408409
409410 // We have a new angular resolution, depending on number of subdivisions
410411 let angle_resolution = table_b. angle_resolution ( ) ;
@@ -455,7 +456,7 @@ pub(crate) fn vmd_draw(
455456 icosphere : & IcoSphere ,
456457 color : & str ,
457458 scale : Option < f32 > ,
458- ) -> anyhow :: Result < ( ) > {
459+ ) -> Result < ( ) > {
459460 let num_faces = icosphere. get_all_indices ( ) . len ( ) / 3 ;
460461 let path = path. with_extension ( format ! ( "faces{}.vmd" , num_faces) ) ;
461462 let mut stream = std:: fs:: File :: create ( path) ?;
@@ -514,7 +515,7 @@ mod tests {
514515 #[ test]
515516 fn test_icosphere_table ( ) {
516517 let icosphere = make_icosphere ( 3 ) . unwrap ( ) ;
517- let icotable = IcoTable2D :: < f64 > :: from_icosphere ( & icosphere, 0.0 ) ;
518+ let icotable = IcoTable2D :: from_icosphere ( & icosphere, 0.0 ) ;
518519 assert_eq ! ( icotable. data. len( ) , 12 ) ;
519520
520521 let point = icotable. get_normalized_pos ( 0 ) ;
@@ -560,7 +561,7 @@ mod tests {
560561 #[ test]
561562 fn test_icosphere_interpolate ( ) {
562563 let icosphere = make_icosphere ( 3 ) . unwrap ( ) ;
563- let icotable = IcoTable2D :: < f64 > :: from_icosphere_without_data ( & icosphere) ;
564+ let icotable = IcoTable2D :: from_icosphere_without_data ( & icosphere) ;
564565 icotable. set_vertex_data ( |i, _| i as f64 + 1.0 ) . unwrap ( ) ;
565566
566567 let point = Vector3 :: new ( 0.5 , 0.5 , 0.5 ) . normalize ( ) ;
@@ -576,7 +577,7 @@ mod tests {
576577 fn test_face_face_interpolation ( ) {
577578 let n_points = 12 ;
578579 let icosphere = make_icosphere ( n_points) . unwrap ( ) ;
579- let icotable = IcoTable2D :: < f64 > :: from_icosphere_without_data ( & icosphere) ;
580+ let icotable = IcoTable2D :: from_icosphere_without_data ( & icosphere) ;
580581 icotable. set_vertex_data ( |i, _| i as f64 ) . unwrap ( ) ;
581582 let icotable_of_spheres = IcoTable4D :: from_min_points ( n_points, icotable) . unwrap ( ) ;
582583
0 commit comments