Introducing SvgBobRus - converts ascii diagrams to happy little SVG


#1

Side by side comparizon of ascii and the generated SVG here

This was originally svgbob written in elm.
Some optimization of the generated SVG sized is already applied in the rust implementation.

There is still a major room for optimization to further reduce the svg size, by chaining the elements (lines/arc/paths) in such a way that the previous the end of the previous element is equal to the start of the next element. This way, the svg pen will have to skip moving.

struct Element{
    start: Point,
    end: Point,
}
element[0].end  =  element[1].start
element[1].end  = element[2].start
..etc..
 
/// rearrange the elements in such a way it produces the longest chain 
fn reorder_elements(elements:Vec<Element>) -> Vec<Element> {

}

If anyone knows of an algorithms for this, links I can use, LMK.

PR’s welcome