open Printf let rec fig l x y = if l < 3. then ( (* deseneaza patrat *) printf "M %.1f %.1f " x y; (* muta cursorul la (x, y) *) printf "h %.1f" l; (* h = linie orizontala *) printf "v %.1f" l; (* v = linie verticala *) printf "h %.1f" (-.l); printf "v %.1f" (-.l) ) else let l3 = l /. 3. in let l23 = 2. *. l3 in let fig3 = fig l3 in ( (* 5 figuri de latura l/3 *) fig3 x y; fig3 (x +. l23) y; fig3 (x +. l3) (y +. l3); fig3 x (y +. l23); fig3 (x +. l23) (y +. l23) ) let () = ( print_string "<?xml version=\"1.0\"?>\n\ <svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n\ <path d=\""; fig 729. 0. 0.; print_string "\"/>\n</svg>" )
This document was generated using caml2html