aboutsummaryrefslogtreecommitdiff
path: root/layer/ductusEngine.ml
diff options
context:
space:
mode:
authorSébastien Dailly <sebastien@chimrod.com>2021-02-05 09:08:39 +0100
committerSébastien Dailly <sebastien@dailly.me>2022-02-07 14:39:30 +0100
commit561d0f0155f4906d90eb7e73a3ff9cb28909126f (patch)
tree9a606c2d7832272ea33d7052512a5fa59805d582 /layer/ductusEngine.ml
parent86ec559f913c389e8dc055b494630f21a45e039b (diff)
Update project structure
Diffstat (limited to 'layer/ductusEngine.ml')
-rwxr-xr-xlayer/ductusEngine.ml82
1 files changed, 0 insertions, 82 deletions
diff --git a/layer/ductusEngine.ml b/layer/ductusEngine.ml
deleted file mode 100755
index b943467..0000000
--- a/layer/ductusEngine.ml
+++ /dev/null
@@ -1,82 +0,0 @@
-module Make(Layer: Repr.PRINTER) = struct
-
- type point = Path.Point.t
-
- type t =
- { path: (Layer.t)
- }
-
- type repr = Layer.t
-
- let create_path
- : 'b -> t
- = fun _ ->
- { path = Layer.create ()
- }
-
- let start
- : point -> point -> t -> t
- = fun p1 p2 { path } ->
- let path =
- Layer.move_to (Path.Point.get_coord p1) path
- |> Layer.line_to (Path.Point.get_coord p2) in
- { path
- }
-
- let line_to
- : (point * point) -> (point * point) -> t -> t
- = fun (_, p1) (_, p1') {path} ->
- let path = Layer.move_to (Path.Point.get_coord p1) path in
- let path = Layer.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 := Layer.move_to (Path.Point.get_coord point) !path;
- path := Layer.line_to (Path.Point.get_coord point') !path;
- done;
-
- { path = !path }
-
- let stop
- : t -> t
- = fun path -> path
-
-
- let get
- : t -> Layer.t
- = fun {path; _} ->
- path
-end