From 329b774e315b41bc0d5b7daf8737222768c8d1f3 Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Sat, 9 Jan 2021 11:35:40 +0100 Subject: Formalized exchanges between worker and app --- path/fixed.ml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'path/fixed.ml') diff --git a/path/fixed.ml b/path/fixed.ml index 812dd3b..d9abcb5 100755 --- a/path/fixed.ml +++ b/path/fixed.ml @@ -14,6 +14,12 @@ end module Make(Point:P) = struct + type bezier = + { p0:Point.t (* The starting point *) + ; p1:Point.t (* The end point *) + ; ctrl0:Gg.v2 (* The control point *) + ; ctrl1:Gg.v2 } (* The control point *) + module type BUILDER = sig type t @@ -21,12 +27,6 @@ module Make(Point:P) = struct : t -> (module Repr.M with type t = Point.t and type repr = 's) -> 's -> 's end - type bezier = - { p0:Point.t (* The starting point *) - ; p1:Point.t (* The end point *) - ; ctrl0:Gg.v2 (* The control point *) - ; ctrl1:Gg.v2 } (* The control point *) - type path = | Line of Point.t * Point.t | Curve of bezier @@ -58,8 +58,8 @@ module Make(Point:P) = struct , Line (p1, p2)::t) let quadratic_to - : t -> Gg.v2 -> Gg.v2 -> t -> repr -> repr - = fun p0 ctrl0 ctrl1 p1 (i, t) -> + : (t * Gg.v2 * Gg.v2 * t) -> repr -> repr + = fun (p0, ctrl0, ctrl1, p1) (i, t) -> let curve = Curve { p0 ; ctrl0 @@ -99,10 +99,10 @@ module Make(Point:P) = struct = fun (type s) {path; _} (module Repr : Repr.M with type t = Point.t and type repr = s) repr -> let repr_bezier p bezier = Repr.quadratic_to - bezier.p0 - bezier.ctrl0 - bezier.ctrl1 - bezier.p1 + ( bezier.p0 + , bezier.ctrl0 + , bezier.ctrl1 + , bezier.p1 ) p in let _, repr = Array.fold_left path -- cgit v1.2.3