aboutsummaryrefslogtreecommitdiff
path: root/layer/linePrinter.ml
diff options
context:
space:
mode:
authorSébastien Dailly <sebastien@chimrod.com>2021-01-11 05:36:46 +0100
committerSébastien Dailly <sebastien@chimrod.com>2021-01-11 13:55:43 +0100
commit979be5f588a1ffd6e1d060cd794e87526d517b7a (patch)
treea96605b6ae27bcf646b17f022acf7f5f0cf0b8bf /layer/linePrinter.ml
parent85b40e5712fcbe76c697d1a22fb126db8079098c (diff)
Layer review
Diffstat (limited to 'layer/linePrinter.ml')
-rwxr-xr-xlayer/linePrinter.ml28
1 files changed, 15 insertions, 13 deletions
diff --git a/layer/linePrinter.ml b/layer/linePrinter.ml
index 45ee801..d223760 100755
--- a/layer/linePrinter.ml
+++ b/layer/linePrinter.ml
@@ -1,6 +1,6 @@
module Make(Repr: Repr.PRINTER) = struct
- type t = Path.Point.t
+ type point = Path.Point.t
let mark point path =
let open Gg.V2 in
@@ -17,27 +17,28 @@ module Make(Repr: Repr.PRINTER) = struct
path
- type repr =
+ type t =
{ path: (Repr.t)
}
+ type repr = Repr.t
+
let create_path
- : 'b -> repr
+ : 'b -> t
= fun _ ->
{ path = Repr.create ()
}
- (* Start a new path. *)
let start
- : Path.Point.t -> repr -> repr
- = fun t {path} ->
- let path = mark t path in
+ : point -> point -> t -> t
+ = fun p1 _ { path } ->
+ let path = mark p1 path in
{ path
}
let line_to
- : Path.Point.t -> Path.Point.t -> repr -> repr
- = fun p0 p1 {path} ->
+ : (point * point) -> (point * point) -> t -> t
+ = fun (p0, p1) _ {path} ->
let path = Repr.move_to (Path.Point.get_coord p0) path
|> Repr.line_to (Path.Point.get_coord p1)
|> mark p1 in
@@ -45,8 +46,8 @@ module Make(Repr: Repr.PRINTER) = struct
}
let quadratic_to
- : (t * Gg.v2 * Gg.v2 * t) -> repr -> repr
- = fun (p0, ctrl0, ctrl1, p1) { path } ->
+ : (point * Gg.v2 * Gg.v2 * point) -> (point * Gg.v2 * Gg.v2 * point) -> t -> t
+ = fun (p0, ctrl0, ctrl1, p1) _ {path} ->
let path = Repr.move_to (Path.Point.get_coord p0) path
|> Repr.quadratic_to ctrl0 ctrl1 (Path.Point.get_coord p1)
@@ -55,12 +56,13 @@ module Make(Repr: Repr.PRINTER) = struct
{ path = path }
let stop
- : repr -> repr
+ : t -> t
= fun path -> path
let get
- : repr -> Repr.t
+ : t -> Repr.t
= fun {path; _} ->
path
+
end