From 979be5f588a1ffd6e1d060cd794e87526d517b7a Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Mon, 11 Jan 2021 05:36:46 +0100 Subject: Layer review --- path/builder.ml | 4 ++-- path/builder.mli | 2 +- path/fixed.ml | 14 +++++++------- path/fixed.mli | 4 ++-- path/repr.ml | 13 +++++++------ 5 files changed, 19 insertions(+), 18 deletions(-) (limited to 'path') diff --git a/path/builder.ml b/path/builder.ml index 7901e78..166c073 100755 --- a/path/builder.ml +++ b/path/builder.ml @@ -104,8 +104,8 @@ module Make(Point:P) = struct | hd::_ -> Some hd let repr - : t -> (module Repr.M with type t = Point.t and type repr = 's) -> 's -> 's - = fun (type s) (points, beziers) (module Repr : Repr.M with type t = Point.t and type repr = s) path -> + : t -> (module Repr.M with type point = Point.t and type t = 's) -> 's -> 's + = fun (type s) (points, beziers) (module Repr : Repr.M with type point = Point.t and type t = s) path -> (* Represent the last points *) let path = match points with diff --git a/path/builder.mli b/path/builder.mli index 78bb778..ff66bcb 100755 --- a/path/builder.mli +++ b/path/builder.mli @@ -35,6 +35,6 @@ module Make(Point:P) : sig (** Represent the path *) val repr - : t -> (module Repr.M with type t = Point.t and type repr = 's) -> 's -> 's + : t -> (module Repr.M with type point = Point.t and type t = 's) -> 's -> 's end diff --git a/path/fixed.ml b/path/fixed.ml index 08b9c2b..2eda3c1 100755 --- a/path/fixed.ml +++ b/path/fixed.ml @@ -24,7 +24,7 @@ module Make(Point:P) = struct type t val repr - : t -> (module Repr.M with type t = Point.t and type repr = 's) -> 's -> 's + : t -> (module Repr.M with type point = Point.t and type t = 's) -> 's -> 's end type path = @@ -47,9 +47,9 @@ module Make(Point:P) = struct = fun {id; _} -> id module ToFixed = struct - type t = Point.t + type point = Point.t - type repr = int * step list + type t = int * step list let create_path () = 0, [] @@ -59,7 +59,7 @@ module Make(Point:P) = struct t let line_to - : t -> t -> repr -> repr + : point -> point -> t -> t = fun p1 p2 (i, t) -> ( i + 1 , { point = p1 @@ -67,7 +67,7 @@ module Make(Point:P) = struct }:: t ) let quadratic_to - : (t * Gg.v2 * Gg.v2 * t) -> repr -> repr + : (point * Gg.v2 * Gg.v2 * point) -> t -> t = fun (p0, ctrl0, ctrl1, p1) (i, t) -> let curve = Curve { ctrl0 @@ -105,8 +105,8 @@ module Make(Point:P) = struct } let repr - : t -> (module Repr.M with type t = Point.t and type repr = 's) -> 's -> 's - = fun (type s) {path; _} (module Repr : Repr.M with type t = Point.t and type repr = s) repr -> + : t -> (module Repr.M with type point = Point.t and type t = 's) -> 's -> 's + = fun (type s) {path; _} (module Repr : Repr.M with type point = Point.t and type t = s) repr -> let repr_bezier p p0 bezier = Repr.quadratic_to ( p0 diff --git a/path/fixed.mli b/path/fixed.mli index 2daadb4..862409b 100755 --- a/path/fixed.mli +++ b/path/fixed.mli @@ -16,7 +16,7 @@ module Make(Point:P) : sig type t val repr - : t -> (module Repr.M with type t = Point.t and type repr = 's) -> 's -> 's + : t -> (module Repr.M with type point = Point.t and type t = 's) -> 's -> 's end @@ -32,7 +32,7 @@ module Make(Point:P) : sig (** Represent the path *) val repr - : t -> (module Repr.M with type t = Point.t and type repr = 's) -> 's -> 's + : t -> (module Repr.M with type point = Point.t and type t = 's) -> 's -> 's (** Structure to represent all the required information for evaluating the distance between a point and a path *) diff --git a/path/repr.ml b/path/repr.ml index 55a2920..17fd914 100755 --- a/path/repr.ml +++ b/path/repr.ml @@ -1,18 +1,19 @@ module type M = sig - type t - type repr + type point + + type t (* Start a new path. *) val start - : t -> repr -> repr + : point -> t -> t val line_to - : t -> t -> repr -> repr + : point -> point -> t -> t val quadratic_to - : (t * Gg.v2 * Gg.v2 * t) -> repr -> repr + : (point * Gg.v2 * Gg.v2 * point) -> t -> t val stop - : repr -> repr + : t -> t end -- cgit v1.2.3