use micon::{Icon, TessorOne}; use tessor::Mesh; use tessor_viewer::{draw, Draw, Viewer}; fn main() { let content = r###" "###; let size = 1.0; let Some(icon) = Icon::from_str(&content, size, size) else { return; }; let divider = 400.0; let epsilon = (size / divider) as f64; let (_w, _h, meshs) = icon.tessor(epsilon); let mut views = Vec::new(); for m in meshs { let TessorOne { vertices, indices, color: (r, g, b, a), .. } = m; println!("==={}-{}", vertices.len(), indices.len()); views.push(( r as f32 / 255.0, g as f32 / 255.0, b as f32 / 255.0, a as f32 / 255.0, Mesh { vertices, indices }, )) } let viewer = Viewer::new(); viewer.run(move || { Mesh { vertices: vec![[-1.0, -1.0], [0.0, -1.0], [-1.0, 0.0], [0.0, 0.0]], indices: vec![0, 1, 2, 2, 1, 3], } .draw(draw::Options { triangle_color: [0.5, 0.5, 0.5, 1.0], edge_color: [0.0, 0.0, 0.0, 0.0], vertex_color: [0.0, 0.0, 0.0, 0.0], }); for (r, g, b, a, mesh) in views.iter() { mesh.draw(draw::Options { triangle_color: [*r, *g, *b, *a], edge_color: [0.0, 1.0, 1.0, 0.0], vertex_color: [1.0, 1.0, 0.0, 0.0], }) } }); }