MCPcopy Create free account
hub / github.com/Notgnoshi/generative / main

Function main

tools/triangulate.rs:45–82  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

43}
44
45fn main() -> eyre::Result<()> {
46 color_eyre::install()?;
47 let args = CmdlineOptions::parse();
48
49 let filter = tracing_subscriber::EnvFilter::builder()
50 .with_default_directive(args.log_level.into())
51 .from_env_lossy();
52 tracing_subscriber::fmt()
53 .with_env_filter(filter)
54 .with_ansi(true)
55 .with_writer(std::io::stderr)
56 .init();
57
58 let reader = get_input_reader(&args.input)?;
59 let mut writer = get_output_writer(&args.output)?;
60 let geometries = read_geometries(reader); // lazily loaded
61
62 match args.strategy {
63 TriangulationStrategy::EachGeometry => {
64 let triangulations = geometries
65 .map(|geom| flatten_geometries_into_points(std::iter::once(geom)))
66 .filter_map(triangulate);
67 for triangulation in triangulations {
68 let graph = triangulation.graph();
69 write_graph(&mut writer, &graph, &args.output_format)?;
70 }
71 }
72 TriangulationStrategy::WholeCollection => {
73 let points = flatten_geometries_into_points(geometries);
74 if let Some(triangulation) = triangulate(points) {
75 let graph = triangulation.graph();
76 write_graph(writer, &graph, &args.output_format)?;
77 }
78 }
79 }
80
81 Ok(())
82}

Callers

nothing calls this directly

Calls 7

get_input_readerFunction · 0.85
get_output_writerFunction · 0.85
read_geometriesFunction · 0.85
write_graphFunction · 0.85
triangulateFunction · 0.85
graphMethod · 0.80

Tested by

no test coverage detected