# Commits

committed ac9b2d8

removed Circle and Line for now

# geometry.ml

` `
` type base_image =`
` | Poly   of posn * posn list * color`
`-| Line   of posn * posn * color`
`-| Circle of posn * float * color`
`-`
`-let posn_map {x;y} ~f =`
`-  { x = f x; y = f y }`
` `
` let merge_posn p1 p2 ~f =`
`   { x = f p1.x p2.x`
`   | Poly (p, ps, _) ->`
`     let corner merge = List.fold ~f:merge ~init:p ps in`
`     (corner posn_min, corner posn_max)`
`-  | Line (p1,p2,_) ->`
`-    (posn_min p1 p2, posn_max p1 p2)`
`-  | Circle (p,r,_) ->`
`-    (posn_map p ~f:(fun x -> x -. r),`
`-     posn_map p ~f:(fun x -> x +. r))`
` `
` let merge_corners (ll1,ur1) (ll2,ur2) =`
`   (posn_min ll1 ll2, posn_max ur1 ur2)`
`   match b with`
`   | Poly (p, ps,c) ->`
`     Poly (sp p, List.map ~f:sp ps, c)`
`-  | Line (p1,p2,c) ->`
`-    Line (sp p1, sp p2, c)`
`-  | Circle (p,r,c) ->`
`-    Circle (sp p, r *. by, c)`
` `
` type combo =`
` | Base of base_image`
`     let rot p = fast_rot (p -! around) cs +! around in`
`     combo_map combo ~f:(function`
`     | Poly (p,ps,c) -> Poly (rot p, List.map ~f:rot ps, c)`
`-    | Line (p1,p2,c) -> Line (rot p1, rot p2, c)`
`-    | Circle (p,r,c) -> Circle (rot p, r, c)`
`     ))`
` `
` let scale_around image ~around ~by =`
`   | hd :: tl ->`
`     Some (Base (Poly (hd,tl,color)))`
` `
`-let line p1 p2 color =`
`-  Some (Base (Line (p1,p2,color)))`
`-`
`-let circle radius color =`
`-  Some (Base (Circle (origin,radius,color)))`
`-`
` let shift image offset =`
`   Option.map image ~f:(fun combo ->`
`     if offset.x = 0. && offset.y = 0. then combo`
`     else`
`       let combo = combo_map combo ~f:(function`
`-        | Circle (p,r,c) ->`
`-          Circle (p +! offset, r, c)`
`-        | Line (p1,p2,c) ->`
`-          Line (p1 +! offset, p2 +! offset,c)`
`         | Poly (p,ps,c) ->`
`           let f p = p +! offset in`
`           Poly (f p, List.map ~f ps, c)`

# geometry.mli

` `
` type base_image =`
` | Poly of posn * posn list * color`
`-| Line of posn * posn * color`
`-| Circle of posn * float * color`
` `
` type image`
` `
` val empty_image : image`
` val poly : posn list -> color -> image`
`-val line : posn -> posn -> color -> image`
`-val circle : float -> color -> image`
` `
` val scale  : ?around:posn -> by:float  -> image -> image`
` val rotate : ?around:posn -> deg:float -> image -> image`

# world.ml

` let gl_color {r;g;b} = (r,g,b)`
` `
` let draw_base_image = function`
`-  | Circle _ -> assert false`
`-  | Line _ -> assert false`
`   | Poly (first,rest,color) ->`
`     GlDraw.begins `polygon;`
`     GlDraw.color (gl_color color);`
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.