|
1 | 1 | use crate::reconstruction::arguments::*; |
2 | 2 | use crate::{io, logging}; |
3 | | -use anyhow::{anyhow, Context}; |
| 3 | +use anyhow::{Context, anyhow}; |
4 | 4 | use clap::value_parser; |
5 | 5 | use indicatif::{ProgressBar, ProgressStyle}; |
6 | 6 | use log::{error, info}; |
7 | 7 | use rayon::prelude::*; |
8 | 8 | use splashsurf_lib::mesh::{AttributeData, Mesh3d, MeshAttribute, MeshWithData}; |
9 | 9 | use splashsurf_lib::nalgebra::{Unit, Vector3}; |
10 | 10 | use splashsurf_lib::sph_interpolation::SphInterpolator; |
11 | | -use splashsurf_lib::{profile, Aabb3d, Index, Real}; |
| 11 | +use splashsurf_lib::{Aabb3d, Index, Real, profile}; |
12 | 12 | use std::borrow::Cow; |
13 | 13 | use std::collections::HashMap; |
14 | 14 | use std::convert::TryFrom; |
@@ -423,11 +423,11 @@ pub fn reconstruct_subcommand(cmd_args: &ReconstructSubcommandArgs) -> Result<() |
423 | 423 | mod arguments { |
424 | 424 | use super::ReconstructSubcommandArgs; |
425 | 425 | use crate::io; |
426 | | - use anyhow::{anyhow, Context}; |
| 426 | + use anyhow::{Context, anyhow}; |
427 | 427 | use log::info; |
428 | | - use regex::{escape, Regex}; |
429 | | - use splashsurf_lib::nalgebra::Vector3; |
| 428 | + use regex::{Regex, escape}; |
430 | 429 | use splashsurf_lib::Aabb3d; |
| 430 | + use splashsurf_lib::nalgebra::Vector3; |
431 | 431 | use std::convert::TryFrom; |
432 | 432 | use std::fs; |
433 | 433 | use std::path::{Path, PathBuf}; |
@@ -484,7 +484,11 @@ mod arguments { |
484 | 484 | ); |
485 | 485 |
|
486 | 486 | if !aabb.is_consistent() { |
487 | | - return Err(anyhow!("The user specified {error_str} min/max values are inconsistent! min: {:?} max: {:?}", aabb.min().as_slice(), aabb.max().as_slice())); |
| 487 | + return Err(anyhow!( |
| 488 | + "The user specified {error_str} min/max values are inconsistent! min: {:?} max: {:?}", |
| 489 | + aabb.min().as_slice(), |
| 490 | + aabb.max().as_slice() |
| 491 | + )); |
488 | 492 | } |
489 | 493 |
|
490 | 494 | if aabb.is_degenerate() { |
@@ -632,7 +636,11 @@ mod arguments { |
632 | 636 | // Ensure that output directory exists/create it |
633 | 637 | if let Some(output_dir) = output_file.parent() { |
634 | 638 | if !output_dir.exists() { |
635 | | - info!("The output directory \"{}\" of the output file \"{}\" does not exist. Trying to create it now...", output_dir.display(), output_file.display()); |
| 639 | + info!( |
| 640 | + "The output directory \"{}\" of the output file \"{}\" does not exist. Trying to create it now...", |
| 641 | + output_dir.display(), |
| 642 | + output_file.display() |
| 643 | + ); |
636 | 644 | fs::create_dir_all(output_dir).with_context(|| { |
637 | 645 | format!( |
638 | 646 | "Unable to create output directory \"{}\"", |
@@ -776,7 +784,7 @@ mod arguments { |
776 | 784 | return Err(anyhow!( |
777 | 785 | "The input file path \"{}\" does not end with a filename", |
778 | 786 | args.input_file_or_sequence.display() |
779 | | - )) |
| 787 | + )); |
780 | 788 | } |
781 | 789 | }; |
782 | 790 |
|
@@ -975,7 +983,11 @@ pub(crate) fn reconstruction_pipeline_generic<I: Index, R: Real>( |
975 | 983 | )); |
976 | 984 | let tris_after = mesh_with_data.mesh.triangles.len(); |
977 | 985 | let verts_after = mesh_with_data.mesh.vertices.len(); |
978 | | - info!("Post-processing: Cleanup reduced number of vertices to {:.2}% and number of triangles to {:.2}% of original mesh.", (verts_after as f64 / verts_before as f64) * 100.0, (tris_after as f64 / tris_before as f64) * 100.0) |
| 986 | + info!( |
| 987 | + "Post-processing: Cleanup reduced number of vertices to {:.2}% and number of triangles to {:.2}% of original mesh.", |
| 988 | + (verts_after as f64 / verts_before as f64) * 100.0, |
| 989 | + (tris_after as f64 / tris_before as f64) * 100.0 |
| 990 | + ) |
979 | 991 | } |
980 | 992 |
|
981 | 993 | // Decimate mesh if requested |
@@ -1320,13 +1332,19 @@ pub(crate) fn reconstruction_pipeline_generic<I: Index, R: Real>( |
1320 | 1332 | } |
1321 | 1333 | _ => unreachable!(), |
1322 | 1334 | } { |
1323 | | - error!("Checked mesh for problems (holes: {}, non-manifold edges/vertices: {}), problems were found!", postprocessing.check_mesh_closed, postprocessing.check_mesh_manifold); |
| 1335 | + error!( |
| 1336 | + "Checked mesh for problems (holes: {}, non-manifold edges/vertices: {}), problems were found!", |
| 1337 | + postprocessing.check_mesh_closed, postprocessing.check_mesh_manifold |
| 1338 | + ); |
1324 | 1339 | error!("{}", err); |
1325 | 1340 | return Err(anyhow!("{}", err)) |
1326 | 1341 | .context(format!("Checked mesh for problems (holes: {}, non-manifold edges/vertices: {}), problems were found!", postprocessing.check_mesh_closed, postprocessing.check_mesh_manifold)) |
1327 | 1342 | .context(format!("Problem found with mesh file \"{}\"", paths.output_file.display())); |
1328 | 1343 | } else { |
1329 | | - info!("Checked mesh for problems (holes: {}, non-manifold edges/vertices: {}), no problems were found.", postprocessing.check_mesh_closed, postprocessing.check_mesh_manifold); |
| 1344 | + info!( |
| 1345 | + "Checked mesh for problems (holes: {}, non-manifold edges/vertices: {}), no problems were found.", |
| 1346 | + postprocessing.check_mesh_closed, postprocessing.check_mesh_manifold |
| 1347 | + ); |
1330 | 1348 | } |
1331 | 1349 | } |
1332 | 1350 |
|
|
0 commit comments