From 42c3c122c4f53dd68bcdd89411835887c3ae0af9 Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Mon, 11 Jan 2021 11:33:32 +0100 Subject: Outline module --- layer/ductusPrinter.ml | 82 -------------------------------------------------- 1 file changed, 82 deletions(-) delete mode 100755 layer/ductusPrinter.ml (limited to 'layer/ductusPrinter.ml') diff --git a/layer/ductusPrinter.ml b/layer/ductusPrinter.ml deleted file mode 100755 index db34481..0000000 --- a/layer/ductusPrinter.ml +++ /dev/null @@ -1,82 +0,0 @@ -module Make(Repr: Repr.PRINTER) = struct - - type point = Path.Point.t - - type t = - { path: (Repr.t) - } - - type repr = Repr.t - - let create_path - : 'b -> t - = fun _ -> - { path = Repr.create () - } - - let start - : point -> point -> t -> t - = fun p1 p2 { path } -> - let path = - Repr.move_to (Path.Point.get_coord p1) path - |> Repr.line_to (Path.Point.get_coord p2) in - { path - } - - let line_to - : (point * point) -> (point * point) -> t -> t - = fun (_, p1) (_, p1') {path} -> - let path = Repr.move_to (Path.Point.get_coord p1) path in - let path = Repr.line_to (Path.Point.get_coord p1') path in - { path - } - - let quadratic_to - : (point * Gg.v2 * Gg.v2 * point) -> (point * Gg.v2 * Gg.v2 * point) -> t -> t - = fun (p0, ctrl0, ctrl1, p1) (p0', ctrl0', ctrl1', p1') {path} -> - - let bezier = - { Shapes.Bezier.p0 = Path.Point.get_coord p0 - ; ctrl0 - ; ctrl1 - ; p1 = Path.Point.get_coord p1 - } - - and bezier' = - { Shapes.Bezier.p0 = Path.Point.get_coord p0' - ; ctrl0 = ctrl0' - ; ctrl1 = ctrl1' - ; p1 = Path.Point.get_coord p1' - } in - - (* Mark each point on the bezier curve. The first point is the most - recent point *) - let delay = - ((Path.Point.get_stamp p0) -. (Path.Point.get_stamp p1)) - *. 30. - in - let path = ref path in - for i = 0 to ((Int.of_float delay) ) do - let ratio = (Float.of_int i) /. delay in - let bezier, _ = Shapes.Bezier.slice ratio bezier - and bezier', _ = Shapes.Bezier.slice ratio bezier' in - - let point = Path.Point.mix ratio bezier.Shapes.Bezier.p1 p0 p1 - and point' = Path.Point.mix ratio bezier'.Shapes.Bezier.p1 p0' p1' in - - path := Repr.move_to (Path.Point.get_coord point) !path; - path := Repr.line_to (Path.Point.get_coord point') !path; - done; - - { path = !path } - - let stop - : t -> t - = fun path -> path - - - let get - : t -> Repr.t - = fun {path; _} -> - path -end -- cgit v1.2.3