let colors = [| "black"; "white"; "red"; "green"; "blue"; "magenta"; "yellow"; "cyan"; |] let _ = let oc = open_out "bad.gml" in output_string oc " 0.0 0.0 0.0 point /black 1.0 1.0 1.0 point /white 1.0 0.0 0.0 point /red 0.0 1.0 0.0 point /green 0.0 0.0 1.0 point /blue 1.0 0.0 1.0 point /magenta 1.0 1.0 0.0 point /yellow 0.0 1.0 1.0 point /cyan { /v /u /face white 0.0 1.0 1.0 } plane 0.0 -3.0 0.0 translate { /v /u /face green 1.0 0.0 1.0 } sphere 0.0 0.0 7.0 translate union "; Random.self_init (); for i = 1 to 200 do let x = Random.float 50.0 -. 25. in let y = Random.float 50.0 -. 25. in let z = Random.float 20.0 +. 5. in let color = colors.(Random.int 7) in let sc = 1.0 +. Random.float 10.0 in output_string oc (Printf.sprintf " { /v /u /face %s 1.0 0.5 1.0 } sphere %f %f %f translate %f uscale union " color x y z sc); done; output_string oc " /scene % directional light 1.0 -1.0 0.0 point % direction 1.0 1.0 1.0 point light /l % directional light % render 0.4 0.4 0.4 point % ambient light [ l ] % lights scene % scene to render 10 % tracing depth 90.0 % field of view 640 480 % image wid and height \"bad.ppm\" % output file render "; close_out oc