Minimal crate for HTree fractals.
The following code snippet will draw an HTree of order $6$ scaled by a factor of $700$. ```Rust
use htree::HTree; use image::{ImageBuffer, Luma}; use imageproc::drawing::drawlinesegment_mut;
let order=5;
let htree: HTree
// scale fractal by a factor of 700 let scale = 700f32;
//dimensions of resulting image let width = (scale * 1f32) as u32; let height = (scale * 1f32 / 2f32.sqrt()) as u32;
let mut image: ImageBuffer
let black = Luma([0u8]); for (start, stop) in htree.intoiter().map(|(start, stop)| { ( (start.0 * scale, start.1 * scale), (stop.0 * scale, stop.1 * scale), ) }) { // Draw a line of the HTree in black drawlinesegmentmut(&mut image, (start.0, start.1), (stop.0, stop.1), black); } let path=format!("resources/examplehtreeorder_{order}.png"); image.save(path); ``` The output of this code snippet is :